Fossil SCM
Minor skintxt2config cleanups.
Commit
324154e8214cd4f23f48b7eae921e6b1ba00658b7f319fbedf477edb34031968
Parent
b3d51b9706c5b5e…
1 file changed
+3
-5
+3
-5
| --- tools/skintxt2config.c | ||
| +++ tools/skintxt2config.c | ||
| @@ -35,11 +35,10 @@ | ||
| 35 | 35 | time_t now; |
| 36 | 36 | FILE * ostr; |
| 37 | 37 | } App = { |
| 38 | 38 | 0, 0, 0 |
| 39 | 39 | }; |
| 40 | -enum { F_CSS = 1, F_HEADER = 2, F_FOOTER = 3, F_DETAILS = 4}; | |
| 41 | 40 | |
| 42 | 41 | static void err(const char *zFmt, ...){ |
| 43 | 42 | va_list vargs; |
| 44 | 43 | va_start(vargs, zFmt); |
| 45 | 44 | fputs("ERROR: ",stderr); |
| @@ -185,18 +184,17 @@ | ||
| 185 | 184 | err("Missing filename for -o flag"); |
| 186 | 185 | rc = 1; |
| 187 | 186 | break; |
| 188 | 187 | }else{ |
| 189 | 188 | const char *zOut = argv[i]; |
| 190 | - FILE * o; | |
| 191 | 189 | if(App.ostr != stdout){ |
| 192 | 190 | err("Cannot specify -o more than once."); |
| 193 | 191 | rc = 1; |
| 194 | 192 | break; |
| 195 | 193 | } |
| 196 | - if(0!=strcmp("-",argv[i])){ | |
| 197 | - o = fopen(zOut, "wb"); | |
| 194 | + if(0!=strcmp("-",zOut)){ | |
| 195 | + FILE * o = fopen(zOut, "wb"); | |
| 198 | 196 | if(!o){ |
| 199 | 197 | err("Could not open file %s for writing. Errno=%d", |
| 200 | 198 | zOut, errno); |
| 201 | 199 | rc = errno; |
| 202 | 200 | break; |
| @@ -203,11 +201,11 @@ | ||
| 203 | 201 | } |
| 204 | 202 | App.ostr = o; |
| 205 | 203 | } |
| 206 | 204 | } |
| 207 | 205 | }else if('-' == zArg[0]){ |
| 208 | - fprintf(stderr, "Unhandled argument: %s\n", zArg); | |
| 206 | + err("Unhandled argument: %s", zArg); | |
| 209 | 207 | rc = 1; |
| 210 | 208 | break; |
| 211 | 209 | }else{ |
| 212 | 210 | rc = dispatch_file(zArg); |
| 213 | 211 | if(rc) break; |
| 214 | 212 |
| --- tools/skintxt2config.c | |
| +++ tools/skintxt2config.c | |
| @@ -35,11 +35,10 @@ | |
| 35 | time_t now; |
| 36 | FILE * ostr; |
| 37 | } App = { |
| 38 | 0, 0, 0 |
| 39 | }; |
| 40 | enum { F_CSS = 1, F_HEADER = 2, F_FOOTER = 3, F_DETAILS = 4}; |
| 41 | |
| 42 | static void err(const char *zFmt, ...){ |
| 43 | va_list vargs; |
| 44 | va_start(vargs, zFmt); |
| 45 | fputs("ERROR: ",stderr); |
| @@ -185,18 +184,17 @@ | |
| 185 | err("Missing filename for -o flag"); |
| 186 | rc = 1; |
| 187 | break; |
| 188 | }else{ |
| 189 | const char *zOut = argv[i]; |
| 190 | FILE * o; |
| 191 | if(App.ostr != stdout){ |
| 192 | err("Cannot specify -o more than once."); |
| 193 | rc = 1; |
| 194 | break; |
| 195 | } |
| 196 | if(0!=strcmp("-",argv[i])){ |
| 197 | o = fopen(zOut, "wb"); |
| 198 | if(!o){ |
| 199 | err("Could not open file %s for writing. Errno=%d", |
| 200 | zOut, errno); |
| 201 | rc = errno; |
| 202 | break; |
| @@ -203,11 +201,11 @@ | |
| 203 | } |
| 204 | App.ostr = o; |
| 205 | } |
| 206 | } |
| 207 | }else if('-' == zArg[0]){ |
| 208 | fprintf(stderr, "Unhandled argument: %s\n", zArg); |
| 209 | rc = 1; |
| 210 | break; |
| 211 | }else{ |
| 212 | rc = dispatch_file(zArg); |
| 213 | if(rc) break; |
| 214 |
| --- tools/skintxt2config.c | |
| +++ tools/skintxt2config.c | |
| @@ -35,11 +35,10 @@ | |
| 35 | time_t now; |
| 36 | FILE * ostr; |
| 37 | } App = { |
| 38 | 0, 0, 0 |
| 39 | }; |
| 40 | |
| 41 | static void err(const char *zFmt, ...){ |
| 42 | va_list vargs; |
| 43 | va_start(vargs, zFmt); |
| 44 | fputs("ERROR: ",stderr); |
| @@ -185,18 +184,17 @@ | |
| 184 | err("Missing filename for -o flag"); |
| 185 | rc = 1; |
| 186 | break; |
| 187 | }else{ |
| 188 | const char *zOut = argv[i]; |
| 189 | if(App.ostr != stdout){ |
| 190 | err("Cannot specify -o more than once."); |
| 191 | rc = 1; |
| 192 | break; |
| 193 | } |
| 194 | if(0!=strcmp("-",zOut)){ |
| 195 | FILE * o = fopen(zOut, "wb"); |
| 196 | if(!o){ |
| 197 | err("Could not open file %s for writing. Errno=%d", |
| 198 | zOut, errno); |
| 199 | rc = errno; |
| 200 | break; |
| @@ -203,11 +201,11 @@ | |
| 201 | } |
| 202 | App.ostr = o; |
| 203 | } |
| 204 | } |
| 205 | }else if('-' == zArg[0]){ |
| 206 | err("Unhandled argument: %s", zArg); |
| 207 | rc = 1; |
| 208 | break; |
| 209 | }else{ |
| 210 | rc = dispatch_file(zArg); |
| 211 | if(rc) break; |
| 212 |