home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.20 / text0147.txt < prev    next >
Encoding:
Internet Message Format  |  1990-08-02  |  1.1 KB

  1. From:  guy@auspex.uucp (Guy Harris)
  2.  
  3. >What I appear to need here is either:
  4. >
  5. >    a)  a standard way to convert a va_list into a list of pointers
  6. >        (to argument values), or
  7.  
  8. I suspect "different_execvp" is misnamed; given the "va_list", it
  9. appears to have a calling sequence more like "execlp" - i.e.,
  10.  
  11.     different_execlp("/bin/explode", "explode", "bright blue light",
  12.         (char *)NULL);
  13.  
  14. Given that, you could scan the argument list twice; the first time,
  15. you'd count the number of arguments, then you'd malloc up an array of
  16. N+1 "char *"s, and scan the argument list a second time filling in that
  17. array.  Now "argv" is a pointer to the first element of that array....
  18.  
  19. >None of these things are a part of standard ANSI C (as far as I know).
  20.  
  21. The second isn't; the first can be done in ANSI C, unless I've missed
  22. something subtle in the spec that forbids traversing the argument list
  23. twice (I just checked and didn't see anything obvious).
  24.  
  25. >Are any of them a part of POSIX?
  26.  
  27. Nope.
  28.  
  29. >If not, why not?
  30.  
  31. Because the first can be done in ANSI C (or pre-ANSI C with <varargs.h>).
  32.  
  33. Volume-Number: Volume 20, Number 145
  34.  
  35.