Subversion Repositories HelenOS

Rev

Rev 3403 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3403 Rev 4348
Line 239... Line 239...
239
            place++;
239
            place++;
240
            return -2;
240
            return -2;
241
        }
241
        }
242
    }
242
    }
243
    if ((optchar = (int)*place++) == (int)':' ||
243
    if ((optchar = (int)*place++) == (int)':' ||
244
        (oli = strchr(options + (IGNORE_FIRST ? 1 : 0), optchar)) == NULL) {
244
        (oli = str_chr(options + (IGNORE_FIRST ? 1 : 0), optchar)) == NULL) {
245
        /* option letter unknown or ':' */
245
        /* option letter unknown or ':' */
246
        if (!*place)
246
        if (!*place)
247
            ++optind;
247
            ++optind;
248
        if (PRINT_ERROR)
248
        if (PRINT_ERROR)
249
            printf(illoptchar, optchar);
249
            printf(illoptchar, optchar);
Line 375... Line 375...
375
                optind -= nonopt_end - nonopt_start;
375
                optind -= nonopt_end - nonopt_start;
376
            }
376
            }
377
            nonopt_start = nonopt_end = -1;
377
            nonopt_start = nonopt_end = -1;
378
            return -1;
378
            return -1;
379
        }
379
        }
380
        if ((has_equal = strchr(current_argv, '=')) != NULL) {
380
        if ((has_equal = str_chr(current_argv, '=')) != NULL) {
381
            /* argument found (--option=arg) */
381
            /* argument found (--option=arg) */
382
            current_argv_len = has_equal - current_argv;
382
            current_argv_len = has_equal - current_argv;
383
            has_equal++;
383
            has_equal++;
384
        } else
384
        } else
385
            current_argv_len = strlen(current_argv);
385
            current_argv_len = str_size(current_argv);
386
       
386
       
387
        for (i = 0; long_options[i].name; i++) {
387
        for (i = 0; long_options[i].name; i++) {
388
            /* find matching long option */
388
            /* find matching long option */
389
            if (strncmp(current_argv, long_options[i].name,
389
            if (str_lcmp(current_argv, long_options[i].name,
390
                current_argv_len))
390
                str_nlength(current_argv, current_argv_len)))
391
                continue;
391
                continue;
392
 
392
 
393
            if (strlen(long_options[i].name) ==
393
            if (str_size(long_options[i].name) ==
394
                (unsigned)current_argv_len) {
394
                (unsigned)current_argv_len) {
395
                /* exact match */
395
                /* exact match */
396
                match = i;
396
                match = i;
397
                ambiguous = 0;
397
                ambiguous = 0;
398
                break;
398
                break;