ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/fixargv0.c
(Generate patch)

Comparing ray/src/common/fixargv0.c (file contents):
Revision 2.1 by greg, Fri Oct 9 10:27:41 1992 UTC vs.
Revision 2.10 by greg, Tue Jun 3 21:31:51 2025 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5 < * Fix argv[0] for DOS environments
5 > * Fix argv[0] and assign global progname variable
6 > *
7 > *  External symbols declared in paths.h
8   */
9  
10 + #include "paths.h"
11 + #include <ctype.h>
12  
13 + char    *progname = NULL;       /* global argv[0] */
14 +
15   char *
16 < fixargv0(av0)                   /* extract command name from full path */
14 < char  *av0;
16 > fixargv0(char *av0)             /* extract command name from full path */
17   {
18 <        register char  *cp = av0;
18 >        char  *cp = av0;
19  
20          while (*cp) cp++;               /* start from end */
21 +
22          while (cp-- > av0)
23 <                switch (*cp) {          /* fix up command name */
23 >                switch (*cp) {
24 >                CASEDIRSEP:                     /* remove directory */
25 >                        av0 = cp+1;
26 >                        break;
27 > #if defined(_WIN32) || defined(_WIN64)  /* only do for Windows: */
28                  case '.':                       /* remove extension */
29                          *cp = '\0';
30                          continue;
24                case '\\':                      /* remove directory */
25                        return(cp+1);
31                  default:                        /* convert to lower case */
32                          *cp = tolower(*cp);
33                          continue;
34 + #endif
35                  }
36 <        return(av0);
36 >        return(progname = av0);
37   }
32
33

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines