| 1 |
greg |
2.1 |
#ifndef lint
|
| 2 |
greg |
2.2 |
static const char RCSid[] = "$Id$";
|
| 3 |
greg |
2.1 |
#endif
|
| 4 |
|
|
/*
|
| 5 |
|
|
* Fix argv[0] for DOS environments
|
| 6 |
greg |
2.2 |
*
|
| 7 |
|
|
* External symbols declared in standard.h
|
| 8 |
|
|
*/
|
| 9 |
|
|
|
| 10 |
greg |
2.3 |
#include "copyright.h"
|
| 11 |
greg |
2.1 |
|
| 12 |
|
|
|
| 13 |
|
|
char *
|
| 14 |
|
|
fixargv0(av0) /* extract command name from full path */
|
| 15 |
|
|
char *av0;
|
| 16 |
|
|
{
|
| 17 |
|
|
register char *cp = av0;
|
| 18 |
|
|
|
| 19 |
|
|
while (*cp) cp++; /* start from end */
|
| 20 |
|
|
while (cp-- > av0)
|
| 21 |
|
|
switch (*cp) { /* fix up command name */
|
| 22 |
|
|
case '.': /* remove extension */
|
| 23 |
|
|
*cp = '\0';
|
| 24 |
|
|
continue;
|
| 25 |
|
|
case '\\': /* remove directory */
|
| 26 |
|
|
return(cp+1);
|
| 27 |
|
|
default: /* convert to lower case */
|
| 28 |
|
|
*cp = tolower(*cp);
|
| 29 |
|
|
continue;
|
| 30 |
|
|
}
|
| 31 |
|
|
return(av0);
|
| 32 |
|
|
}
|
| 33 |
|
|
|
| 34 |
|
|
|