Feature request: pico-stdio: Provide puts_raw analogue that doesn't write newline #1335

Open
opened 2023-03-29 11:23:49 -05:00 by cocasema · 5 comments
cocasema commented 2023-03-29 11:23:49 -05:00 (Migrated from github.com)

It would be great to have access to stdio_put_string() version that doesn't append newline at the end - that would simplify logging and similar routines, and can help in some cases with custom stdio drivers.

int putchar_raw(int c) {
    char cc = (char)c;
    stdio_put_string(&cc, 1, false, true);
    return c;
}

int puts_raw(const char *s) {
    int len = (int)strlen(s);
    stdio_put_string(s, len, true, true);
    stdio_flush();
    return len;
}

//-+-+-+-+-+-+- suggestion -+-+-+-+-+-+-//
int put_string_raw(const char *s) {
    int len = (int)strlen(s);
    stdio_put_string(s, len, false, true);
    stdio_flush();
    return len;
}
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-//

If that's acceptable, I can send a PR.

It would be great to have access to `stdio_put_string()` version that doesn't append newline at the end - that would simplify logging and similar routines, and can help in some cases with custom stdio drivers. ``` c int putchar_raw(int c) { char cc = (char)c; stdio_put_string(&cc, 1, false, true); return c; } int puts_raw(const char *s) { int len = (int)strlen(s); stdio_put_string(s, len, true, true); stdio_flush(); return len; } //-+-+-+-+-+-+- suggestion -+-+-+-+-+-+-// int put_string_raw(const char *s) { int len = (int)strlen(s); stdio_put_string(s, len, false, true); stdio_flush(); return len; } //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-// ``` If that's acceptable, I can send a PR.
kilograham commented 2023-05-26 12:49:34 -05:00 (Migrated from github.com)

seems ok, but name is probably confusing maybe writes_raw is a better name

seems ok, but name is probably confusing maybe `writes_raw` is a better name
peterharperuk commented 2024-08-09 07:04:40 -05:00 (Migrated from github.com)

putchar_raw and puts_raw have been added. Marking this as resolved.

putchar_raw and puts_raw have been added. Marking this as resolved.
cocasema commented 2024-08-09 11:43:15 -05:00 (Migrated from github.com)

putchar_raw and puts_raw have been added. Marking this as resolved.

I'm a bit confused. Both putchar_raw and puts_raw were already there. The request was to add writes_raw (put_string_raw).

> putchar_raw and puts_raw have been added. Marking this as resolved. I'm a bit confused. Both `putchar_raw` and `puts_raw` were already there. The request was to add `writes_raw` (`put_string_raw`).
peterharperuk commented 2024-08-09 11:50:47 -05:00 (Migrated from github.com)

You're right. My misunderstanding. Lets see what @kilograham says.

You're right. My misunderstanding. Lets see what @kilograham says.
kilograham commented 2024-08-09 13:47:09 -05:00 (Migrated from github.com)

fixed

fixed
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#1335
No description provided.