Changeset 2105 for libswish3/trunk/src/swish_isw.c
- Timestamp:
- 03/28/08 23:04:21 (8 months ago)
- Files:
-
- libswish3/trunk/src/swish_isw.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
libswish3/trunk/src/swish_isw.c
r1913 r2105 17 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 18 */ 19 19 20 20 /* report on the isw* functions for any decimal character value. 21 21 * … … 35 35 #include <locale.h> 36 36 37 void report(char *locale, int n); 38 void usage(); 39 int main(int argc, char **argv); 37 void report( 38 char *locale, 39 int n 40 ); 41 void usage( 42 ); 43 int main( 44 int argc, 45 char **argv 46 ); 40 47 41 char *types[] = 42 { 48 char *types[] = { 43 49 "alnum", "cntrl", "ideogram", "print", "special", 44 50 "alpha", "digit", "lower", "punct", "upper", … … 46 52 }; 47 53 48 int ntypes = 15;54 int ntypes = 15; 49 55 50 56 int 51 main(int argc, char **argv) 57 main( 58 int argc, 59 char **argv 60 ) 52 61 { 53 int i, n;54 char *curlocale, *locale;62 int i, n; 63 char *curlocale, *locale; 55 64 56 65 if (argc == 1) 57 66 usage(); 58 59 67 60 68 locale = getenv("LC_ALL"); … … 62 70 setlocale(LC_ALL, locale); 63 71 curlocale = strdup(locale); 64 65 66 for (i = 1; i < argc; i++) 67 { 68 72 73 for (i = 1; i < argc; i++) { 74 69 75 if (!iswdigit(argv[i][0])) 70 err(1, "arg %s is not a positive integer\n", argv[i]);71 72 n = (int) strtol(argv[i], (char **)NULL, 10);76 err(1, "arg %s is not a positive integer\n", argv[i]); 77 78 n = (int)strtol(argv[i], (char **)NULL, 10); 73 79 74 80 report(curlocale, n); … … 79 85 } 80 86 81 void usage() 87 void 88 usage( 89 ) 82 90 { 83 91 printf("usage: swish_isw N\n\n"); … … 88 96 } 89 97 90 void 91 report(char *locale, int n) 98 void 99 report( 100 char *locale, 101 int n 102 ) 92 103 { 93 104 int j; 94 105 95 106 setlocale(LC_ALL, locale); 96 107 printf("locale: %s\n", setlocale(LC_ALL, NULL)); 97 108 98 109 printf("%lc %d \\x%04x\n", n, n, n); 99 100 for (j = 0; j < ntypes; j++) 101 { 110 111 for (j = 0; j < ntypes; j++) { 102 112 printf("%10s => %d\n", types[j], iswctype(n, wctype(types[j]))); 103 113 }
