Category : Files from Magazines
Archive   : CUJ9208.ZIP
Filename : 1008016A

 
Output of file : 1008016A contained in archive : CUJ9208.ZIP

Listing 5 -- system.c

/* system function -- UNIX version */
#include

/* UNIX system calls */
int _Execl(const char *, const char *, ...);
int _Fork(void);
int _Wait (int *);

int (system)(const char *s)
{ /* send text to system command line processor */
if (s)
{ /* not just a test */
int pid = _Fork();

if (pid < 0)
; /* fork failed */
else if (pid == 0)
{ /* continue here as child */
_Execl("/bin/sh", "sh", "-c", s, NULL);
exit(EXIT_FAILURE);
}
else /* continue here as parent */
while (_Wait(NULL) != pid)
; /* wait for child */
}
return (-1);
}





  3 Responses to “Category : Files from Magazines
Archive   : CUJ9208.ZIP
Filename : 1008016A

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/