Changeset 86cf96d in mainline


Ignore:
Timestamp:
2015-04-29T12:40:14Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e3811c9
Parents:
dcba819
git-author:
Luka Strižić <luka@…> (2015-04-29 12:40:14)
git-committer:
Jakub Jermar <jakub@…> (2015-04-29 12:40:14)
Message:

Set optreset before each option parsing
(Thanks to Luka Strižić)

bdsh modules such as ls can be used repeatedly within the lifetime of
the bdsh task. As such, they need to set the optreset variable before
each command line options evaluation.

Location:
uspace/app/bdsh/cmds/modules
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/cat/cat.c

    rdcba819 r86cf96d  
    324324        argc = cli_count_args(argv);
    325325
    326         for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
     326        for (c = 0, optreset = 1, optind = 0, opt_ind = 0; c != -1;) {
    327327                c = getopt_long(argc, argv, "xhvmH:t:b:s:n", long_options, &opt_ind);
    328328                switch (c) {
  • uspace/app/bdsh/cmds/modules/cmp/cmp.c

    rdcba819 r86cf96d  
    130130        argc = cli_count_args(argv);
    131131
    132         for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
     132        for (c = 0, optreset = 1, optind = 0, opt_ind = 0; c != -1;) {
    133133                c = getopt_long(argc, argv, "hv", long_options, &opt_ind);
    134134                switch (c) {
  • uspace/app/bdsh/cmds/modules/cp/cp.c

    rdcba819 r86cf96d  
    457457        argc = cli_count_args(argv);
    458458
    459         for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
     459        for (c = 0, optreset = 1, optind = 0, opt_ind = 0; c != -1;) {
    460460                c = getopt_long(argc, argv, "hvVfirb:", long_options, &opt_ind);
    461461                switch (c) {
  • uspace/app/bdsh/cmds/modules/ls/ls.c

    rdcba819 r86cf96d  
    362362        argc = cli_count_args(argv);
    363363       
    364         for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
     364        for (c = 0, optreset = 1, optind = 0, opt_ind = 0; c != -1;) {
    365365                c = getopt_long(argc, argv, "hur", long_options, &opt_ind);
    366366                switch (c) {
  • uspace/app/bdsh/cmds/modules/mkdir/mkdir.c

    rdcba819 r86cf96d  
    173173        argc = cli_count_args(argv);
    174174
    175         for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
     175        for (c = 0, optreset = 1, optind = 0, opt_ind = 0; c != -1;) {
    176176                c = getopt_long(argc, argv, "pvhVfm:", long_options, &opt_ind);
    177177                switch (c) {
  • uspace/app/bdsh/cmds/modules/mkfile/mkfile.c

    rdcba819 r86cf96d  
    126126        argc = cli_count_args(argv);
    127127
    128         for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
     128        for (c = 0, optreset = 1, optind = 0, opt_ind = 0; c != -1;) {
    129129                c = getopt_long(argc, argv, "ps:h", long_options, &opt_ind);
    130130                switch (c) {
  • uspace/app/bdsh/cmds/modules/mount/mount.c

    rdcba819 r86cf96d  
    117117        argc = cli_count_args(argv);
    118118
    119         for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
     119        for (c = 0, optreset = 1, optind = 0, opt_ind = 0; c != -1;) {
    120120                c = getopt_long(argc, argv, "i:h", long_options, &opt_ind);
    121121                switch (c) {
  • uspace/app/bdsh/cmds/modules/rm/rm.c

    rdcba819 r86cf96d  
    261261        }
    262262
    263         for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
     263        for (c = 0, optreset = 1, optind = 0, opt_ind = 0; c != -1;) {
    264264                c = getopt_long(argc, argv, "hvrfs", long_options, &opt_ind);
    265265                switch (c) {
  • uspace/app/bdsh/cmds/modules/touch/touch.c

    rdcba819 r86cf96d  
    9090        DIR *dirp;
    9191       
    92         for (c = 0, optind = 0, longind = 0; c != -1; ) {
     92        for (c = 0, optreset = 1, optind = 0, longind = 0; c != -1; ) {
    9393                c = getopt_long(argc, argv, "c", long_options, &longind);
    9494                switch (c) {
Note: See TracChangeset for help on using the changeset viewer.