home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_09_05 / 9n05138a < prev    next >
Text File  |  1991-03-27  |  628b  |  23 lines

  1.  
  2. //construct login batch file name .......
  3. strcpy(linbuf, STARTUP_DIR);
  4. strcat(linbuf, users[i].name );
  5. strcat(linbuf, ".bat" );
  6.  
  7. //find and run login script file .......
  8. if( ( fp = fopen(linbuf, "r")) == NULL )
  9.      cprintf("Can't find user file %s\a\r\n",linbuf );
  10. else    { 
  11.      char *comspec;
  12.      fclose(fp) ;
  13.      //overlay with command.com and run user batch ......
  14.  
  15.      if( (comspec = getenv("COMSPEC")) == NULL )
  16.           exit(cprintf("No COMSPEC in environment\r\n"));
  17.  
  18.      if(execlp(comspec,comspec,"/C",linbuf,NULL) == -1)
  19.           cprintf("Can't execute user file %s\a\r\n", linbuf);
  20.  
  21. }
  22.  
  23.