1 |
/* Copyright (c) 1992 Regents of the University of California */ |
2 |
|
3 |
#ifndef lint |
4 |
static char SCCSid[] = "$SunId$ LBL"; |
5 |
#endif |
6 |
|
7 |
/* |
8 |
* Fix argv[0] for DOS environments |
9 |
*/ |
10 |
|
11 |
|
12 |
char * |
13 |
fixargv0(av0) /* extract command name from full path */ |
14 |
char *av0; |
15 |
{ |
16 |
register char *cp = av0; |
17 |
|
18 |
while (*cp) cp++; /* start from end */ |
19 |
while (cp-- > av0) |
20 |
switch (*cp) { /* fix up command name */ |
21 |
case '.': /* remove extension */ |
22 |
*cp = '\0'; |
23 |
continue; |
24 |
case '\\': /* remove directory */ |
25 |
return(cp+1); |
26 |
default: /* convert to lower case */ |
27 |
*cp = tolower(*cp); |
28 |
continue; |
29 |
} |
30 |
return(av0); |
31 |
} |
32 |
|
33 |
|