OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * | 3 * |
4 * Copyright (C) 2003-2007, International Business Machines | 4 * Copyright (C) 2003-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: icuswap.cpp | 8 * file name: icuswap.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: 2003aug08 | 13 * created on: 2003aug08 |
14 * created by: Markus W. Scherer | 14 * created by: Markus W. Scherer |
(...skipping 19 matching lines...) Expand all Loading... |
34 #include "swapimpl.h" | 34 #include "swapimpl.h" |
35 #include "toolutil.h" | 35 #include "toolutil.h" |
36 #include "uoptions.h" | 36 #include "uoptions.h" |
37 | 37 |
38 #include <stdio.h> | 38 #include <stdio.h> |
39 #include <stdlib.h> | 39 #include <stdlib.h> |
40 #include <string.h> | 40 #include <string.h> |
41 | 41 |
42 /* definitions */ | 42 /* definitions */ |
43 | 43 |
44 #define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) | |
45 #define DEFAULT_PADDING_LENGTH 15 | 44 #define DEFAULT_PADDING_LENGTH 15 |
46 | 45 |
47 static UOption options[]={ | 46 static UOption options[]={ |
48 UOPTION_HELP_H, | 47 UOPTION_HELP_H, |
49 UOPTION_HELP_QUESTION_MARK, | 48 UOPTION_HELP_QUESTION_MARK, |
50 UOPTION_DEF("type", 't', UOPT_REQUIRES_ARG) | 49 UOPTION_DEF("type", 't', UOPT_REQUIRES_ARG) |
51 }; | 50 }; |
52 | 51 |
53 enum { | 52 enum { |
54 OPT_HELP_H, | 53 OPT_HELP_H, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 pname=strrchr(argv[0], U_FILE_SEP_CHAR); | 122 pname=strrchr(argv[0], U_FILE_SEP_CHAR); |
124 if(pname==NULL) { | 123 if(pname==NULL) { |
125 pname=strrchr(argv[0], '/'); | 124 pname=strrchr(argv[0], '/'); |
126 } | 125 } |
127 if(pname!=NULL) { | 126 if(pname!=NULL) { |
128 ++pname; | 127 ++pname; |
129 } else { | 128 } else { |
130 pname=argv[0]; | 129 pname=argv[0]; |
131 } | 130 } |
132 | 131 |
133 argc=u_parseArgs(argc, argv, LENGTHOF(options), options); | 132 argc=u_parseArgs(argc, argv, UPRV_LENGTHOF(options), options); |
134 ishelp=options[OPT_HELP_H].doesOccur || options[OPT_HELP_QUESTION_MARK].does
Occur; | 133 ishelp=options[OPT_HELP_H].doesOccur || options[OPT_HELP_QUESTION_MARK].does
Occur; |
135 if(ishelp || argc!=3) { | 134 if(ishelp || argc!=3) { |
136 return printUsage(pname, ishelp); | 135 return printUsage(pname, ishelp); |
137 } | 136 } |
138 | 137 |
139 /* parse the output type option */ | 138 /* parse the output type option */ |
140 data=(char *)options[OPT_OUT_TYPE].value; | 139 data=(char *)options[OPT_OUT_TYPE].value; |
141 if(data[0]==0 || data[1]!=0) { | 140 if(data[0]==0 || data[1]!=0) { |
142 /* the type must be exactly one letter */ | 141 /* the type must be exactly one letter */ |
143 return printUsage(pname, FALSE); | 142 return printUsage(pname, FALSE); |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 } | 638 } |
640 | 639 |
641 /* | 640 /* |
642 * Hey, Emacs, please set the following: | 641 * Hey, Emacs, please set the following: |
643 * | 642 * |
644 * Local Variables: | 643 * Local Variables: |
645 * indent-tabs-mode: nil | 644 * indent-tabs-mode: nil |
646 * End: | 645 * End: |
647 * | 646 * |
648 */ | 647 */ |
OLD | NEW |