home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / programm / 4489 < prev    next >
Encoding:
Text File  |  1992-08-30  |  1.3 KB  |  31 lines

  1. Newsgroups: comp.unix.programmer
  2. Path: sparky!uunet!ukma!wupost!gumby!destroyer!mudos!mju
  3. From: mju@mudos.ann-arbor.mi.us (Marc Unangst)
  4. Subject: Re: Need help with System()
  5. Message-ID: <BtszB4.8M4@mudos.ann-arbor.mi.us>
  6. Date: Sun, 30 Aug 1992 15:35:27 GMT
  7. References: <1992Aug28.140705.501@polari>
  8. Organization: The Programmer's Pit Stop, Ann Arbor MI
  9. Keywords: Need help with System()
  10. Lines: 19
  11.  
  12. In article <1992Aug28.140705.501@polari> errant@polari.online.com writes:
  13. >detected, but then it drops through and prints bad.  What gives??
  14. >Is there something I could add to the code that would show me??
  15. >I'm stumped!
  16.  
  17. Well, first off try reading the system(3) manpage to find out what the
  18. system() call returns.  Hint: it isn't the same as the value of "$?"
  19. after running a command in the Bourne shell.
  20.  
  21. Second, you would probably be better off staying away from doing ugly
  22. things like this in your program.  Other people will grimace at you
  23. and say bad things about your mother behind your back.  Instead, use
  24. popen(3) to get the output from ps(1) and parse it yourself.  Much
  25. simpler and easier, and less filling too.
  26.  
  27. -- 
  28. Marc Unangst                | Real men don't make backups.  Real men never
  29. mju@mudos.ann-arbor.mi.us   | accidentally delete files that they're going
  30.                             | to need later.
  31.