CVS update [cvs1-11-x-branch]: /ccvs/windows-NT/
[email protected] 28 May 2005 08:35:30 -0000
| Newsgroups | gmane.comp.version-control.cvs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Tag: cvs1-11-x-branch User: conradpino Date: 05/05/28 01:35:30 Modified: /ccvs/windows-NT/ ChangeLog, run.c Log: * run.c: Import feature branch revision 1.21 which defines the "run_add_arg_p" and "run_arg_free_p" functions. FIXME: Function "xnrealloc" call from "run_add_arg_p" undefined. File Changes: Directory: /ccvs/windows-NT/ ============================ File [changed]: ChangeLog Url: https://ccvs.cvshome.org/source/browse/ccvs/windows-NT/ChangeLog?r1=1.158.2.34&r2=1.158.2.35 Delta lines: +6 -0 ------------------- --- ChangeLog 28 May 2005 06:53:25 -0000 1.158.2.34 +++ ChangeLog 28 May 2005 08:35:28 -0000 1.158.2.35 @@ -1,3 +1,9 @@ +2005-05-28 Conrad T. Pino <[email protected]> + + * run.c: Import feature branch revision 1.21 which defines the + "run_add_arg_p" and "run_arg_free_p" functions. + FIXME: Function "xnrealloc" call from "run_add_arg_p" undefined. + 2005-05-27 Conrad T. Pino <[email protected]> * run.c: Import feature branch revision 1.20 as base for adding new File [changed]: run.c Url: https://ccvs.cvshome.org/source/browse/ccvs/windows-NT/run.c?r1=1.16.8.2&r2=1.16.8.3 Delta lines: +33 -25 --------------------- --- run.c 28 May 2005 06:53:25 -0000 1.16.8.2 +++ run.c 28 May 2005 08:35:28 -0000 1.16.8.3 @@ -39,8 +39,21 @@ */ static char **run_argv; static int run_argc; -static int run_argc_allocated; +static size_t run_arg_allocated; + + +void +run_arg_free_p (int argc, char **argv) +{ + int i; + for (i = 0; i < argc; i++) + free (argv[i]); +} + + + +/* VARARGS */ void run_setup (const char *prog) { @@ -103,33 +116,34 @@ void -run_add_arg (s) - const char *s; +run_add_arg_p (int *iargc, size_t *iarg_allocated, char ***iargv, + const char *s) { /* allocate more argv entries if we've run out */ - if (run_argc >= run_argc_allocated) + if (*iargc >= *iarg_allocated) { - run_argc_allocated += 50; - run_argv = xrealloc (run_argv, run_argc_allocated * sizeof (char **)); + *iarg_allocated += 50; + *iargv = xnrealloc (*iargv, *iarg_allocated, sizeof (char **)); } if (s) - { - run_argv[run_argc] = (run_argc ? quote (s) : xstrdup (s)); - run_argc++; - } + (*iargv)[(*iargc)++] = xstrdup (s); else - run_argv[run_argc] = NULL; /* not post-incremented on purpose! */ + (*iargv)[*iargc] = NULL; /* not post-incremented on purpose! */ +} + + + +void +run_add_arg (const char *s) +{ + run_add_arg_p (&run_argc, &run_arg_allocated, &run_argv, s); } int -run_exec (stin, stout, sterr, flags) - const char *stin; - const char *stout; - const char *sterr; - int flags; +run_exec (const char *stin, const char *stout, const char *sterr, int flags) { int shin, shout, sherr; int sain, saout, saerr; /* saved handles */ @@ -278,8 +292,7 @@ } void -run_print (fp) - FILE *fp; +run_print (FILE *fp) { int i; @@ -307,9 +320,7 @@ } FILE * -run_popen (cmd, mode) - const char *cmd; - const char *mode; +run_popen (const char *cmd, const char *mode) { if (trace) #ifdef SERVER_SUPPORT @@ -636,10 +647,7 @@ */ int -filter_stream_through_program (oldfd, dir, prog, pidp) - int oldfd, dir; - char **prog; - pid_t *pidp; +filter_stream_through_program (int oldfd, int dir, char **prog, pid_t *pidp) { HANDLE pipe[2]; char *command;