home *** CD-ROM | disk | FTP | other *** search
- /*
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; ;
- ; ;
- ; ~~ ~~ ~~ ~~ ;
- ; ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ;
- ; ~~~~~~ ~ ~~~~~~ ~ ~~~~~~ ~ ~~~~~~ ~ ;
- ; ~~~~~~ ~~~~~~ ~~~~~~ ~~~~~~ ;
- ; ~~~~~~~~ ~~~~~~~~ ~~~~~~~~ ~~~~~~~~ ;
- ; ~~~~~~~~~~~ ~~~~~~~~~~~~~ ~~~~~~~~~~~~ ~~~~~~~~~~~~ ;
- ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
- ;~~ copyright ~~~~ (c) ~ 1982 ~~~ oceanwave ~~~~ softworks ~~~~;
- ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
- ;~~ 516 forward street ~~~~~~~~~ la jolla ca ~~~~~~~ 92037 ~~;
- ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
- ;~~~~~ all information contained herein is proprietary ~~~~~~~~;
- ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
- ;~~~~~~~~~~~~~~~ to oceanwave softworks ~~~~~~~~~~~~~~~~~~~~~~~;
- ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-
-
- WRITTEN BY: DION HOLLENBECK hollen@megatek.UUCP
- DATE: NOVEMBER 3, 1987
-
-
- This program is placed in the public domain and may be freely copied and
- distributed with the following stipulations. It is not to be sold. It
- is to be distributed in its entirety with all files listed herein included.
-
- Please contact me with suggestions for improvements and reports of
- problems. If you enjoy using this program and feel it is worth it,
- a donation would appreciated.
-
- Written for Microsoft C 4.0.
-
- */
- #include <local.h>
- #include <dos.h>
- #include <process.h>
- #include <stdio.h>
- #include <ctype.h>
- #include <direct.h>
- #include <string.h>
-
- #define MAXLINE 80
-
- main(argc,argv)
- int argc;
- char *argv[];
- {
- char exepath[80];
- char *goptr;
- int gopos;
- FILE *godat;
- char line[81];
- int result;
-
- /* check for proper usage */
-
- if (argc < 2)
- {
- printf("Go: Usage: go directory_mnemonic \n");
- exit(1);
- }
-
-
- /* parse argv[0] for pathname of where this program was executed from */
-
- strcpy(exepath, argv[0]);
- goptr = strstr(exepath, "GO.EXE");
- gopos = (int)(goptr - exepath);
- exepath[gopos] = '\0';
- strcat(exepath,"GO.DAT");
-
- /* open data file GO.DAT in same directory that program was found */
-
- if ((godat = fopen(exepath,"rt")) == NULL)
- {
- fprintf(stderr,"Could not open file %s", exepath);
- exit(1);
- }
-
- /* scan file for match on directory mnemonic and do chdir if found */
-
- result = 1;
- while ((fgets(line, MAXLINE, godat) != NULL) && (result != NULL))
- {
- result = dodir(line, argv[1]);
- }
- if (result != NULL)
- fprintf(stderr,"Mnemonic '%s' not found\n",argv[1]);
- fflush(godat);
- fclose(godat);
- exit(0);
- }
-
-
-
- int
- dodir(line,argptr)
-
- char *line;
- char *argptr;
- {
-
- char *token0;
- char *token1;
- char *token2;
- char newpath[80];
- char newdrive[4];
- unsigned int dosdx;
-
- /* parse first token and compare to command line argument */
- /* if it matches, parse other tokens and set drive and path */
-
-
- token0 = strtok(line, " ,;");
- if (token0[0] == '#')
- return(1);
- if (strcmpi(argptr, token0) == 0)
- {
- token1 = strtok(NULL, " ,;");
- strcpy(newpath, token1);
- token2 = strtok(NULL, " ,;");
- if ((token2 != NULL) && (token2[0] != '#'))
- {
- strcpy(newdrive,token2);
- dosdx = (unsigned int) (toupper (newdrive[0]) - 64 - 1);
- bdos (14, dosdx, 0);
-
- }
- chdir(newpath);
- return(NULL);
- }
- return(1);
- }