CVS update: /ccvs/windows-NT/
[email protected] 28 May 2005 08:11:15 -0000
| Newsgroups | gmane.comp.version-control.cvs.cvs |
|---|---|
| Message-ID | <[email protected]> |
User: conradpino Date: 05/05/28 01:11:15 Modified: /ccvs/windows-NT/ ChangeLog, run.c Log: * run.c: Implement functions "run_add_arg_p" and "run_arg_free_p" by copying from "../src/run.c" and change all K&R style function argument declarations to ANSI style. File Changes: Directory: /ccvs/windows-NT/ ============================ File [changed]: ChangeLog Url: https://ccvs.cvshome.org/source/browse/ccvs/windows-NT/ChangeLog?r1=1.307&r2=1.308 Delta lines: +6 -0 ------------------- --- ChangeLog 26 May 2005 16:40:00 -0000 1.307 +++ ChangeLog 28 May 2005 08:11:13 -0000 1.308 @@ -1,3 +1,9 @@ +2005-05-28 Conrad T. Pino <[email protected]> + + * run.c: Implement functions "run_add_arg_p" and "run_arg_free_p" by + copying from "../src/run.c" and change all K&R style function argument + declarations to ANSI style. + 2005-05-26 Derek Price <[email protected]> * pwd.h, pwd.c: Reformat to CVS conventions. File [changed]: run.c Url: https://ccvs.cvshome.org/source/browse/ccvs/windows-NT/run.c?r1=1.20&r2=1.21 Delta lines: +33 -25 --------------------- --- run.c 22 Feb 2005 16:42:25 -0000 1.20 +++ run.c 28 May 2005 08:11:13 -0000 1.21 @@ -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;