home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.programmer
- Path: sparky!uunet!pipex!warwick!coventry!champion
- From: champion@cch.coventry.ac.uk (Alun)
- Subject: Re: How to execute unix commands from a c-program
- Message-ID: <Bx8rJD.34D@cck.coventry.ac.uk>
- Sender: news@cck.coventry.ac.uk (news user)
- Nntp-Posting-Host: cc_sysh
- Organization: Coventry University, Coventry, UK.
- References: <1992Nov4.153029.21837@cs.ruu.nl> <1992Nov4.163532.8801@cbfsb.cb.att.com>
- Date: Thu, 5 Nov 1992 11:49:49 GMT
- Lines: 43
-
- In article <1992Nov4.163532.8801@cbfsb.cb.att.com> nll@cbnewsb.cb.att.com (neal.l.leitner) writes:
- ~From article <1992Nov4.153029.21837@cs.ruu.nl>, by hpverwei@cs.ruu.nl (Dick Verweij):
- ~> See subject,
- ~>
- ~> --
- ~> DICK H.P. VERWEIJ
- ~>
- ~> --------------------------------------------------------------------------------
- ~> D:-) I:-) C:-) K:-) email : hpverwei@cs.ruu.nl
- ~main()
- ~{
- ~ .
- ~ .
- ~ .
- ~ system("ls -l");
- ~}
- ~
- ~or
- ~
- ~main()
- ~{
- ~ char mystring[10];
- ~ .
- ~ .
- ~ .
- ~ strcpy(mystring,"ls -l");
- ~ system(mystring);
- ~}
-
- what about
- main()
- {
- execl("/bin/ls", "ls", "-l", 0);
- }
-
- I personally don't like the system call as it uses /bin/sh to run the program.
- There also is a question about the security of system() with setuid programs.
-
- -Alun
-
- --
- A.Champion | That's an interesting point, in the sense of
- (champion@uk.ac.cov.cck) | being very not interesting at all. - The Liar
-