- Timestamp:
- Jan 2, 2004, 8:17:21 PM (22 years ago)
- Location:
- trunk/src/emx/src/lib/bsd
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/lib/bsd/gen/getprogname.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r926 r927 8 8 #include "libc_private.h" 9 9 10 #ifdef __EMX__ 11 #define INCL_BASE 12 #define INCL_FSMACROS 13 #include <os2emx.h> 14 #include <string.h> 15 const char *__progname = NULL; 16 #endif 17 10 18 __weak_reference(_getprogname, getprogname); 19 11 20 12 21 const char * 13 22 _getprogname(void) 14 23 { 24 #ifdef __EMX__ 25 /* 26 * On demand initiation. 27 * THREADS: The assignment isn't safe. 28 * THREADS: pib_pchcmd is pointing into environment space which in theory 29 * can be changed by any other thread while we're parsing it. 30 */ 31 if (!__progname) 32 { 33 char *psz, *psz2; 34 PTIB ptib; 35 PPIB ppib; 36 FS_VAR(); 15 37 38 FS_SAVE(); 39 DosGetInfoBlocks(&ptib, &ppib); 40 FS_RESTORE(); 41 42 psz = ppib->pib_pchcmd; 43 psz2 = strlen(psz) + psz; 44 while (psz2 >= psz) 45 { 46 if (*psz2 == '\\' || *psz2 == '/' || *psz2 == ':') 47 break; 48 psz2--; 49 } 50 psz2++; 51 /* This is in the volatile env. block - dupe it. */ 52 __progname = strdup(psz2); 53 } 54 #endif 16 55 return (__progname); 17 56 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/bsd/gen/setprogname.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r926 r927 10 10 setprogname(const char *progname) 11 11 { 12 const char *p; 13 12 const char *p; 13 #ifdef __EMX__ 14 p = strlen(progname) + progname; 15 while (p >= progname) 16 { 17 if (*p == '\\' || *p == '/' || *p == ':') 18 { 19 __progname = p + 1; 20 return; 21 } 22 p--; 23 } 24 __progname = progname; 25 return; 26 #else 14 27 p = strrchr(progname, '/'); 15 28 if (p != NULL) … … 17 30 else 18 31 __progname = progname; 32 #endif 19 33 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/bsd/stdlib/getopt.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r926 r927 42 42 #include <stdlib.h> 43 43 #include <string.h> 44 #include <unistd.h> 44 45 #include "un-namespace.h" 45 46 … … 61 62 */ 62 63 int 63 getopt(nargc, nargv, ostr)64 _STD(getopt)(nargc, nargv, ostr) 64 65 int nargc; 65 66 char * const *nargv; -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.