Changeset a35b458 in mainline for uspace/app/getterm


Ignore:
Timestamp:
2018-03-02T20:10:49Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/getterm/getterm.c

    r3061bc1 ra35b458  
    6363        if (fclose(*stream))
    6464                return;
    65        
     65
    6666        *stream = NULL;
    67        
     67
    6868        int oldfd;
    6969        errno_t rc = vfs_lookup_open(path, WALK_REGULAR, mode, &oldfd);
    7070        if (rc != EOK)
    7171                return;
    72        
     72
    7373        if (oldfd != fd) {
    7474                int newfd;
    7575                if (vfs_clone(oldfd, fd, false, &newfd) != EOK)
    7676                        return;
    77                
     77
    7878                assert(newfd == fd);
    7979
     
    8181                        return;
    8282        }
    83        
     83
    8484        *stream = fdopen(fd, fmode);
    8585}
     
    9393                return 1;
    9494        }
    95        
     95
    9696        char *term = *argv;
    9797        argv++;
    9898        argc--;
    99        
     99
    100100        char *locfs = *argv;
    101101        argv++;
    102102        argc--;
    103        
     103
    104104        bool print_msg = false;
    105105        bool wait = false;
    106        
     106
    107107        while ((argc > 0) && (str_cmp(*argv, "--") != 0)) {
    108108                if (str_cmp(*argv, "--msg") == 0) {
     
    114114                        return 2;
    115115                }
    116                
     116
    117117                argv++;
    118118                argc--;
    119119        }
    120        
     120
    121121        if (argc < 1) {
    122122                usage();
    123123                return 3;
    124124        }
    125        
     125
    126126        /* Skip "--" */
    127127        argv++;
    128128        argc--;
    129        
     129
    130130        char *cmd = *argv;
    131131        char **args = argv;
    132        
     132
    133133        if (wait) {
    134134                /* Wait for the terminal service to be ready */
     
    141141                }
    142142        }
    143        
     143
    144144        char term_node[LOC_NAME_MAXLEN];
    145145        snprintf(term_node, LOC_NAME_MAXLEN, "%s/%s", locfs, term);
    146        
     146
    147147        reopen(&stdin, 0, term_node, MODE_READ, "r");
    148148        reopen(&stdout, 1, term_node, MODE_WRITE, "w");
    149149        reopen(&stderr, 2, term_node, MODE_WRITE, "w");
    150        
     150
    151151        if (stdin == NULL)
    152152                return 4;
    153        
     153
    154154        if (stdout == NULL)
    155155                return 5;
    156        
     156
    157157        if (stderr == NULL)
    158158                return 6;
    159        
     159
    160160        /*
    161161         * FIXME: fdopen() should actually detect that we are opening a console
     
    163163         */
    164164        setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
    165        
     165
    166166        version_print(term);
    167167        if (print_msg)
    168168                welcome_msg_print();
    169        
     169
    170170        task_id_t id;
    171171        task_wait_t twait;
    172        
     172
    173173        errno_t rc = task_spawnv(&id, &twait, cmd, (const char * const *) args);
    174174        if (rc != EOK) {
     
    177177                return rc;
    178178        }
    179        
     179
    180180        task_exit_t texit;
    181181        int retval;
     
    186186                return rc;
    187187        }
    188        
     188
    189189        return 0;
    190190}
Note: See TracChangeset for help on using the changeset viewer.