- Timestamp:
- Dec 1, 2007 10:35:55 PM (17 years ago)
- Location:
- trunk/src/sed/sed
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sed/sed/compile.c
r599 r1301 405 405 /* std* sometimes are not constants, so they 406 406 cannot be used in the initializer for special_files */ 407 #ifndef CONFIG_WITHOUT_O_OPT 408 my_stdin = stdin; my_stdout = sed_stdout; my_stderr = stderr; 409 #else 407 410 my_stdin = stdin; my_stdout = stdout; my_stderr = stderr; 411 #endif 408 412 for (special = special_files; special->outf.name; special++) 409 413 if (strcmp(special->outf.name, file_name) == 0) -
trunk/src/sed/sed/execute.c
r599 r1301 504 504 FILE *fp; 505 505 { 506 #ifndef CONFIG_WITHOUT_O_OPT 507 if (fp != sed_stdout || unbuffered_output) 508 #else 506 509 if (fp != stdout || unbuffered_output) 510 #endif 507 511 ck_fflush(fp); 508 512 } … … 699 703 } 700 704 else 705 #ifndef CONFIG_WITHOUT_O_OPT 706 output_file.fp = sed_stdout; 707 #else 701 708 output_file.fp = stdout; 709 #endif 702 710 } 703 711 -
trunk/src/sed/sed/sed.c
r1188 r1301 61 61 62 62 int extended_regexp_flags = 0; 63 64 #ifndef CONFIG_WITHOUT_O_OPT 65 /* The output file, defaults to stdout but can be overridden 66 by the -o or --output option. main sets this to avoid problems. */ 67 FILE *sed_stdout = NULL; 68 #endif 63 69 64 70 /* If set, fflush(stdout) on every line output. */ … … 112 118 fprintf(out, _(" --posix\n\ 113 119 disable all GNU extensions.\n")); 120 #ifndef CONFIG_WITHOUT_O_OPT 121 fprintf(out, _(" -o, --output=file, --output-text=file, --output-binary=file\n\ 122 use the specified file instead of stdout; the first two uses\n\ 123 uses the default text/binary mode.\n")); 124 #endif 114 125 fprintf(out, _(" -r, --regexp-extended\n\ 115 126 use extended regular expressions in the script.\n")); … … 143 154 { 144 155 #ifdef REG_PERL 156 # ifndef CONFIG_WITHOUT_O_OPT 157 #define SHORTOPTS "snrRue:f:l:i::o:V:" 158 # else 145 159 #define SHORTOPTS "snrRue:f:l:i::V:" 146 #else 160 # endif 161 #else 162 # ifndef CONFIG_WITHOUT_O_OPT 163 #define SHORTOPTS "snrue:f:l:i::o:V:" 164 # else 147 165 #define SHORTOPTS "snrue:f:l:i::V:" 166 # endif 148 167 #endif 149 168 … … 162 181 {"separate", 0, NULL, 's'}, 163 182 {"unbuffered", 0, NULL, 'u'}, 183 #ifndef CONFIG_WITHOUT_O_OPT 184 {"output", 1, NULL, 'o'}, 185 {"output-binary", 1, NULL, 300}, 186 {"output-text", 1, NULL, 301}, 187 #endif 164 188 {"version", 0, NULL, 'v'}, 165 189 {"help", 0, NULL, 'h'}, … … 172 196 173 197 initialize_main (&argc, &argv); 198 #ifndef CONFIG_WITHOUT_O_OPT 199 sed_stdout = stdout; 200 #endif 174 201 #if HAVE_SETLOCALE 175 202 /* Set locale according to user's wishes. */ … … 259 286 break; 260 287 288 #ifndef CONFIG_WITHOUT_O_OPT 289 case 'o': 290 sed_stdout = ck_fopen (optarg, "w", true /* fail on error */); 291 break; 292 293 case 300: 294 sed_stdout = ck_fopen (optarg, "wb", true /* fail on error */); 295 break; 296 297 case 301: 298 sed_stdout = ck_fopen (optarg, "wt", true /* fail on error */); 299 break; 300 #endif 301 261 302 case 'p': 262 303 posixicity = POSIXLY_BASIC; -
trunk/src/sed/sed/sed.h
r599 r1301 212 212 extern int extended_regexp_flags; 213 213 214 #ifndef CONFIG_WITHOUT_O_OPT 215 /* The output file, defaults to stdout but can be overridden 216 by the -o or --output option. main sets this to avoid problems. */ 217 extern FILE *sed_stdout; 218 #endif 219 214 220 /* If set, fflush(stdout) on every line output. */ 215 221 extern bool unbuffered_output;
Note:
See TracChangeset
for help on using the changeset viewer.