home *** CD-ROM | disk | FTP | other *** search
- /* (C) Copyright 1991 Dave Fritsche (wb8zxu), All Rights Reserved.
- *
- * Redistribution and use in source and binary forms are permitted for
- * non-commercial use, provided that the above copyright notice and this
- * paragraph are duplicated in all such forms. THIS SOFTWARE IS PROVIDED
- * ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
- * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE.
- */
- #include <stdio.h>
- #include <dir.h>
- #include "screen.h"
-
- execute(fnm)
- char fnm[];
- {
- int cwd;
- FILE *fp;
- unsigned char buf[128], drive[MAXDRIVE], dir[MAXDIR], fname[MAXFILE];
- unsigned char ext[MAXEXT], curdir[MAXDIR], newdir[MAXDIR], slash[2];
-
- cwd = getdisk();
- getcurdir(0, curdir);
- fnsplit(path, drive, dir, fname, ext);
- drive[0] = toupper(drive[0]);
- sprintf(newdir, "%s%s", dir, fname);
- if (strlen(newdir) == 0)
- sprintf(newdir, "\\");
-
- if ( strlen(curdir) < 1 )
- sprintf(buf, "%c:\\%s", (cwd+'A'), fnm);
- else
- sprintf(buf, "%c:\\%s\\%s", (cwd+'A'), curdir, fnm);
-
- if ( (fp = fopen(buf, "r")) == NULL )
- {
- if (debug)
- printf("***> \"%s\" (%s) not present\n",
- fnm, buf);
- return(0);
- }
- fclose(fp);
-
- if ( strlen(curdir) < 1 )
- sprintf(buf, "%c:\\%s %c: \\ %c: %s \\", (cwd+'A'),
- fnm, (cwd+'A'), drive[0], newdir);
- else
- sprintf(buf, "%c:\\%s\\%s %c: \\%s\\ %c: %s \\%s", (cwd+'A'),
- curdir, fnm, (cwd+'A'), curdir, drive[0], newdir,
- curdir);
-
- if (ka9q) strcat(buf, " ka9q");
- else strcat(buf, " noka9q");
- if (g1emm) strcat(buf, " g1emm");
- else strcat(buf, " nog1emm");
- if (bm) strcat(buf, " bm");
- else strcat(buf, " nobm");
- if (netnews) strcat(buf, " netnews");
- else strcat(buf, " nonetnews");
-
- if (debug)
- printf("***> execute: %s\n", buf);
- if ( system(buf) != 0 )
- {
- printf("\nCan't seem to execute the batch file \"%s\"\n", buf);
- printf("The most likely reason is that COMMAND.COM isn't ");
- printf("where the \"COMSPEC\"\n");
- printf("environment variable says it is.\n\n");
- exit(1);
- }
- }
-