Listing 1

//construct login batch file name .......
strcpy(linbuf, STARTUP_DIR);
strcat(linbuf, users[i].name );
strcat(linbuf, ".bat" );

//find and run login script file......
if( ( fp = fopen(linbuf, "r")) == NULL )
    cprintf("Can't find user file %s\a\r\n",linbuf );
else    {
    char *compsec;
    fclose(fp);
    //overlay with command.com and run user batch .......

    if( (compsec = gentenv("COMPSEC")) == NULL )
        exit(cprintf("No COMP[SEC in environment\r\n"));

    if(exelp(compsec,compsec,"/C",linbuf,NULL == -1)
        cprintf("Can't execute user file %s\r\n', linbuf);