home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************/
- /* */
- /* prompt.c */
- /* */
- /* command.com prompt command */
- /* */
- /* Copyright (c) 1995 */
- /* Pasquale J. Villani */
- /* All Rights Reserved */
- /* */
- /* This file is part of CMD32. */
- /* */
- /* 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"
-
- /* put_prompt - print prompt obeying $x commands */
- void put_prompt(BYTE *fmt)
- {
- BYTE c;
- BYTE *s;
- BYTE directory[NAMEMAX];
-
- while ((c = *fmt++) != '\0')
- {
- if (c != '$')
- {
- if(c != '\n' && c != '\r')
- HandleChar(0, c);
- continue;
- }
- c = *fmt++;
- switch (toupper(c))
- {
- case 'P':
- GetCurrentDirectory(NAMEMAX, directory);
- printf("%s", directory);
- continue;
-
- case 'N':
- GetCurrentDirectory(NAMEMAX, directory);
- HandleChar(0, directory[0]);
- continue;
-
- case 'G':
- HandleChar(0, '>');
- continue;
-
- case 'L':
- HandleChar(0, '<');
- continue;
-
- case 'B':
- HandleChar(0, '|');
- continue;
-
- case 'E':
- HandleChar(0, '=');
- continue;
-
- default:
- HandleChar(0, c);
- continue;
- }
- }
- }
-
-
-