Changeset 1508
- Timestamp:
- Sep 15, 2004, 2:34:25 AM (21 years ago)
- Location:
- trunk/src/emx
- Files:
-
- 3 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/lib/libc.def
-
Property cvs2svn:cvs-rev
changed from
1.62
to1.63
r1507 r1508 1176 1176 "___libc_OS2ErrorPush" @1196 1177 1177 "___libc_OS2ErrorSet" @1197 1178 "__getdcwd" @1198 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/abspath.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1507 r1508 8 8 #include <sys/param.h> 9 9 #include <emx/syscalls.h> 10 #include <InnoTekLIBC/libc.h> 10 11 #include <InnoTekLIBC/locale.h> 11 12 … … 18 19 char drive, dir[MAXPATHLEN+1], src_drive, *s, *p; 19 20 int i, j, rel, server, trail, mbcl; 21 char chSlash = !__libc_gfNoUnix ? '/' : '\\'; 20 22 21 23 s = alloca (strlen (src) + 1); … … 39 41 } 40 42 else if (__getcwd (dir, drive) == 0) 41 _fnslashify (dir); 43 { 44 if (!__libc_gfNoUnix) 45 _fnslashify (dir); 46 } 42 47 else 43 48 { … … 45 50 rel = TRUE; 46 51 } 52 47 53 while (*s != 0) 48 54 { 49 55 if (s[0] == '.' && (IS_PATH_DELIM (s[1]) || s[1] == 0)) 50 56 ++s; 51 else if (s[0] == '.' && s[1] == '.' && (IS_PATH_DELIM (s[2]) || 57 else if (s[0] == '.' && s[1] == '.' && (IS_PATH_DELIM (s[2]) || 52 58 s[2] == 0)) 53 59 { … … 68 74 i = strlen (dir); 69 75 if (i < sizeof (dir) - 1) 70 dir[i++] = '/';76 dir[i++] = chSlash; 71 77 while (*s != 0) 72 78 { … … 105 111 } 106 112 if (i < size && server && src_drive == 0) 107 dst[i++] = '/';108 if (i < size && !rel && dir[0] != '/')109 dst[i++] = '/';113 dst[i++] = chSlash; 114 if (i < size && !rel && dir[0] != chSlash) 115 dst[i++] = chSlash; 110 116 j = 0; 111 if (rel && dir[j] == '/')117 if (rel && dir[j] == chSlash) 112 118 ++j; 113 119 while (i < size && dir[j] != 0) 114 120 dst[i++] = dir[j++]; 115 if (trail && i < size && (i == 0 || dst[i-1] != '/'))116 dst[i++] = '/';121 if (trail && i < size && (i == 0 || dst[i-1] != chSlash)) 122 dst[i++] = chSlash; 117 123 if (i >= size) 118 124 { -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/fullpath.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r1507 r1508 9 9 #include <emx/syscalls.h> 10 10 #include <emx/io.h> 11 #include <InnoTekLIBC/libc.h> 11 12 12 13 int _fullpath (char *dst, const char *src, int size) … … 27 28 cwd1[0] = cwd2[0] = drive; 28 29 cwd1[1] = cwd2[1] = ':'; 29 cwd1[2] = cwd2[2] = '/';30 cwd1[2] = cwd2[2] = !__libc_gfNoUnix ? '/' : '\\'; 30 31 if (__getcwd (cwd1+3, drive) != 0) 31 32 goto failure; … … 67 68 } 68 69 if (!_trslash (dst, j, 0)) 69 dst[j++] = '/';70 dst[j++] = !__libc_gfNoUnix ? '/' : '\\'; 70 71 strcpy (dst+j, temp+k); 71 72 } 72 _fnslashify (dst); 73 if (!__libc_gfNoUnix) 74 _fnslashify (dst); 73 75 return 0; 74 76 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/getcwd.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1507 r1508 7 7 #include <sys/param.h> 8 8 #include <emx/syscalls.h> 9 #include <InnoTekLIBC/libc.h> 10 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC 11 #include <InnoTekLIBC/logstrict.h> 9 12 10 char *_STD(getcwd) 13 char *_STD(getcwd)(char *buffer, size_t size) 11 14 { 12 char tmp[MAXPATHLEN+1]; 13 size_t len; 15 LIBCLOG_ENTER("buffer=%p size=%d\n", buffer, size); 16 if (!__libc_gfNoUnix) 17 { 18 char tmp[MAXPATHLEN+1]; 19 size_t len; 14 20 15 if (buffer != NULL && size == 0) 21 if (buffer != NULL && size == 0) 22 { 23 errno = EINVAL; 24 LIBCLOG_RETURN_P(NULL); 25 } 26 if (__getcwd(tmp, 0) < 0) 27 return NULL; 28 len = strlen(tmp) + 2; 29 if (buffer != NULL) 30 { 31 if (len > size) 32 { 33 errno = ERANGE; 34 LIBCLOG_RETURN_P(NULL); 35 } 36 } 37 else 38 { 39 if (len > size) 40 size = len; 41 buffer = malloc(size); 42 if (buffer == NULL) 43 { 44 errno = ENOMEM; 45 LIBCLOG_RETURN_P(NULL); 46 } 47 } 48 _fnslashify(tmp); 49 buffer[0] = '/'; 50 memcpy(buffer + 1, tmp, len - 1); 51 LIBCLOG_RETURN_MSG(buffer, "ret %p:{%s}\n", (void *)buffer, buffer); 52 } 53 else 16 54 { 17 errno = EINVAL;18 return NULL;55 char *pszRet = _getcwd2(buffer, size); 56 LIBCLOG_RETURN_P(pszRet); 19 57 } 20 if (__getcwd (tmp, 0) < 0)21 return NULL;22 len = strlen (tmp) + 2;23 if (buffer != NULL)24 {25 if (len > size)26 {27 errno = ERANGE;28 return NULL;29 }30 }31 else32 {33 if (len > size)34 size = len;35 buffer = malloc (size);36 if (buffer == NULL)37 {38 errno = ENOMEM;39 return NULL;40 }41 }42 _fnslashify (tmp);43 buffer[0] = '/';44 strcpy (buffer+1, tmp);45 return buffer;46 58 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/getcwd1.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r1507 r1508 4 4 #include <stdlib.h> 5 5 #include <emx/syscalls.h> 6 #include <InnoTekLIBC/libc.h> 7 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC 8 #include <InnoTekLIBC/logstrict.h> 6 9 7 10 int _getcwd1 (char *buffer, char drive) 8 11 { 9 if (__getcwd (buffer+1, drive) < 0) 10 return -1; 11 _fnslashify (buffer+1); 12 buffer[0] = '/'; 13 return 0; 12 LIBCLOG_ENTER("buffer=%p drive=%c\n", (void *)buffer, drive); 13 if (__getcwd (buffer+1, drive) < 0) 14 LIBCLOG_RETURN_INT(-1); 15 if (!__libc_gfNoUnix) 16 { 17 _fnslashify(buffer+1); 18 buffer[0] = '/'; 19 } 20 else 21 buffer[1] = '\\'; 22 LIBCLOG_RETURN_MSG(0, "ret 0 buffer=:{%s}\n", buffer); 14 23 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/getcwd2.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r1507 r1508 7 7 #include <sys/param.h> 8 8 #include <emx/syscalls.h> 9 #include <InnoTekLIBC/libc.h> 10 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC 11 #include <InnoTekLIBC/logstrict.h> 9 12 10 13 char *_getcwd2 (char *buffer, int size) 11 14 { 12 char tmp[MAXPATHLEN+1]; 13 int len; 15 LIBCLOG_ENTER("buffer=%p size=%d\n", (void *)buffer, size); 16 char tmp[MAXPATHLEN+1]; 17 int len; 14 18 15 if (buffer != NULL && size <= 0)19 if (buffer != NULL && size <= 0) 16 20 { 17 errno = EINVAL;18 return NULL;21 errno = EINVAL; 22 LIBCLOG_RETURN_P(NULL); 19 23 } 20 if (__getcwd (tmp, 0) < 0)21 return NULL;22 len = strlen (tmp) + 4;23 if (buffer != NULL)24 if (__getcwd (tmp, 0) < 0) 25 return NULL; 26 len = strlen (tmp) + 4; 27 if (buffer != NULL) 24 28 { 25 if (len > size)29 if (len > size) 26 30 { 27 errno = ERANGE;28 return NULL;31 errno = ERANGE; 32 LIBCLOG_RETURN_P(NULL); 29 33 } 30 34 } 31 else35 else 32 36 { 33 if (len > size)34 size = len;35 buffer = malloc(size);36 if (buffer == NULL)37 if (len > size) 38 size = len; 39 buffer = malloc(size); 40 if (buffer == NULL) 37 41 { 38 errno = ENOMEM;39 return NULL;42 errno = ENOMEM; 43 LIBCLOG_RETURN_P(NULL); 40 44 } 41 45 } 42 _fnslashify (tmp); 43 buffer[0] = _getdrive(); 44 buffer[1] = ':'; 45 buffer[2] = '/'; 46 strcpy (buffer+3, tmp); 47 return buffer; 46 if (!__libc_gfNoUnix) 47 { 48 _fnslashify(tmp); 49 buffer[0] = _getdrive(); 50 buffer[1] = ':'; 51 buffer[2] = '/'; 52 memcpy(buffer+3, tmp, len - 3); 53 } 54 else 55 { 56 buffer[0] = _getdrive(); 57 buffer[1] = ':'; 58 buffer[2] = '\\'; 59 memcpy(buffer+3, tmp, len - 3); 60 } 61 LIBCLOG_RETURN_MSG(buffer, "ret %p:{%s}\n", (void *)buffer, buffer); 48 62 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/getwd.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1507 r1508 7 7 #include <sys/param.h> 8 8 #include <emx/syscalls.h> 9 #include <InnoTekLIBC/libc.h> 9 10 10 11 char *_STD(getwd) (char *buffer) … … 20 21 return NULL; 21 22 } 22 _fnslashify (buffer+1); 23 buffer[0] = '/'; 23 if (!__libc_gfNoUnix) 24 { 25 _fnslashify (buffer+1); 26 buffer[0] = '/'; 27 } 28 else 29 buffer[0] = '\\'; 30 24 31 return buffer; 25 32 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/startup/386/crt0.s
-
Property cvs2svn:cvs-rev
changed from
1.8
to1.9
r1507 r1508 46 46 addl $8, %esp 47 47 #endif 48 #if defined (HIGHMEM) 49 pushl $1 /* vote for high mem for default stack */ 48 #if defined(HIGHMEM) && defined(NOUNIX) 49 pushl $3 /* vote for high mem for default heap; & less unixness. */ 50 #elif defined(HIGHMEM) 51 pushl $1 /* vote for high mem for default heap */ 52 #elif defined(NOUNIX) 53 pushl $2 /* vote against high memory for deault heap; lexx unixness */ 50 54 #else 51 pushl $0 /* veto agains high mem for default stack*/55 pushl $0 /* veto against high mem for default heap. */ 52 56 #endif 53 57 call ___init_app -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/startup/386/dll0.s
-
Property cvs2svn:cvs-rev
changed from
1.10
to1.11
r1507 r1508 66 66 do_init: 67 67 #endif 68 #if defined (HIGHMEM) 69 pushl $1 /* vote for high mem for default stack */ 68 #if defined(HIGHMEM) && defined(NOUNIX) 69 pushl $3 /* vote for high mem for default heap; & less unixness. */ 70 #elif defined(HIGHMEM) 71 pushl $1 /* vote for high mem for default heap */ 72 #elif defined(NOUNIX) 73 pushl $2 /* vote against high memory for deault heap; lexx unixness */ 70 74 #else 71 pushl $0 /* veto against high mem for default stack*/75 pushl $0 /* veto against high mem for default heap. */ 72 76 #endif 73 77 call ___init_dll -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/startup/startup.smak
-
Property cvs2svn:cvs-rev
changed from
1.13
to1.14
r1507 r1508 9 9 include common.smak 10 10 11 .OBJS += $(addprefix $.$(.TKIND.DIR)src/lib/startup/,mcrt0.o gcrt0.o crt0fork.o dll0fork.o crt0hi.o dll0hi.o crt0hifork.o dll0hifork.o) \ 12 $(addprefix $.omf/src/lib/startup/,mcrt0.obj gcrt0.obj \ 13 $(CPU)/crt0.obj $(CPU)/dll0.obj crt0fork.obj dll0fork.obj crt0hi.obj dll0hi.obj crt0hifork.obj dll0hifork.obj) 11 .OBJS += $(addprefix $.$(.TKIND.DIR)src/lib/startup/,mcrt0.o gcrt0.o) \ 12 $(addprefix $.omf/src/lib/startup/,mcrt0.obj gcrt0.obj $(CPU)/crt0.obj $(CPU)/dll0.obj ) 14 13 .DIRS := $(sort $(dir $(.OBJS))) 15 14 TARGDIRS += $(.DIRS) 15 16 # define to do 17 define def_startup 18 $(eval .OBJS += $.aout/src/lib/startup/crt0$(i).o) 19 $$.aout/src/lib/startup/crt0$(i).o: src/lib/startup/386/crt0.s 20 $$(call DO.COMPILE.s, $(subst noux, -DNOUNIX,$(subst fork, -DFORK,$(subst hi, -DHIGHMEM, $i)))) 21 22 $(eval .OBJS += $.aout/src/lib/startup/dll0$(i).o) 23 $$.aout/src/lib/startup/dll0$(i).o: src/lib/startup/386/dll0.s 24 $$(call DO.COMPILE.s, $(subst noux, -DNOUNIX,$(subst fork, -DFORK,$(subst hi, -DHIGHMEM, $i)))) 25 26 $(eval .OBJS += $.omf/src/lib/startup/crt0$(i).obj) 27 $$.omf/src/lib/startup/crt0$(i).obj: $$.aout/src/lib/startup/crt0$(i).o 28 $$(call DO.EMXOMF,-m__text) 29 30 $(eval .OBJS += $.omf/src/lib/startup/dll0$(i).obj) 31 $$.omf/src/lib/startup/dll0$(i).obj: $$.aout/src/lib/startup/dll0$(i).o 32 $$(call DO.EMXOMF,-l__text) 33 endef 34 35 # generate 36 $(foreach i,hi hifork hinoux hiforknoux fork forknoux noux,$(eval $(def_startup))) 37 16 38 17 39 libc: emxomf ld $(.DIRS) $(.OBJS) … … 21 43 $(call CP,$^,$(dir $@)) 22 44 23 $.aout/src/lib/startup/crt0fork.o: src/lib/startup/386/crt0.s24 $(call DO.COMPILE.s, -DFORK)25 26 $.aout/src/lib/startup/dll0fork.o: src/lib/startup/386/dll0.s27 $(call DO.COMPILE.s, -DFORK)28 29 $.aout/src/lib/startup/crt0hi.o: src/lib/startup/386/crt0.s30 $(call DO.COMPILE.s, -DHIGHMEM)31 32 $.aout/src/lib/startup/dll0hi.o: src/lib/startup/386/dll0.s33 $(call DO.COMPILE.s, -DHIGHMEM)34 35 $.aout/src/lib/startup/crt0hifork.o: src/lib/startup/386/crt0.s36 $(call DO.COMPILE.s, -DHIGHMEM -DFORK)37 38 $.aout/src/lib/startup/dll0hifork.o: src/lib/startup/386/dll0.s39 $(call DO.COMPILE.s, -DHIGHMEM -DFORK)40 41 42 45 $.aout/src/lib/startup/mcrt0.o: src/lib/startup/386/crt0.s 43 46 $(call DO.COMPILE.s, -DMCRT0) … … 59 62 $.omf/src/lib/startup/gcrt0.obj: $.aout/src/lib/startup/gcrt0.o 60 63 $(call DO.EMXOMF,-m__text) 61 $.omf/src/lib/startup/dll0fork.obj: $.aout/src/lib/startup/dll0fork.o62 $(call DO.EMXOMF,-l__text)63 $.omf/src/lib/startup/crt0fork.obj: $.aout/src/lib/startup/crt0fork.o64 $(call DO.EMXOMF,-m__text)65 $.omf/src/lib/startup/dll0hi.obj: $.aout/src/lib/startup/dll0hi.o66 $(call DO.EMXOMF,-l__text)67 $.omf/src/lib/startup/crt0hi.obj: $.aout/src/lib/startup/crt0hi.o68 $(call DO.EMXOMF,-m__text)69 $.omf/src/lib/startup/dll0hifork.obj: $.aout/src/lib/startup/dll0hifork.o70 $(call DO.EMXOMF,-l__text)71 $.omf/src/lib/startup/crt0hifork.obj: $.aout/src/lib/startup/crt0hifork.o72 $(call DO.EMXOMF,-m__text)73 64 $.omf/src/lib/startup/386/dll0.obj: $.aout/src/lib/startup/386/dll0.o 74 65 $(call DO.EMXOMF,-l__text) -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__getcwd.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1507 r1508 15 15 if (drive != 0) 16 16 drive -= 'A' - 1; 17 size = 512;17 size = CCHMAXPATH; 18 18 FS_SAVE_LOAD(); 19 19 rc = DosQueryCurrentDir (drive, buffer, &size); -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__init.c
-
Property cvs2svn:cvs-rev
changed from
1.14
to1.15
r1507 r1508 144 144 * Does initialization for thread 1 before main() is called. 145 145 * 146 * This function doesn't return, but leaves it stack frame on the stack by some146 * This function doesn't return, but leaves its stack frame on the stack by some 147 147 * magic done in sys/386/appinit.s. The top of the returned stack have a layout 148 148 * as seen in struct stackframe below - start of struct is main() callframe. 149 * @param fDefaultHeapInHighMem If set the application is open to put the default 150 * heap in high memory. 151 * If clear the application veto against putting the 152 * default heap in high memory. 153 * Passed on to __init_dll(). 149 * 150 * @param fFlags Bit 0: If set the application is open to put the default heap in high memory. 151 * If clear the application veto against putting the default heap in high memory. 152 * Bit 1: If set some of the unixness of LIBC is disabled. 153 * If clear all unix like features are enabled. 154 * Passed on to __init_dll(). 155 * 154 156 * @ingroup startup 155 157 */ 156 void __init(int f DefaultHeapInHighMem)158 void __init(int fFlags) 157 159 { 158 160 /** top of stack unpon 'return' from this function. */ … … 181 183 * Then end the heap voting. 182 184 */ 183 if (__init_dll(f DefaultHeapInHighMem))185 if (__init_dll(fFlags)) 184 186 goto failure; 185 187 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__initdll.c
-
Property cvs2svn:cvs-rev
changed from
1.13
to1.14
r1507 r1508 35 35 #include "syscalls.h" 36 36 #include <InnoTekLIBC/thread.h> 37 #include <InnoTekLIBC/libc.h> 37 38 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_INITTERM 38 39 #include <InnoTekLIBC/logstrict.h> … … 60 61 * Global Variables * 61 62 *******************************************************************************/ 63 int __libc_gfNoUnix; 62 64 __LIBC_PPTHREAD __libc_gpTLS; 63 65 … … 77 79 * Common init code for crt0 and dll0. 78 80 * This should perhaps be a part of _CRT_init. 79 */ 80 int __init_dll(int fDefaultHeapInHighMem) 81 * 82 * @param fFlags Bit 0: If set the application is open to put the default heap in high memory. 83 * If clear the application veto against putting the default heap in high memory. 84 * Bit 1: If set some of the unixness of LIBC is disabled. 85 * If clear all unix like features are enabled. 86 * Passed on to __init_dll(). 87 */ 88 int __init_dll(int fFlags) 81 89 { 82 90 ULONG aul[2]; … … 89 97 90 98 /* 91 * Heap voting. 92 */ 93 __libc_HeapVote(fDefaultHeapInHighMem); 99 * Process flags. 100 */ 101 __libc_HeapVote(fFlags & 1); 102 if (fFlags & 2) 103 __libc_gfNoUnix = 1; 104 94 105 95 106 /* -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/pathrewrite.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1507 r1508 60 60 *******************************************************************************/ 61 61 #include <InnoTekLIBC/pathrewrite.h> 62 #include <InnoTekLIBC/libc.h> 62 63 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO 63 64 #include <InnoTekLIBC/logstrict.h> … … 239 240 * Extra unix features. 240 241 */ 241 if ( 1)242 if (!__libc_gfNoUnix) 242 243 { 243 244 /* -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/syscalls.h
-
Property cvs2svn:cvs-rev
changed from
1.12
to1.13
r1507 r1508 64 64 */ 65 65 EXTERN unsigned long _sys_gcbVirtualAddressLimit; 66 67 66 68 67 /* The top heap object. This points into _sys_heap_objs[] or is NULL. … … 161 160 /** @group Init Functions 162 161 * @{ */ 163 extern void __init(int f DefaultHeapInHighMem);164 extern int __init_dll(int f DefaultHeapInHighMem);162 extern void __init(int fFlags); 163 extern int __init_dll(int fFlags); 165 164 extern void /*volatile*/_sys_init_ret(void *stack) __attribute__((__noreturn__)); 166 165 extern int _sys_init_environ(const char *pszEnv); -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.