#define problem
Richard A. O'Keefe
ok at goanna.cs.rmit.oz.au
Thu Jun 20 20:41:12 AEST 1991
In article <1991Jun20.051827.23428 at ux1.cso.uiuc.edu>, beaucham at uxh.cso.uiuc.edu (James Beauchamp) writes:
> I have many occurences of 'printf(' which I would like to replace with
> 'fprintf(stderr,' in my C program.
Why not use a text editor? I'm serious. Using ed(1):
1,$s/printf(/fprintf(stderr, /g
In ex(1) or vi(1),
1,$s/printf(/fprintf(stderr, /gc
will ask you about each change. This is even easier to do in Emacs-like
editors, such as micro-Emacs, Jove, and GNU Emacs.
> #define printf( fprintf(sterr,
>
> definitely doesn't parse.
Neither it should! Sending a boy on a man's errand, shameful!
You might want to consider something like
#ifdef OldStyle
#define errlog stdout
#else
#define errlog stderr
#endif
replacing printf(...) by fprintf(errlog,...).
But you have a very strange program if there are "many" things you want
to write to stderr not _nothing_ you want to write to stdout.
--
I agree with Jim Giles about many of the deficiencies of present UNIX.
More information about the Comp.lang.c
mailing list