Gotcha...  more portable.

Reid

 > From: "Howard Chu" <[EMAIL PROTECTED]>
 > Date: Mon, 6 Nov 2000 13:24:40 -0800
 > MIME-Version: 1.0
 > Content-Type: text/plain;
 >      charset="iso-8859-1"
 > Content-Transfer-Encoding: 7bit
 > X-Priority: 3 (Normal)
 > X-MSMail-Priority: Normal
 > X-Mailer: Microsoft Outlook 8.5, Build 4.71.2377.0
 > Importance: Normal
 > X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0
 > 
 > Try "xargs command < tmpfile" instead of "cat tmpfile | xargs command" ...
 > 
 >   -- Howard Chu
 >   Chief Architect, Symas Corp.       Director, Highland Sun
 >   http://www.symas.com               http://highlandsun.com/hyc  
 > 
 > > -----Original Message-----
 > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
 > > Reid Madsen
 > > Sent: Monday, November 06, 2000 12:29 PM
 > > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 > > Subject: Re: GNU enhancement -- $(xargs cmd, list)
 > > 
 > > 
 > > 
 > > Well, I've got a prototype up and running and IMHO it's quite cool.
 > > 
 > > All changes are in function.c.  The net of the changes are:
 > > 
 > > * Added support for:
 > > 
 > >    $(xargs command, list)
 > > 
 > >   which is expanded to:
 > > 
 > >    cat <tmpfile> | xargs command; rm -f <tmpfile>
 > > 
 > > * Added 'func_xargs' as shown below:
 > > 
 > >     static int xargs_file_count = 0;
 > > 
 > >     static char *
 > >     func_xargs(o, argv, funcname)
 > >        char *o;
 > >        char **argv;
 > >        const char* funcname;
 > >     {
 > >    char buff[256];
 > >    char filename[256];
 > >    FILE* fd;
 > > 
 > >    sprintf (filename, "/tmp/gnumake.%d.%d.xargs", getpid(), 
 > > xargs_file_count++);
 > >    fd = fopen(filename, "w");
 > >    fprintf(fd, "%s\n", argv[1]);
 > >    fclose(fd);
 > > 
 > >    sprintf (buff, "cat %s | xargs ", filename);
 > >    o = variable_buffer_output(o, buff, strlen(buff));
 > >    o = variable_buffer_output(o, argv[0], strlen(argv[0]));
 > >    sprintf (buff, "; rm -f %s", filename);
 > >    o = variable_buffer_output(o, buff, strlen(buff));
 > >    return o;
 > >     }
 > > 
 > > This works perfectly!  Well at least it works perfectly within my limited
 > > understanding of GNUmake.
 > > 
 > > Additional considerations:
 > > 
 > > * On machines with dynamic command lines (i.e., Solaris), the $(xargs)
 > >   function should just expand to:
 > > 
 > >    command list
 > > 
 > >   No need for xargs in those cases.
 > >  
 > > * Allowing user definition of the XARGS command and options.  
 > > Something like:
 > > 
 > >    XARGS = myxargs
 > >    XARGS_OPTIONS = -blah -blah...
 > > 
 > >   with the defaults being:
 > > 
 > >    XARGS = xargs
 > >    XARGS_OPTIONS = 
 > > 
 > > Let me know if you want to integrate this.  Personally, I see 
 > > this as a very
 > > useful extension to GNUmake.
 > > 
 > > Regards,
 > > 
 > > Reid Madsen
 > > 
 > > -- 
 > > Reid Madsen                             [EMAIL PROTECTED]        
 > >               
 > > Senior Member, Tech. Staff              (972) 536-3261 (Desk)
 > > I2 Technologies                         (214) 850-9613 (Cellular)
 > > --
 > > Making incrementally (without 'clean') since May 18, 2000.
 > > Long live incremental make!
 > > 
 > > _______________________________________________
 > > Bug-make mailing list
 > > [EMAIL PROTECTED]
 > > http://mail.gnu.org/mailman/listinfo/bug-make
 > > 
 > 


-- 
Reid Madsen                             [EMAIL PROTECTED]                      
Senior Member, Tech. Staff              (972) 536-3261 (Desk)
I2 Technologies                         (214) 850-9613 (Cellular)
--
Making incrementally (without 'clean') since May 18, 2000.
Long live incremental make!

_______________________________________________
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make

Reply via email to