Changeset cfc3027 in mainline


Ignore:
Timestamp:
2011-04-01T14:23:08Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bdbb6f6
Parents:
2859445
Message:

Fix handling of options.

File:
1 edited

Legend:

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

    r2859445 rcfc3027  
    5757/** Structure to represent a directory entry.
    5858 *
    59  * Useful to keep together important informations
     59 * Useful to keep together important information
    6060 * for sorting directory entries.
    6161 */
     
    6969static struct option const long_options[] = {
    7070        { "help", no_argument, 0, 'h' },
    71         { "unsort", no_argument, 0, 'u' },     
     71        { "unsort", no_argument, 0, 'u' },
    7272        { 0, 0, 0, 0 }
    7373};
     
    246246        }
    247247       
    248         int dir = (int) argc > optind ? (int) argc - 1 : optind - 1;
    249         argc -= (optind - 1);
     248        argc -= optind;
    250249       
    251250        de.name = (char *) malloc(PATH_MAX);
     
    256255        memset(de.name, 0, sizeof(PATH_MAX));
    257256       
    258         if (argc == 1)
     257        if (argc == 0)
    259258                getcwd(de.name, PATH_MAX);
    260259        else
    261                 str_cpy(de.name, PATH_MAX, argv[dir]);
     260                str_cpy(de.name, PATH_MAX, argv[optind]);
    262261       
    263262        if (stat(de.name, &de.s)) {
Note: See TracChangeset for help on using the changeset viewer.