Annotation of sbbs/sbbs2/execsbbs/execsbbs.c, revision 1.1.1.1

1.1       root        1: /* execbbs.c */
                      2: 
                      3: /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
                      4: 
                      5: #include <dos.h>
                      6: #include <dir.h>
                      7: #include <errno.h>
                      8: #include <stdio.h>
                      9: #include <stdlib.h>
                     10: #include <string.h>
                     11: #include <process.h>
                     12: 
                     13: extern unsigned _heaplen=2048;
                     14: 
                     15: /* usage: execsbbs start_dir "program parms" sbbspath [r] */
                     16: 
                     17: int main(int argc, char *argv[])
                     18: {
                     19:        char path[129],*comspec,*p,*arg[30],c;
                     20:        int disk;
                     21: 
                     22: if(argc<4) {
                     23:        printf("This program is for the internal use of Synchronet.\r\n");
                     24: /***   Debug stuff
                     25:        printf("argc=%d\r\n",argc);
                     26:        for(c=0;c<argc;c++)
                     27:                printf("argv[%d]='%s'\n",c,argv[c]);
                     28: ***/
                     29:        return(0); }
                     30: disk=getdisk();
                     31: getcwd(path,128);
                     32: comspec=getenv("COMSPEC");
                     33: 
                     34: /***                                   /* Removed */
                     35: strcpy(str,comspec);   /* save comspec */
                     36: strcpy(comspec,"");     /* destroy comspec */
                     37: ***/
                     38: 
                     39: if(argv[1][1]==':')                /* drive letter specified */
                     40:        setdisk(toupper(argv[1][0])-'A');
                     41: chdir(argv[1]);
                     42: 
                     43: p=strchr(argv[2],' ');
                     44: if(p)
                     45:        p++;
                     46: if(spawnlpe(P_WAIT,comspec,comspec,"/c",argv[2],NULL,environ))
                     47:        printf("EXECSBBS: Error %d spawning %s\r\n",errno,argv[2]);
                     48: /***
                     49: strcpy(comspec,str);   /* restore comspec */
                     50: ***/
                     51: setdisk(disk);
                     52: if(chdir(path))
                     53:        printf("\7\r\nEXECBBS: Error changing directory to %s\r\n",path);
                     54: for(c=0;c<30;c++)
                     55:        arg[c]=argv[c+3];
                     56: if(execve(arg[0],arg,environ))
                     57:        printf("EXECSBBS: Error %d executing %s\r\n",errno,arg[0]);
                     58: return(1);
                     59: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.