home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************/
- /* */
- /* path.c */
- /* */
- /* Copyright (c) 2000 */
- /* Pasquale J. Villani */
- /* All Rights Reserved */
- /* */
- /* CMD32 is free software; you can redistribute it and/or */
- /* modify it under the terms of the GNU General Public License */
- /* as published by the Free Software Foundation; either version */
- /* 2, or (at your option) any later version. */
- /* */
- /* CMD32 is distributed in the hope that it will be useful, but */
- /* WITHOUT ANY WARRANTY; without even the implied warranty of */
- /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */
- /* the GNU General Public License for more details. */
- /* */
- /* You should have received a copy of the GNU General Public */
- /* License along with CMD32; see the file COPYING. If not, */
- /* write to the Free Software Foundation, 675 Mass Ave, */
- /* Cambridge, MA 02139, USA. */
- /****************************************************************/
-
- /* $Logfile$ */
-
- /* $Log$
- * $EndLog$ */
-
- #ifdef VERSION_STRINGS
- static char *RcsId = "$Header$";
- #endif
-
- #include <windows.h>
- #include "globals.h"
- #include "proto.h"
-
- #define SIZE 2048
-
- BOOL cmd_path(INT argc, BYTE *argv[])
- {
- BYTE szPath[SIZE];
- BYTE *lp;
- BYTE *ptr;
- BYTE *p;
-
- lp = skipwh(tail);
- if(*lp == ';')
- SetEnvironmentVariable("PATH", NULL);
- else if(*lp == '\0' || *lp == '\r' || *lp == '\n')
- {
- GetEnvironmentVariable("PATH", szPath, SIZE);
- ptr = skipwh(szPath);
- if(*ptr == '\0')
- printf("No Path\n\n");
- else
- printf("PATH=%s\n\n", ptr);
- }
- else
- {
- /* Trim trailing newline */
-
- for(p = lp; (*p != '\r') && (*p != '\n'); p++)
- ;
- *p = '\0';
- SetEnvironmentVariable("PATH", lp);
- }
- return TRUE;
- }
-
-
-
-