Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: source/tools/toolutil/uoptions.c

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/tools/toolutil/udbgutil.cpp ('k') | source/tools/tzcode/icuregions » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ******************************************************************************* 2 *******************************************************************************
3 * 3 *
4 * Copyright (C) 2000, International Business Machines 4 * Copyright (C) 2000-2015, International Business Machines
5 * Corporation and others. All Rights Reserved. 5 * Corporation and others. All Rights Reserved.
6 * 6 *
7 ******************************************************************************* 7 *******************************************************************************
8 * file name: uoptions.c 8 * file name: uoptions.c
9 * encoding: US-ASCII 9 * encoding: US-ASCII
10 * tab size: 8 (not used) 10 * tab size: 8 (not used)
11 * indentation:4 11 * indentation:4
12 * 12 *
13 * created on: 2000apr17 13 * created on: 2000apr17
14 * created by: Markus W. Scherer 14 * created by: Markus W. Scherer
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 option->doesOccur=1; 54 option->doesOccur=1;
55 55
56 if(option->hasArg!=UOPT_NO_ARG) { 56 if(option->hasArg!=UOPT_NO_ARG) {
57 /* parse the argument for the option, if any */ 57 /* parse the argument for the option, if any */
58 if(i+1<argc && !(argv[i+1][0]=='-' && argv[i+1][1]!=0)) { 58 if(i+1<argc && !(argv[i+1][0]=='-' && argv[i+1][1]!=0)) {
59 /* argument in the next argv[], and there is not an option in there */ 59 /* argument in the next argv[], and there is not an option in there */
60 option->value=argv[++i]; 60 option->value=argv[++i];
61 } else if(option->hasArg==UOPT_REQUIRES_ARG) { 61 } else if(option->hasArg==UOPT_REQUIRES_ARG) {
62 /* there is no argument, but one is required: return with error */ 62 /* there is no argument, but one is required: return with error */
63 option->doesOccur=0;
63 return -i; 64 return -i;
64 } 65 }
65 } 66 }
67
68 if(option->optionFn!=NULL && option->optionFn(option->contex t, option)<0) {
69 /* the option function was called and returned an error */
70 option->doesOccur=0;
71 return -i;
72 }
66 } 73 }
67 } else { 74 } else {
68 /* process one or more short options */ 75 /* process one or more short options */
69 do { 76 do {
70 /* search for the option letter */ 77 /* search for the option letter */
71 int j; 78 int j;
72 for(j=0; j<optionCount; ++j) { 79 for(j=0; j<optionCount; ++j) {
73 if(c==options[j].shortName) { 80 if(c==options[j].shortName) {
74 option=options+j; 81 option=options+j;
75 break; 82 break;
(...skipping 12 matching lines...) Expand all
88 option->value=arg; 95 option->value=arg;
89 /* do not process the rest of this arg as option let ters */ 96 /* do not process the rest of this arg as option let ters */
90 break; 97 break;
91 } else if(i+1<argc && !(argv[i+1][0]=='-' && argv[i+1][1 ]!=0)) { 98 } else if(i+1<argc && !(argv[i+1][0]=='-' && argv[i+1][1 ]!=0)) {
92 /* argument in the next argv[], and there is not an option in there */ 99 /* argument in the next argv[], and there is not an option in there */
93 option->value=argv[++i]; 100 option->value=argv[++i];
94 /* this break is redundant because we know that *arg ==0 */ 101 /* this break is redundant because we know that *arg ==0 */
95 break; 102 break;
96 } else if(option->hasArg==UOPT_REQUIRES_ARG) { 103 } else if(option->hasArg==UOPT_REQUIRES_ARG) {
97 /* there is no argument, but one is required: return with error */ 104 /* there is no argument, but one is required: return with error */
105 option->doesOccur=0;
98 return -i; 106 return -i;
99 } 107 }
100 } 108 }
101 109
110 if(option->optionFn!=NULL && option->optionFn(option->contex t, option)<0) {
111 /* the option function was called and returned an error */
112 option->doesOccur=0;
113 return -i;
114 }
115
102 /* get the next option letter */ 116 /* get the next option letter */
103 option=NULL; 117 option=NULL;
104 c=*arg++; 118 c=*arg++;
105 } while(c!=0); 119 } while(c!=0);
106 } 120 }
107 121
108 if(option!=0 && option->optionFn!=0 && option->optionFn(option->cont ext, option)<0) {
109 /* the option function was called and returned an error */
110 return -i;
111 }
112
113 /* go to next argv[] */ 122 /* go to next argv[] */
114 ++i; 123 ++i;
115 } else { 124 } else {
116 /* move a non-option up in argv[] */ 125 /* move a non-option up in argv[] */
117 argv[remaining++]=arg; 126 argv[remaining++]=arg;
118 ++i; 127 ++i;
119 } 128 }
120 } 129 }
121 return remaining; 130 return remaining;
122 } 131 }
OLDNEW
« no previous file with comments | « source/tools/toolutil/udbgutil.cpp ('k') | source/tools/tzcode/icuregions » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698