diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2009-04-23 03:02:09 +1000 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2009-04-23 04:44:32 +1000 |
commit | 6d451b23a689aa423a885b5fd876cd2316d84e3b (patch) | |
tree | 44e2df44a463cd2b6636fc3cceb538e0ecb87cdf | |
parent | 4287ed1ecbe21e7e90b9420b267edf8fe1482b71 (diff) | |
download | busybox-w32-6d451b23a689aa423a885b5fd876cd2316d84e3b.tar.gz busybox-w32-6d451b23a689aa423a885b5fd876cd2316d84e3b.tar.bz2 busybox-w32-6d451b23a689aa423a885b5fd876cd2316d84e3b.zip |
mingw.c: general cleanup and new missing functions
-rw-r--r-- | include/mingw.h | 17 | ||||
-rw-r--r-- | libbb/mingw.c | 33 |
2 files changed, 41 insertions, 9 deletions
diff --git a/include/mingw.h b/include/mingw.h index 763606e51..fe84da7ad 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -10,12 +10,13 @@ typedef int pid_t; | |||
10 | #define S_IFLNK 0120000 /* Symbolic link */ | 10 | #define S_IFLNK 0120000 /* Symbolic link */ |
11 | #define S_ISLNK(x) (((x) & S_IFMT) == S_IFLNK) | 11 | #define S_ISLNK(x) (((x) & S_IFMT) == S_IFLNK) |
12 | #define S_ISSOCK(x) 0 | 12 | #define S_ISSOCK(x) 0 |
13 | #define S_IRGRP 0 | 13 | |
14 | #define S_IWGRP 0 | 14 | #define S_IRGRP (S_IRUSR >> 3) |
15 | #define S_IXGRP 0 | 15 | #define S_IWGRP (S_IWUSR >> 3) |
16 | #define S_ISGID 0 | 16 | #define S_IXGRP (S_IXUSR >> 3) |
17 | #define S_IROTH 0 | 17 | #define S_IROTH (S_IRGRP >> 3) |
18 | #define S_IXOTH 0 | 18 | #define S_IWOTH (S_IWGRP >> 3) |
19 | #define S_IXOTH (S_IXGRP >> 3) | ||
19 | 20 | ||
20 | #define WIFEXITED(x) ((unsigned)(x) < 259) /* STILL_ACTIVE */ | 21 | #define WIFEXITED(x) ((unsigned)(x) < 259) /* STILL_ACTIVE */ |
21 | #define WEXITSTATUS(x) ((x) & 0xff) | 22 | #define WEXITSTATUS(x) ((x) & 0xff) |
@@ -112,7 +113,7 @@ static inline int mingw_unlink(const char *pathname) | |||
112 | static inline int waitpid(pid_t pid, unsigned *status, unsigned options) | 113 | static inline int waitpid(pid_t pid, unsigned *status, unsigned options) |
113 | { | 114 | { |
114 | if (options == 0) | 115 | if (options == 0) |
115 | return _cwait(status, pid, 0); | 116 | return _cwait((int*)status, pid, 0); |
116 | errno = EINVAL; | 117 | errno = EINVAL; |
117 | return -1; | 118 | return -1; |
118 | } | 119 | } |
@@ -192,7 +193,7 @@ int mingw_utime(const char *file_name, const struct utimbuf *times); | |||
192 | #define utime mingw_utime | 193 | #define utime mingw_utime |
193 | 194 | ||
194 | pid_t mingw_spawnvpe(const char *cmd, const char **argv, char **env); | 195 | pid_t mingw_spawnvpe(const char *cmd, const char **argv, char **env); |
195 | void mingw_execvp(const char *cmd, char *const *argv); | 196 | int mingw_execvp(const char *cmd, char *const *argv); |
196 | #define execvp mingw_execvp | 197 | #define execvp mingw_execvp |
197 | 198 | ||
198 | static inline unsigned int git_ntohl(unsigned int x) | 199 | static inline unsigned int git_ntohl(unsigned int x) |
diff --git a/libbb/mingw.c b/libbb/mingw.c index 62aad5d7e..181999f3f 100644 --- a/libbb/mingw.c +++ b/libbb/mingw.c | |||
@@ -886,7 +886,7 @@ static void mingw_execve(const char *cmd, char *const *argv, char *const *env) | |||
886 | } | 886 | } |
887 | } | 887 | } |
888 | 888 | ||
889 | void mingw_execvp(const char *cmd, char *const *argv) | 889 | int mingw_execvp(const char *cmd, char *const *argv) |
890 | { | 890 | { |
891 | char **path = get_path_split(); | 891 | char **path = get_path_split(); |
892 | char *prog = path_lookup(cmd, path, 0); | 892 | char *prog = path_lookup(cmd, path, 0); |
@@ -898,6 +898,7 @@ void mingw_execvp(const char *cmd, char *const *argv) | |||
898 | errno = ENOENT; | 898 | errno = ENOENT; |
899 | 899 | ||
900 | free_path_split(path); | 900 | free_path_split(path); |
901 | return -1; | ||
901 | } | 902 | } |
902 | 903 | ||
903 | char **copy_environ() | 904 | char **copy_environ() |
@@ -1216,3 +1217,33 @@ int link(const char *oldpath, const char *newpath) | |||
1216 | } | 1217 | } |
1217 | return 0; | 1218 | return 0; |
1218 | } | 1219 | } |
1220 | |||
1221 | char *strsep(char **stringp, const char *delim) | ||
1222 | { | ||
1223 | char *s, *old_stringp; | ||
1224 | if (!*stringp) | ||
1225 | return NULL; | ||
1226 | old_stringp = s = *stringp; | ||
1227 | while (*s) { | ||
1228 | if (strchr(delim, *s)) { | ||
1229 | *s = '\0'; | ||
1230 | *stringp = s+1; | ||
1231 | return old_stringp; | ||
1232 | } | ||
1233 | s++; | ||
1234 | } | ||
1235 | *stringp = NULL; | ||
1236 | return old_stringp; | ||
1237 | } | ||
1238 | char *realpath(const char *path, char *resolved_path) | ||
1239 | { | ||
1240 | return strcpy(resolved_path, path); | ||
1241 | } | ||
1242 | char *strptime(const char *s, const char *format, struct tm *tm) | ||
1243 | { | ||
1244 | return NULL; | ||
1245 | } | ||
1246 | void gitunsetenv(const char *env) | ||
1247 | { | ||
1248 | } | ||
1249 | |||