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