OLD | NEW |
---|---|
1 // Copyright (c) 2006, Google Inc. | 1 // Copyright (c) 2006, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 } | 185 } |
186 | 186 |
187 //============================================================================= | 187 //============================================================================= |
188 static void | 188 static void |
189 SetupOptions(int argc, const char *argv[], Options *options) { | 189 SetupOptions(int argc, const char *argv[], Options *options) { |
190 extern int optind; | 190 extern int optind; |
191 int ch; | 191 int ch; |
192 | 192 |
193 while ((ch = getopt(argc, (char * const *)argv, "u:v:x:h?")) != -1) { | 193 while ((ch = getopt(argc, (char * const *)argv, "u:v:x:h?")) != -1) { |
194 switch (ch) { | 194 switch (ch) { |
195 case 'h': | |
196 case '?': | |
197 Usage(argc, argv); | |
198 exit(0); | |
199 break; | |
mmandlis
2015/06/22 16:51:59
nit - do you really need the "break;" after "exit(
ivanpe
2015/06/22 21:18:10
I think this is a good safely practice so I'm fine
| |
195 case 'u': | 200 case 'u': |
196 options->proxy_user_pwd = optarg; | 201 options->proxy_user_pwd = optarg; |
197 break; | 202 break; |
198 case 'v': | 203 case 'v': |
199 options->version = optarg; | 204 options->version = optarg; |
200 break; | 205 break; |
201 case 'x': | 206 case 'x': |
202 options->proxy = optarg; | 207 options->proxy = optarg; |
203 break; | 208 break; |
204 | 209 |
(...skipping 15 matching lines...) Expand all Loading... | |
220 options->uploadURLStr = argv[optind + 1]; | 225 options->uploadURLStr = argv[optind + 1]; |
221 } | 226 } |
222 | 227 |
223 //============================================================================= | 228 //============================================================================= |
224 int main(int argc, const char* argv[]) { | 229 int main(int argc, const char* argv[]) { |
225 Options options; | 230 Options options; |
226 SetupOptions(argc, argv, &options); | 231 SetupOptions(argc, argv, &options); |
227 Start(&options); | 232 Start(&options); |
228 return options.success ? 0 : 1; | 233 return options.success ? 0 : 1; |
229 } | 234 } |
OLD | NEW |