• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得cocoawindowspythonrubyphpgameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdombtronvb.netdirectxarduinopreviewerゲームエンジン

POSIX.1 National Language Support API for MinGW


Commit MetaInfo

修訂8ddd2a7ab587778affbd47ceb292b35c0db9f442 (tree)
時間2008-01-10 06:55:55
作者Keith Marshall <keithmarshall@user...>
CommiterKeith Marshall

Log Message

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.

Change Summary

差異

--- a/ChangeLog
+++ b/ChangeLog
@@ -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+
113 2008-01-08 Keith Marshall <keithmarshall@users.sourceforge.net>
214
315 Add `-help' and `-version' options for `gencat'.
--- a/gencat.c
+++ b/gencat.c
@@ -182,10 +182,16 @@ int main( int argc, char **argv )
182182
183183 if( (argc -= optind) > 1 )
184184 {
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+
185191 /* Initialise the message list, to incorporate any messages which
186192 * are already contained within the specified message catalogue.
187193 */
188- if( (cat = mc_load( msgcat = *(argv += optind) )) == NULL )
194+ if( (cat = mc_load( msgcat )) == NULL )
189195 switch( errno )
190196 {
191197 case ENOENT:
@@ -382,4 +388,4 @@ int main( int argc, char **argv )
382388 return EXIT_SUCCESS;
383389 }
384390
385-/* $RCSfile$Revision: 1.2 $: end of file */
391+/* $RCSfile$Revision: 1.3 $: end of file */
--- a/mcsource.c
+++ b/mcsource.c
@@ -3,13 +3,13 @@
33 *
44 * $Id$
55 *
6- * Copyright (C) 2006, 2007, Keith Marshall
6+ * Copyright (C) 2006, 2007, 2008, Keith Marshall
77 *
88 * This file implements the message catalogue source code parser, which is
99 * used internally by `gencat', to compile message dictionaries.
1010 *
1111 * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
12- * Last modification: 22-Sept-2007
12+ * Last modification: 08-Jan-2008
1313 *
1414 *
1515 * 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 )
289289 /* Get a file descriptor for the input stream ...
290290 */
291291 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) )
293293 {
294294 /* ... reading from standard input ...
295295 */
@@ -1265,4 +1265,4 @@ struct msgdict *mc_source( const char *input )
12651265 return head;
12661266 }
12671267
1268-/* $RCSfile$Revision: 1.11 $: end of file */
1268+/* $RCSfile$Revision: 1.12 $: end of file */