Re: Things I'd like to see in python...

lance@fox.com
Sat, 23 Jul 94 19:10:10 PDT

> Date: Sat, 23 Jul 1994 13:28:33 -0700
> From: Dan Stromberg - OAC-DCS <strombrg@bingy.acs.uci.edu>
>
> Anyway. Things I could use right now:
>
> 1) An execvp. Did someone just do this, or was I dreaming?

I just posted a patch for this.. Here is the patch again for you...
The line numbers might be a little off since I have other changes I
have added.. but "patch" should still work...

===================================================================
RCS file: /u/lance/CVS/python/Modules/posixmodule.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -c -r1.4 -r1.5
*** 1.4 1994/07/14 22:44:46
--- 1.5 1994/07/14 23:30:30
***************
*** 750,755 ****
--- 750,808 ----
}

static object *
+ posix_execvp(self, args)
+ object *self;
+ object *args;
+ {
+ char *path;
+ object *argv;
+ char **argvlist;
+ int i, argc;
+ object *(*getitem) PROTO((object *, int));
+
+ /* execvp has two arguments: (path, argv), where
+ argv is a list or tuple of strings. */
+
+ if (!getargs(args, "(sO)", &path, &argv))
+ return NULL;
+ if (is_listobject(argv)) {
+ argc = getlistsize(argv);
+ getitem = getlistitem;
+ }
+ else if (is_tupleobject(argv)) {
+ argc = gettuplesize(argv);
+ getitem = gettupleitem;
+ }
+ else {
+ badarg:
+ err_badarg();
+ return NULL;
+ }
+
+ argvlist = NEW(char *, argc+1);
+ if (argvlist == NULL)
+ return NULL;
+ for (i = 0; i < argc; i++) {
+ if (!getargs((*getitem)(argv, i), "s", &argvlist[i])) {
+ DEL(argvlist);
+ goto badarg;
+ }
+ }
+ argvlist[argc] = NULL;
+
+ #ifdef BAD_EXEC_PROTOTYPES
+ execvp(path, (const char **) argvlist);
+ #else
+ execvp(path, argvlist);
+ #endif
+
+ /* If we get here it's definitely an error */
+
+ DEL(argvlist);
+ return posix_error();
+ }
+
+ static object *
posix_fork(self, args)
object *self;
object *args;
***************
*** 1335,1340 ****
--- 1388,1394 ----
{"_exit", posix__exit},
{"execv", posix_execv},
{"execve", posix_execve},
+ {"execvp", posix_execvp},
#ifndef NT
{"fork", posix_fork},
{"getegid", posix_getegid},

> Also, I wouldn't complain a bit if that syslog module made it into
> 1.0.4...

Well.. if not, I will re-post it so all can include it..
Do you find it usefull ?????

--
Lance Ellinghouse                lance@fox.com