Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.c Subject: Re: #define problem Keywords: #define macro Message-ID: <6401@goanna.cs.rmit.oz.au> Date: 20 Jun 91 10:41:12 GMT References: <1991Jun20.051827.23428@ux1.cso.uiuc.edu> Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 30 In article <1991Jun20.051827.23428@ux1.cso.uiuc.edu>, beaucham@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.