Dan Pascu wrote:
>
> fputs is a much better (and less expensive) alternative in this context.
There are many instances in the code where fprintf is used where fputs
could be.
% find . -name \*.c -print0 | xargs -0 grep -r 'fprintf[^%]*$'
./WINGs/Examples/connect.c: fprintf(stderr, "Connection closed by
peer.\n");
./WINGs/Examples/connect.c: fprintf(stderr, "Connection closed by peer.\n");
./WINGs/Tests/wmfile.c: fprintf(stderr,
./WINGs/Tests/wmquery.c: fprintf(stderr,
./WPrefs.app/MouseSettings.c: fprintf(f, "#!/bin/sh\n");
./plugins/libwmfun/generic.c: vfprintf (stderr, format, args);
./plugins/libwmfun/getopt.c: fprintf (stderr,
./plugins/libwmfun/getopt.c: fprintf (stderr,
./src/motif.c: fprintf(stderr,"has decor hints [ ");
./src/motif.c: fprintf(stderr,"ALL ");
./src/motif.c: fprintf(stderr,"(BORDER) ");
./src/motif.c: fprintf(stderr,"RESIZEH ");
./src/motif.c: fprintf(stderr,"TITLE+close ");
./src/motif.c: fprintf(stderr,"(MENU) ");
./src/motif.c: fprintf(stderr,"MINIMIZE ");
./src/motif.c: fprintf(stderr,"(MAXIMIZE) ");
./src/motif.c: fprintf(stderr,"]\n");
./src/motif.c: fprintf(stderr,"has function hints [ ");
./src/motif.c: fprintf(stderr,"ALL ");
./src/motif.c: fprintf(stderr,"RESIZE ");
./src/motif.c: fprintf(stderr,"(MOVE) ");
./src/motif.c: fprintf(stderr,"MINIMIZE ");
./src/motif.c: fprintf(stderr,"MAXIMIZE ");
./src/motif.c: fprintf(stderr,"CLOSE ");
./src/motif.c: fprintf(stderr,"]\n");
./util/wxcopy.c: fprintf
./wrlib/nxpm.c: fprintf(file, "/* XPM */\n");
./wrlib/nxpm.c: fprintf(file, "static char *image[] = {\n");
./wrlib/nxpm.c: fprintf(file, "\"");
./wrlib/nxpm.c: fprintf(file, "\",\n");
./wrlib/nxpm.c: fprintf(file, "\"};\n");
./wrlib/tests/testgrad.c: fprintf(stderr, "Cannot allocate memory!\n");
> On Friday 26 December 2008, Tamas TEVESZ wrote:
> > excerpts from my local tree, part 9
> >
> > tree 1c246cc90b56
> > parent 5e9dc6a4a60c
> > author Tamas TEVESZ <[email protected]> 1230276327 -3600
> > committer Tamas TEVESZ <[email protected]> 1230276327 -3600
> > revision 1624
> > branch ice
> >
> > Fix format strings
> > diff --git a/wrlib/nxpm.c b/wrlib/nxpm.c
> > --- a/wrlib/nxpm.c
> > +++ b/wrlib/nxpm.c
> > @@ -644,9 +644,9 @@
> > if (!a || *a>127) {
> > tmpc = lookfor(colormap,
> > (unsigned)*r<<16|(unsigned)*g<<8|(unsigned)*b);
> >
> > - fprintf(file, index2str(buf, tmpc->index,
> > charsPerPixel)); + fprintf(file, "%s", index2str(buf,
> > tmpc->index, charsPerPixel)); } else {
> > - fprintf(file, transp);
> > + fprintf(file, "%s", transp);
> > }
> >
> > if (a) {
--
To unsubscribe, send mail to [email protected].