#include descrip
#include stdio

int lib$spawn();              

long spawn(str, out_file)
char *str;         /* Command to be executed  */
char *out_file;    /* Output file for results */
{
   $DESCRIPTOR(command, "command");
   $DESCRIPTOR(output, "file");
   char command_name[1024];
   int status;     /* Return status of call  */
   int value;      /* Exit value of command  */

   command.dsc$w_length = strlen(str);
   command.dsc$a_pointer = str;
   output.dsc$w_length = strlen(out_file);
   output.dsc$a_pointer = out_file;
   status = lib$spawn(&command, 0, &output, 0, 0, 0, &value, 0, 0, 0, 0,
		      0);
   if(!(status & 1) || !(value & 1)) {
      return(0);
   }
   return(1);
}

#ifdef TEST
#include stdio

main()
{
   spawn("@perm$2:[consult03.who]who.com", "spawn.out");
}
#endif
