home *** CD-ROM | disk | FTP | other *** search
- @echo off
- REM PathDel.bat - remove a directory from the current path, if it's there
-
- if "%1"=="" GOTO SHOW_HOW
- if not "%2"=="" GOTO SHOW_HOW
- cenvi %0.BAT %1
- GOTO FINI
-
- :SHOW_HOW
- ECHO PathDel.bat - Delete a directory from the PATH if it's there
- ECHO USAGE: PathDel DirSpec
- GOTO FINI
-
-
- GOTO CENVI_EXIT
-
- main(argc,argv)
- {
- OldDir = argv[1]
- if NULL == (Position = FindDirInPath(OldDir))
- printf("The Directory \"%s\" is not in PATH.\n",OldDir)
- else {
- // copy from Path beyond this dir
- strcpy(Position,Position+strlen(OldDir))
- // if there is a semi-colon at this position, then copy from beyond that too
- if (Position[0] == ';')
- strcpy(Position,Position+1)
- }
- }
-
- FindDirInPath(Dir) // search through path for this Dir, return pointer if found
- // and return NULL if not found
- {
- len = strlen(Dir)
- p = PATH
- do {
- if ( 0 == strnicmp(p,Dir,len) && (p[len]==0 || p[len]==';') )
- return(p)
- p = strchr(p,';')
- } while( p++ != NULL )
- return(NULL)
- }
-
- :CENVI_EXIT
- :FINI