summaryrefslogtreecommitdiff
path: root/setup_native/source
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2005-01-21 10:35:34 +0000
committerKurt Zenker <kz@openoffice.org>2005-01-21 10:35:34 +0000
commit8aa7eddd317f6702651bc727d0c30eef72d8060a (patch)
tree07926c9958278db2cf5a63892d8ad36adf1b8acf /setup_native/source
parent3bc3dad956f56f1ed3c9732faaeaeb770e474eeb (diff)
INTEGRATION: CWS sysui03 (1.3.8); FILE MERGED
2005/01/10 11:50:10 obr 1.3.8.1: #i38980# don't create output file for non-existing input
Diffstat (limited to 'setup_native/source')
-rw-r--r--setup_native/source/ulfconv/ulfconv.cxx26
1 files changed, 17 insertions, 9 deletions
diff --git a/setup_native/source/ulfconv/ulfconv.cxx b/setup_native/source/ulfconv/ulfconv.cxx
index 3f1646330a82..7ea9b0977580 100644
--- a/setup_native/source/ulfconv/ulfconv.cxx
+++ b/setup_native/source/ulfconv/ulfconv.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ulfconv.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: obo $ $Date: 2004-11-18 08:21:15 $
+ * last change: $Author: kz $ $Date: 2005-01-21 11:35:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -289,6 +289,8 @@ int main( int argc, char * const argv[] )
FILE *istream = stdin;
FILE *ostream = stdout;
+ char *outfile = NULL;
+
int errflg = 0;
int argi;
@@ -306,11 +308,7 @@ int main( int argc, char * const argv[] )
}
++argi;
- ostream = fopen(argv[argi], "w");
- if ( ostream == NULL ) {
- fprintf(stderr, "ulfconv: %s : %s\n", argv[argi], strerror(errno));
- exit(2);
- }
+ outfile = argv[argi];
break;
case 't':
if (argi+1 >= argc || argv[argi+1][0] == '-')
@@ -339,8 +337,8 @@ int main( int argc, char * const argv[] )
}
/* assign input file to stdin */
- if ( argi < argc ) {
-
+ if ( argi < argc )
+ {
istream = fopen(argv[argi], "r");
if ( istream == NULL ) {
fprintf(stderr, "ulfconv: %s : %s\n", argv[argi], strerror(errno));
@@ -348,6 +346,16 @@ int main( int argc, char * const argv[] )
}
}
+ /* open output file if any */
+ if ( outfile )
+ {
+ ostream = fopen(outfile, "w");
+ if ( ostream == NULL ) {
+ fprintf(stderr, "ulfconv: %s : %s\n", argv[argi], strerror(errno));
+ exit(2);
+ }
+ }
+
/* read line by line from stdin */
char buffer[65536];
while ( NULL != fgets(buffer, sizeof(buffer), istream) ) {