ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/fixargv0.c
Revision: 2.4
Committed: Tue Oct 21 19:19:28 2003 UTC (20 years, 6 months ago) by schorsch
Content type: text/plain
Branch: MAIN
Changes since 2.3: +3 -2 lines
Log Message:
Various platform compatibility fixes.

File Contents

# Content
1 #ifndef lint
2 static const char RCSid[] = "$Id: fixargv0.c,v 2.3 2003/02/25 02:47:21 greg 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 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