OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * | 3 * |
4 * Copyright (C) 2005-2013, International Business Machines | 4 * Copyright (C) 2005-2014, International Business Machines |
5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
6 * | 6 * |
7 ******************************************************************************* | 7 ******************************************************************************* |
8 * file name: icupkg.cpp | 8 * file name: icupkg.cpp |
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: 2005jul29 | 13 * created on: 2005jul29 |
14 * created by: Markus W. Scherer | 14 * created by: Markus W. Scherer |
(...skipping 25 matching lines...) Expand all Loading... |
40 #include <stdio.h> | 40 #include <stdio.h> |
41 #include <stdlib.h> | 41 #include <stdlib.h> |
42 #include <string.h> | 42 #include <string.h> |
43 | 43 |
44 U_NAMESPACE_USE | 44 U_NAMESPACE_USE |
45 | 45 |
46 // TODO: add --matchmode=regex for using the ICU regex engine for item name patt
ern matching? | 46 // TODO: add --matchmode=regex for using the ICU regex engine for item name patt
ern matching? |
47 | 47 |
48 // general definitions ----------------------------------------------------- *** | 48 // general definitions ----------------------------------------------------- *** |
49 | 49 |
50 #define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) | |
51 | |
52 // main() ------------------------------------------------------------------ *** | 50 // main() ------------------------------------------------------------------ *** |
53 | 51 |
54 static void | 52 static void |
55 printUsage(const char *pname, UBool isHelp) { | 53 printUsage(const char *pname, UBool isHelp) { |
56 FILE *where=isHelp ? stdout : stderr; | 54 FILE *where=isHelp ? stdout : stderr; |
57 | 55 |
58 fprintf(where, | 56 fprintf(where, |
59 "%csage: %s [-h|-?|--help ] [-tl|-tb|-te] [-c] [-C comment]\n" | 57 "%csage: %s [-h|-?|--help ] [-tl|-tb|-te] [-c] [-C comment]\n" |
60 "\t[-a list] [-r list] [-x list] [-l [-o outputListFileName]]\n" | 58 "\t[-a list] [-r list] [-x list] [-l [-o outputListFileName]]\n" |
61 "\t[-s path] [-d path] [-w] [-m mode]\n" | 59 "\t[-s path] [-d path] [-w] [-m mode]\n" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 UBool isHelp, isModified, isPackage; | 257 UBool isHelp, isModified, isPackage; |
260 int result = 0; | 258 int result = 0; |
261 | 259 |
262 Package *pkg, *listPkg, *addListPkg; | 260 Package *pkg, *listPkg, *addListPkg; |
263 | 261 |
264 U_MAIN_INIT_ARGS(argc, argv); | 262 U_MAIN_INIT_ARGS(argc, argv); |
265 | 263 |
266 /* get the program basename */ | 264 /* get the program basename */ |
267 pname=findBasename(argv[0]); | 265 pname=findBasename(argv[0]); |
268 | 266 |
269 argc=u_parseArgs(argc, argv, LENGTHOF(options), options); | 267 argc=u_parseArgs(argc, argv, UPRV_LENGTHOF(options), options); |
270 isHelp=options[OPT_HELP_H].doesOccur || options[OPT_HELP_QUESTION_MARK].does
Occur; | 268 isHelp=options[OPT_HELP_H].doesOccur || options[OPT_HELP_QUESTION_MARK].does
Occur; |
271 if(isHelp) { | 269 if(isHelp) { |
272 printUsage(pname, TRUE); | 270 printUsage(pname, TRUE); |
273 return U_ZERO_ERROR; | 271 return U_ZERO_ERROR; |
274 } | 272 } |
275 | 273 |
276 pkg=new Package; | 274 pkg=new Package; |
277 if(pkg==NULL) { | 275 if(pkg==NULL) { |
278 fprintf(stderr, "icupkg: not enough memory\n"); | 276 fprintf(stderr, "icupkg: not enough memory\n"); |
279 return U_MEMORY_ALLOCATION_ERROR; | 277 return U_MEMORY_ALLOCATION_ERROR; |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 } | 543 } |
546 | 544 |
547 /* | 545 /* |
548 * Hey, Emacs, please set the following: | 546 * Hey, Emacs, please set the following: |
549 * | 547 * |
550 * Local Variables: | 548 * Local Variables: |
551 * indent-tabs-mode: nil | 549 * indent-tabs-mode: nil |
552 * End: | 550 * End: |
553 * | 551 * |
554 */ | 552 */ |
OLD | NEW |