From 6d451b23a689aa423a885b5fd876cd2316d84e3b Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Thu, 23 Apr 2009 03:02:09 +1000 Subject: mingw.c: general cleanup and new missing functions --- include/mingw.h | 17 +++++++++-------- 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; #define S_IFLNK 0120000 /* Symbolic link */ #define S_ISLNK(x) (((x) & S_IFMT) == S_IFLNK) #define S_ISSOCK(x) 0 -#define S_IRGRP 0 -#define S_IWGRP 0 -#define S_IXGRP 0 -#define S_ISGID 0 -#define S_IROTH 0 -#define S_IXOTH 0 + +#define S_IRGRP (S_IRUSR >> 3) +#define S_IWGRP (S_IWUSR >> 3) +#define S_IXGRP (S_IXUSR >> 3) +#define S_IROTH (S_IRGRP >> 3) +#define S_IWOTH (S_IWGRP >> 3) +#define S_IXOTH (S_IXGRP >> 3) #define WIFEXITED(x) ((unsigned)(x) < 259) /* STILL_ACTIVE */ #define WEXITSTATUS(x) ((x) & 0xff) @@ -112,7 +113,7 @@ static inline int mingw_unlink(const char *pathname) static inline int waitpid(pid_t pid, unsigned *status, unsigned options) { if (options == 0) - return _cwait(status, pid, 0); + return _cwait((int*)status, pid, 0); errno = EINVAL; return -1; } @@ -192,7 +193,7 @@ int mingw_utime(const char *file_name, const struct utimbuf *times); #define utime mingw_utime pid_t mingw_spawnvpe(const char *cmd, const char **argv, char **env); -void mingw_execvp(const char *cmd, char *const *argv); +int mingw_execvp(const char *cmd, char *const *argv); #define execvp mingw_execvp 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) } } -void mingw_execvp(const char *cmd, char *const *argv) +int mingw_execvp(const char *cmd, char *const *argv) { char **path = get_path_split(); char *prog = path_lookup(cmd, path, 0); @@ -898,6 +898,7 @@ void mingw_execvp(const char *cmd, char *const *argv) errno = ENOENT; free_path_split(path); + return -1; } char **copy_environ() @@ -1216,3 +1217,33 @@ int link(const char *oldpath, const char *newpath) } return 0; } + +char *strsep(char **stringp, const char *delim) +{ + char *s, *old_stringp; + if (!*stringp) + return NULL; + old_stringp = s = *stringp; + while (*s) { + if (strchr(delim, *s)) { + *s = '\0'; + *stringp = s+1; + return old_stringp; + } + s++; + } + *stringp = NULL; + return old_stringp; +} +char *realpath(const char *path, char *resolved_path) +{ + return strcpy(resolved_path, path); +} +char *strptime(const char *s, const char *format, struct tm *tm) +{ + return NULL; +} +void gitunsetenv(const char *env) +{ +} + -- cgit v1.2.3-55-g6feb