Changeset 1abcf1d in mainline


Ignore:
Timestamp:
2018-04-10T19:43:21Z (6 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a69d42e
Parents:
9fa14d8d
Message:

puts() should append newline.

Files:
13 edited

Legend:

Unmodified
Added
Removed
  • boot/generic/src/vprintf.c

    r9fa14d8d r1abcf1d  
    6060        }
    6161
     62        putchar('\n');
    6263        return chars;
    6364}
  • kernel/generic/src/printf/vprintf.c

    r9fa14d8d r1abcf1d  
    7979        }
    8080
     81        putchar('\n');
    8182        return chars;
    8283}
  • uspace/app/bdsh/cmds/modules/cat/cat.c

    r9fa14d8d r1abcf1d  
    353353                case 'H':
    354354                        if (!optarg || str_uint64_t(optarg, NULL, 10, false, &head) != EOK) {
    355                                 puts("Invalid head size\n");
     355                                puts("Invalid head size");
    356356                                return CMD_FAILURE;
    357357                        }
     
    359359                case 't':
    360360                        if (!optarg || str_uint64_t(optarg, NULL, 10, false, &tail) != EOK) {
    361                                 puts("Invalid tail size\n");
     361                                puts("Invalid tail size");
    362362                                return CMD_FAILURE;
    363363                        }
     
    367367                case 'b':
    368368                        if (!optarg || str_size_t(optarg, NULL, 10, false, &buffer) != EOK) {
    369                                 puts("Invalid buffer size\n");
     369                                puts("Invalid buffer size");
    370370                                return CMD_FAILURE;
    371371                        }
  • uspace/app/tetris/scores.c

    r9fa14d8d r1abcf1d  
    128128        clear_screen();
    129129        moveto(10, 10);
    130         puts("Insert your name: ");
     130        fputs("Insert your name: ", stdout);
    131131        str_cpy(scores[NUMSPOTS - 1].hs_name, STR_BOUNDS(MAXLOGNAME) + 1,
    132132            "Player");
  • uspace/app/tetris/tetris.c

    r9fa14d8d r1abcf1d  
    179179        clear_screen();
    180180        moveto(5, 10);
    181         puts("Tetris\n\n");
     181        puts("Tetris\n");
    182182
    183183        moveto(8, 10);
     
    194194        printf("In game controls:");
    195195        moveto(21, 0);
    196         puts(key_msg);
     196        printf("%s", key_msg);
    197197}
    198198
  • uspace/app/tmon/main.c

    r9fa14d8d r1abcf1d  
    127127static void print_usage(char *app_name)
    128128{
    129         puts(NAME ": benchmark USB diagnostic device\n\n");
     129        puts(NAME ": benchmark USB diagnostic device\n");
    130130        printf("Usage: %s command [device] [options]\n\n", app_name);
    131131
     
    134134        }
    135135
    136         puts("\n");
     136        puts("");
    137137        for (unsigned i = 0; i < ARRAY_SIZE(options); ++i) {
    138138                printf(INDENT "-%c --%s\n" INDENT INDENT "%s\n", options[i].short_name, options[i].long_name, options[i].description);
    139139        }
    140140
    141         puts("\nIf no device is specified, the first device is used provided that it is the only one connected. Otherwise, the command fails.\n\n");
     141        puts("\nIf no device is specified, the first device is used provided that it is the only one connected. Otherwise, the command fails.\n");
    142142}
    143143
  • uspace/app/tmon/tests.c

    r9fa14d8d r1abcf1d  
    9494                case 't':
    9595                        if (!optarg || str_uint32_t(optarg, NULL, 10, false, &duration_uint) != EOK) {
    96                                 puts(NAME ": Invalid duration.\n");
     96                                puts(NAME ": Invalid duration.");
    9797                                rc = EINVAL;
    9898                                goto err_malloc;
     
    102102                case 's':
    103103                        if (!optarg || str_size_t(optarg, NULL, 10, false, &p->transfer_size) != EOK) {
    104                                 puts(NAME ": Invalid data size.\n");
     104                                puts(NAME ": Invalid data size.");
    105105                                rc = EINVAL;
    106106                                goto err_malloc;
     
    182182        const usbdiag_test_params_t *params = (usbdiag_test_params_t *) generic_params;
    183183        print_params(params);
    184         puts("\nTesting... ");
     184        fputs("\nTesting... ", stdout);
    185185
    186186        usbdiag_test_results_t results;
    187187        errno_t rc = usbdiag_test_in(exch, params, &results);
    188188        if (rc != EOK) {
    189                 puts("failed\n");
     189                puts("failed");
    190190                printf(NAME ": %s\n", str_error(rc));
    191191                return 1;
    192192        }
    193193
    194         puts("succeeded\n\n");
     194        puts("succeeded\n");
    195195        print_results(params, &results);
    196196        return 0;
     
    207207        const usbdiag_test_params_t *params = (usbdiag_test_params_t *) generic_params;
    208208        print_params(params);
    209         puts("\nTesting... ");
     209        fputs("\nTesting... ", stdout);
    210210
    211211        usbdiag_test_results_t results;
    212212        errno_t rc = usbdiag_test_out(exch, params, &results);
    213213        if (rc) {
    214                 puts("failed\n");
     214                puts("failed");
    215215                printf(NAME ": %s\n", str_error(rc));
    216216                return 1;
    217217        }
    218218
    219         puts("succeeded\n\n");
     219        puts("succeeded\n");
    220220        print_results(params, &results);
    221221        return 0;
  • uspace/app/top/screen.c

    r9fa14d8d r1abcf1d  
    120120        sysarg_t i;
    121121        for (i = c + 1; i < cols; i++)
    122                 puts(" ");
     122                fputs(" ", stdout);
    123123
    124124        if (r + 1 < rows)
    125                 puts("\n");
     125                puts("");
    126126}
    127127
     
    187187        size_t i;
    188188        for (i = 0; i < data->load_count; i++) {
    189                 puts(" ");
     189                fputs(" ", stdout);
    190190                stats_print_load_fragment(data->load[i], 2);
    191191        }
     
    259259                            data->cpus[i].id, data->cpus[i].frequency_mhz,
    260260                            busy, busy_suffix, idle, idle_suffix);
    261                         puts(", idle: ");
     261                        fputs(", idle: ", stdout);
    262262                        print_percent(data->cpus_perc[i].idle, 2);
    263                         puts(", busy: ");
     263                        fputs(", busy: ", stdout);
    264264                        print_percent(data->cpus_perc[i].busy, 2);
    265265                } else
     
    361361                int width = table->columns[i].width;
    362362                if (i != 0) {
    363                         puts(" ");
     363                        fputs(" ", stdout);
    364364                }
    365365                if (width == 0) {
     
    395395
    396396                if (column_index != 0) {
    397                         puts(" ");
     397                        fputs(" ", stdout);
    398398                }
    399399
  • uspace/dist/src/c/demos/tetris/scores.c

    r9fa14d8d r1abcf1d  
    129129        clear_screen();
    130130        moveto(10, 10);
    131         puts("Insert your name: ");
     131        fputs("Insert your name: ", stdout);
    132132        str_cpy(scores[NUMSPOTS - 1].hs_name, STR_BOUNDS(MAXLOGNAME) + 1,
    133133            "Player");
  • uspace/dist/src/c/demos/tetris/tetris.c

    r9fa14d8d r1abcf1d  
    180180        clear_screen();
    181181        moveto(5, 10);
    182         puts("Tetris\n\n");
     182        puts("Tetris\n");
    183183
    184184        moveto(8, 10);
  • uspace/dist/src/c/demos/top/screen.c

    r9fa14d8d r1abcf1d  
    120120        sysarg_t i;
    121121        for (i = c + 1; i < cols; i++)
    122                 puts(" ");
     122                fputs(" ", stdout);
    123123
    124124        if (r + 1 < rows)
    125                 puts("\n");
     125                puts("");
    126126}
    127127
     
    187187        size_t i;
    188188        for (i = 0; i < data->load_count; i++) {
    189                 puts(" ");
     189                fputs(" ", stdout);
    190190                stats_print_load_fragment(data->load[i], 2);
    191191        }
     
    259259                            data->cpus[i].id, data->cpus[i].frequency_mhz,
    260260                            busy, busy_suffix, idle, idle_suffix);
    261                         puts(", idle: ");
     261                        fputs(", idle: ", stdout);
    262262                        print_percent(data->cpus_perc[i].idle, 2);
    263                         puts(", busy: ");
     263                        fputs(", busy: ", stdout);
    264264                        print_percent(data->cpus_perc[i].busy, 2);
    265265                } else
     
    361361                int width = table->columns[i].width;
    362362                if (i != 0) {
    363                         puts(" ");
     363                        fputs(" ", stdout);
    364364                }
    365365                if (width == 0) {
     
    395395
    396396                if (column_index != 0) {
    397                         puts(" ");
     397                        fputs(" ", stdout);
    398398                }
    399399
  • uspace/lib/c/generic/io/io.c

    r9fa14d8d r1abcf1d  
    733733int puts(const char *str)
    734734{
    735         return fputs(str, stdout);
     735        if (fputs(str, stdout) < 0)
     736                return EOF;
     737        return putchar('\n');
    736738}
    737739
  • uspace/lib/c/include/stdio.h

    r9fa14d8d r1abcf1d  
    7676extern int fputs(const char *, FILE *);
    7777
     78// FIXME: putchar and fputc are byte-oriented.
     79// They shouldn't accept wide characters.
    7880extern int putchar(wchar_t);
    7981extern int puts(const char *);
Note: See TracChangeset for help on using the changeset viewer.