POSIX.1 National Language Support API for MinGW
リビジョン | 8ddd2a7ab587778affbd47ceb292b35c0db9f442 (tree) |
---|---|
日時 | 2008-01-10 06:55:55 |
作者 | Keith Marshall <keithmarshall@user...> |
コミッター | Keith Marshall |
Support /dev/stdin' and '/dev/stdout', specified as command line arguments, as case-insensitive aliases for -', representing the standard input and standard output streams respectively.
@@ -1,3 +1,15 @@ | ||
1 | +2008-01-09 Keith Marshall <keithmarshall@users.sourceforge.net> | |
2 | + | |
3 | + Support `/dev/stdin' and '/dev/stdout', specified as command line | |
4 | + arguments, as case-insensitive aliases for `-', representing the | |
5 | + standard input and standard output streams respectively. | |
6 | + | |
7 | + * gencat.c (msgcat): Assign from first non-option command line | |
8 | + argument; replace with "-", if strcasecmp matches "/dev/stdout". | |
9 | + | |
10 | + * mcsource.c (input): Use strcasecmp instead of strcmp, to check for | |
11 | + match to "/dev/stdin". | |
12 | + | |
1 | 13 | 2008-01-08 Keith Marshall <keithmarshall@users.sourceforge.net> |
2 | 14 | |
3 | 15 | Add `-help' and `-version' options for `gencat'. |
@@ -182,10 +182,16 @@ int main( int argc, char **argv ) | ||
182 | 182 | |
183 | 183 | if( (argc -= optind) > 1 ) |
184 | 184 | { |
185 | + /* Establish the message catalogue name, recognising `/dev/stdout' | |
186 | + * as an alias for `-', representing the standard output stream. | |
187 | + */ | |
188 | + if( strcasecmp( (msgcat = *(argv += optind)), "/dev/stdout" ) == 0 ) | |
189 | + msgcat = "-"; | |
190 | + | |
185 | 191 | /* Initialise the message list, to incorporate any messages which |
186 | 192 | * are already contained within the specified message catalogue. |
187 | 193 | */ |
188 | - if( (cat = mc_load( msgcat = *(argv += optind) )) == NULL ) | |
194 | + if( (cat = mc_load( msgcat )) == NULL ) | |
189 | 195 | switch( errno ) |
190 | 196 | { |
191 | 197 | case ENOENT: |
@@ -382,4 +388,4 @@ int main( int argc, char **argv ) | ||
382 | 388 | return EXIT_SUCCESS; |
383 | 389 | } |
384 | 390 | |
385 | -/* $RCSfile$Revision: 1.2 $: end of file */ | |
391 | +/* $RCSfile$Revision: 1.3 $: end of file */ |
@@ -3,13 +3,13 @@ | ||
3 | 3 | * |
4 | 4 | * $Id$ |
5 | 5 | * |
6 | - * Copyright (C) 2006, 2007, Keith Marshall | |
6 | + * Copyright (C) 2006, 2007, 2008, Keith Marshall | |
7 | 7 | * |
8 | 8 | * This file implements the message catalogue source code parser, which is |
9 | 9 | * used internally by `gencat', to compile message dictionaries. |
10 | 10 | * |
11 | 11 | * Written by Keith Marshall <keithmarshall@users.sourceforge.net> |
12 | - * Last modification: 22-Sept-2007 | |
12 | + * Last modification: 08-Jan-2008 | |
13 | 13 | * |
14 | 14 | * |
15 | 15 | * This is free software. It is provided AS IS, in the hope that it may |
@@ -289,7 +289,7 @@ struct msgdict *mc_source( const char *input ) | ||
289 | 289 | /* Get a file descriptor for the input stream ... |
290 | 290 | */ |
291 | 291 | const char *dev_stdin = "/dev/stdin"; |
292 | - if( (strcmp( input, "-") == 0) || (strcmp( input, dev_stdin ) == 0) ) | |
292 | + if( (strcmp( input, "-") == 0) || (strcasecmp( input, dev_stdin ) == 0) ) | |
293 | 293 | { |
294 | 294 | /* ... reading from standard input ... |
295 | 295 | */ |
@@ -1265,4 +1265,4 @@ struct msgdict *mc_source( const char *input ) | ||
1265 | 1265 | return head; |
1266 | 1266 | } |
1267 | 1267 | |
1268 | -/* $RCSfile$Revision: 1.11 $: end of file */ | |
1268 | +/* $RCSfile$Revision: 1.12 $: end of file */ |