| Revision: | 2.5 | 
| Committed: | Mon Oct 27 10:19:31 2003 UTC (22 years ago) by schorsch | 
| Content type: | text/plain | 
| Branch: | MAIN | 
| CVS Tags: | rad5R0, rad4R2, rad3R7P2, rad3R7P1, rad4R1, rad4R0, rad3R6, rad3R6P1, rad3R8, rad3R9, rad4R2P1, rad4R2P2 | 
| Changes since 2.4: | +2 -2 lines | 
| Log Message: | Added gethomedir.c and various compatibility fixes. | 
| # | Content | 
|---|---|
| 1 | #ifndef lint | 
| 2 | static const char RCSid[] = "$Id: fixargv0.c,v 2.4 2003/10/21 19:19:28 schorsch Exp $"; | 
| 3 | #endif | 
| 4 | /* | 
| 5 | * Fix argv[0] for DOS environments | 
| 6 | * | 
| 7 | * External symbols declared in paths.h | 
| 8 | */ | 
| 9 | |
| 10 | #include "copyright.h" | 
| 11 | |
| 12 | #include <ctype.h> | 
| 13 | |
| 14 | extern char * | 
| 15 | fixargv0(av0) /* extract command name from full path */ | 
| 16 | char *av0; | 
| 17 | { | 
| 18 | register char *cp = av0; | 
| 19 | |
| 20 | while (*cp) cp++; /* start from end */ | 
| 21 | while (cp-- > av0) | 
| 22 | switch (*cp) { /* fix up command name */ | 
| 23 | case '.': /* remove extension */ | 
| 24 | *cp = '\0'; | 
| 25 | continue; | 
| 26 | case '\\': /* remove directory */ | 
| 27 | return(cp+1); | 
| 28 | default: /* convert to lower case */ | 
| 29 | *cp = tolower(*cp); | 
| 30 | continue; | 
| 31 | } | 
| 32 | return(av0); | 
| 33 | } | 
| 34 | |
| 35 |