Changeset 1227 in kBuild for trunk/src/kash
- Timestamp:
- Oct 8, 2007 2:34:49 AM (17 years ago)
- Location:
- trunk/src/kash
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/Makefile.kmk
r1222 r1227 15 15 kmk_ash_TEMPLATE = BIN 16 16 kmk_ash_DEFS = lint SHELL SMALL 17 kmk_ash_DEFS += SH_STUB_MODE # for the time being. 17 18 kmk_ash_DEFS.debug = DEBUG 18 19 kmk_ash_DEFS.linux = BSD -
trunk/src/kash/shfile.c
r1225 r1227 29 29 30 30 #ifdef KBUILD_OS_WINDOWS 31 //# include <io.h> 31 # include <limits.h> 32 # ifndef PIPE_BUF 33 # define PIPE_BUF 512 34 # endif 32 35 #else 33 36 # include <unistd.h> 34 37 # include <fcntl.h> 38 # include <dirent.h> 35 39 #endif 36 40 … … 38 42 int shfile_open(shfdtab *pfdtab, const char *name, unsigned flags, mode_t mode) 39 43 { 40 // return open(name, flags); 41 return -1; 44 #ifdef SH_PURE_STUB_MODE 45 return -1; 46 #elif defined(SH_STUB_MODE) 47 return open(name, flags, mode); 48 #else 49 #endif 42 50 } 43 51 44 52 int shfile_pipe(shfdtab *pfdtab, int fds[2]) 45 53 { 46 return -1; 54 #ifdef SH_PURE_STUB_MODE 55 return -1; 56 #elif defined(SH_STUB_MODE) 57 # ifdef _MSC_VER 58 return _pipe(fds, PIPE_BUF, O_BINARY); 59 # else 60 return pipe(fds); 61 # endif 62 #else 63 #endif 47 64 } 48 65 49 66 int shfile_dup(shfdtab *pfdtab, int fd) 50 67 { 51 return -1; 68 #ifdef SH_PURE_STUB_MODE 69 return -1; 70 #elif defined(SH_STUB_MODE) 71 return dup(fd); 72 #else 73 #endif 52 74 } 53 75 54 76 int shfile_close(shfdtab *pfdtab, unsigned fd) 55 77 { 56 return -1; 78 #ifdef SH_PURE_STUB_MODE 79 return -1; 80 #elif defined(SH_STUB_MODE) 81 return close(fd); 82 #else 83 #endif 57 84 } 58 85 59 86 long shfile_read(shfdtab *pfdtab, int fd, void *buf, size_t len) 60 87 { 61 return -1; 88 #ifdef SH_PURE_STUB_MODE 89 return -1; 90 #elif defined(SH_STUB_MODE) 91 # ifdef _MSC_VER 92 return read(fd, buf, (unsigned)len); 93 # else 94 return read(fd, buf, len); 95 # endif 96 #else 97 #endif 62 98 } 63 99 64 100 long shfile_write(shfdtab *pfdtab, int fd, const void *buf, size_t len) 65 101 { 66 return -1; 102 #ifdef SH_PURE_STUB_MODE 103 return -1; 104 #elif defined(SH_STUB_MODE) 105 # ifdef _MSC_VER 106 return write(fd, buf, (unsigned)len); 107 # else 108 return write(fd, buf, len); 109 # endif 110 #else 111 #endif 67 112 } 68 113 69 114 long shfile_lseek(shfdtab *pfdtab, int fd, long off, int whench) 70 115 { 71 return -1; 116 #ifdef SH_PURE_STUB_MODE 117 return -1; 118 #elif defined(SH_STUB_MODE) 119 return lseek(fd, off, whench); 120 #else 121 #endif 72 122 } 73 123 74 124 int shfile_fcntl(shfdtab *pfdtab, int fd, int cmd, int arg) 75 125 { 76 return -1; 126 #ifdef SH_PURE_STUB_MODE 127 return -1; 128 #elif defined(SH_STUB_MODE) 129 # ifdef _MSC_VER 130 return -1; 131 # else 132 return fcntl(fd, cmd, arg); 133 # endif 134 #else 135 #endif 77 136 } 78 137 79 138 int shfile_stat(shfdtab *pfdtab, const char *path, struct stat *pst) 80 139 { 81 return -1; 140 #ifdef SH_PURE_STUB_MODE 141 return -1; 142 #elif defined(SH_STUB_MODE) 143 return stat(path, pst); 144 #else 145 #endif 82 146 } 83 147 84 148 int shfile_lstat(shfdtab *pfdtab, const char *link, struct stat *pst) 85 149 { 86 return -1; 150 #ifdef SH_PURE_STUB_MODE 151 return -1; 152 #elif defined(SH_STUB_MODE) 153 # ifdef _MSC_VER 154 return stat(link, pst); 155 # else 156 return lstat(link, pst); 157 # endif 158 #else 159 #endif 87 160 } 88 161 89 162 int shfile_chdir(shfdtab *pfdtab, const char *path) 90 163 { 91 return -1; 164 #ifdef SH_PURE_STUB_MODE 165 return -1; 166 #elif defined(SH_STUB_MODE) 167 # ifdef _MSC_VER //??? 168 return chdir(path); 169 # else 170 return chdir(path); 171 # endif 172 #else 173 #endif 92 174 } 93 175 94 176 char *shfile_getcwd(shfdtab *pfdtab, char *buf, int len) 95 177 { 96 return NULL; 178 #ifdef SH_PURE_STUB_MODE 179 return NULL; 180 #elif defined(SH_STUB_MODE) 181 return getcwd(buf, len); 182 #else 183 #endif 97 184 } 98 185 99 186 int shfile_access(shfdtab *pfdtab, const char *path, int type) 100 187 { 101 return -1; 188 #ifdef SH_PURE_STUB_MODE 189 return -1; 190 #elif defined(SH_STUB_MODE) 191 # ifdef _MSC_VER 192 type &= ~X_OK; 193 return access(path, type); 194 # else 195 return access(path, type); 196 # endif 197 #else 198 #endif 102 199 } 103 200 104 201 int shfile_isatty(shfdtab *pfdtab, int fd) 105 202 { 203 #ifdef SH_PURE_STUB_MODE 106 204 return 0; 205 #elif defined(SH_STUB_MODE) 206 return isatty(fd); 207 #else 208 #endif 107 209 } 108 210 … … 110 212 int shfile_ioctl(shfdtab *pfdtab, int fd, unsigned long request, void *buf) 111 213 { 112 return -1; 214 #ifdef SH_PURE_STUB_MODE 215 return -1; 216 #elif defined(SH_STUB_MODE) 217 # ifdef _MSC_VER 218 return -1; 219 # else 220 return ioctl(fd, request, buf); 221 # endif 222 #else 223 #endif 113 224 } 114 225 115 226 mode_t shfile_get_umask(shfdtab *pfdtab) 116 227 { 228 #ifdef SH_PURE_STUB_MODE 117 229 return 022; 230 #elif defined(SH_STUB_MODE) 231 return 022; 232 #else 233 #endif 118 234 } 119 235 … … 121 237 shdir *shfile_opendir(shfdtab *pfdtab, const char *dir) 122 238 { 123 return NULL; 239 #ifdef SH_PURE_STUB_MODE 240 return NULL; 241 #elif defined(SH_STUB_MODE) 242 # ifdef _MSC_VER 243 return NULL; 244 # else 245 return (shdir *)opendir(dir); 246 # endif 247 #else 248 #endif 124 249 } 125 250 126 251 shdirent *shfile_readdir(struct shdir *pdir) 127 252 { 128 return NULL; 253 #ifdef SH_PURE_STUB_MODE 254 return NULL; 255 #elif defined(SH_STUB_MODE) 256 # ifdef _MSC_VER 257 return NULL; 258 # else 259 struct dirent *pde = readdir((DIR *)pdir); 260 return pde ? (shdirent *)&pde->d_name[0] : NULL; 261 # endif 262 #else 263 #endif 129 264 } 130 265 131 266 void shfile_closedir(struct shdir *pdir) 132 267 { 133 134 } 268 #ifdef SH_PURE_STUB_MODE 269 return NULL; 270 #elif defined(SH_STUB_MODE) 271 # ifndef _MSC_VER 272 closedir((DIR *)pdir); 273 # endif 274 #else 275 #endif 276 }
Note:
See TracChangeset
for help on using the changeset viewer.