home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / MISC / MN325SRC.ZIP / makenl-3.2.5 / src / osgenexc.c < prev    next >
C/C++ Source or Header  |  2005-02-06  |  580b  |  24 lines

  1. /* $Id: osgenexc.c,v 1.4 2004/09/05 10:43:57 mbroek Exp $ */
  2.  
  3. int os_spawn(const char *command, const char *cmdline)
  4. {
  5.     char *cmd;
  6.     int rc;
  7.  
  8.     cmd = malloc(strlen(command) + 1 + strlen(cmdline) + 1);
  9.     if (!cmd)
  10.     {
  11.         fprintf(stderr, "Out of memory for command line buffer!\n");
  12.     mklog(0, "os_spawn: out of memory for command line buffer");
  13.         return -1;
  14.     }
  15.  
  16.     sprintf(cmd, "%s %s", command, cmdline);
  17.     mklog(3, "os_spawn: %s", cmd);
  18.     rc = system(cmd);
  19.     mklog(3, "os_spawn: rc=%d", rc);
  20.  
  21.     free(cmd);
  22.     return rc;
  23. }
  24.