Changeset 131 for trunk/thune/unix
- Timestamp:
- 05/01/06 16:17:35 (3 years ago)
- Files:
-
- 1 modified
-
trunk/thune/unix/os.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/thune/unix/os.c
r88 r131 24 24 #include <sys/stat.h> 25 25 #include <dirent.h> 26 #include <errno.h> 26 27 #include <unistd.h> 27 28 #include <signal.h> … … 29 30 #include "os.h" 30 31 #include "urlan.h" 32 #include "internal.h" 31 33 32 34 … … 42 44 /* 43 45 change-dir 44 */ 45 void uc_changeDir( UCell* tos ) 46 (dir -- logic) 47 */ 48 UR_CALL_PUB( uc_changeDir ) 46 49 { 47 50 int logic = 0; 48 UString* str = ur_binPtr( tos->series.n ); 51 UString* str = ur_bin( tos ); 52 53 UR_CALL_UNUSED_TH; 49 54 50 55 ur_termCStr( str ); … … 61 66 ( -- path) 62 67 */ 63 void uc_whatDir( UCell* tos)68 UR_CALL_PUB( uc_whatDir ) 64 69 { 65 70 char tmp[ 512 ]; 66 71 67 if( getcwd( tmp, 512 ) ) 72 UR_S_GROW; 73 tos = UR_TOS; 74 75 if( getcwd( tmp, sizeof(tmp) ) ) 68 76 { 69 77 int len; … … 127 135 128 136 129 #if 0 130 #define REF_TIME a1 131 132 void uc_now( UCell* a1 ) 133 { 134 UCell* res; 137 /* 138 (dir-name -- ) 139 No error if directory exists. 140 */ 141 UR_CALL_PUB( uc_makeDir ) 142 { 143 int err; 144 UString* str = ur_bin(tos); 145 ur_termCStr(str); 146 err = mkdir( str->ptr.c, 0755 ); 147 if( err ) 148 { 149 if( (errno != EEXIST) || (ur_isDir(str->ptr.c) != 1) ) 150 { 151 ur_throwErr( ur_thread, UR_EX_ACCESS, strerror/*_r*/(errno) ); 152 return; 153 } 154 } 155 UR_S_DROP; 156 } 157 158 159 // ( -- time) 160 UR_CALL_PUB( uc_now ) 161 { 135 162 struct timeval tp; 136 163 164 UR_S_GROW; 165 tos = UR_TOS; 166 137 167 gettimeofday( &tp, 0 ); 138 139 //printf( "sizeof(timeval.tv_sec) %d %d\n", 140 // sizeof(tp.tv_sec), sizeof(tp.tv_usec) ); 141 142 res = orRESULT; 143 if( orRefineSet( REF_TIME ) ) 144 orSetTF( res, OT_TIME ); 145 else 146 orSetTF( res, OT_DATE ); 147 148 res->time.sec = tp.tv_sec; 149 res->time.usec = tp.tv_usec; 150 } 151 #endif 168 ur_seconds(tos) = ((double) tp.tv_sec) + ((double) tp.tv_usec) * 0.000001; 169 170 ur_setType( tos, UT_TIME ); 171 } 152 172 153 173
