Changeset 3bacee1 in mainline for uspace/lib/c/generic/getopt.c


Ignore:
Timestamp:
2018-04-12T16:27:17Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3cf22f9
Parents:
76d0981d
git-author:
Jiri Svoboda <jiri@…> (2018-04-11 19:25:33)
git-committer:
Jiri Svoboda <jiri@…> (2018-04-12 16:27:17)
Message:

Make ccheck-fix again and commit more good files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/getopt.c

    r76d0981d r3bacee1  
    132132
    133133        for (i = 0; i < ncycle; i++) {
    134                 cstart = panonopt_end+i;
     134                cstart = panonopt_end + i;
    135135                pos = cstart;
    136136                for (j = 0; j < cyclelen; j++) {
     
    181181                                    optind, nargv);
    182182                                optind -= nonopt_end - nonopt_start;
    183                         }
    184                         else if (nonopt_start != -1) {
     183                        } else if (nonopt_start != -1) {
    185184                                /*
    186185                                 * If we skipped non-options, set optind
     
    192191                        return -1;
    193192                }
    194                 if ((*(place = nargv[optind]) != '-')
    195                     || (place[1] == '\0')) {    /* found non-option */
     193                if ((*(place = nargv[optind]) != '-') ||
     194                    (place[1] == '\0')) {    /* found non-option */
    196195                        place = EMSG;
    197196                        if (IN_ORDER) {
     
    289288 *      Parse argc/argv argument vector.
    290289 */
    291 int getopt(int nargc, char * const *nargv, const char *options)
     290int getopt(int nargc, char *const *nargv, const char *options)
    292291{
    293292        int retval;
     
    305304                if (nonopt_end != -1) {
    306305                        permute_args(nonopt_start, nonopt_end, optind,
    307                                        (char **)nargv);
     306                            (char **)nargv);
    308307                        optind -= nonopt_end - nonopt_start;
    309308                }
     
    318317 *      Parse argc/argv argument vector.
    319318 */
    320 int getopt_long(int nargc, char * const *nargv, const char *options,
     319int getopt_long(int nargc, char *const *nargv, const char *options,
    321320    const struct option *long_options, int *idx)
    322321{
     
    389388                        if (PRINT_ERROR)
    390389                                printf(ambig, (int)current_argv_len,
    391                                      current_argv);
     390                                    current_argv);
    392391                        optopt = 0;
    393392                        return BADCH;
    394393                }
    395394                if (match != -1) {                      /* option found */
    396                         if (long_options[match].has_arg == no_argument
    397                             && has_equal) {
     395                        if (long_options[match].has_arg == no_argument &&
     396                            has_equal) {
    398397                                if (PRINT_ERROR)
    399398                                        printf(noarg, (int)current_argv_len,
    400                                              current_argv);
     399                                            current_argv);
    401400                                /*
    402401                                 * XXX: GNU sets optopt to val regardless of
     
    422421                                }
    423422                        }
    424                         if ((long_options[match].has_arg == required_argument)
    425                             && (optarg == NULL)) {
     423                        if ((long_options[match].has_arg == required_argument) &&
     424                            (optarg == NULL)) {
    426425                                /*
    427426                                 * Missing argument; leading ':'
Note: See TracChangeset for help on using the changeset viewer.