hp-ux patch
David Leonard
David.Leonard at quest.com
Mon Jan 21 13:09:37 EST 2008
Everyone loves HP-UX.
*** stdrusty.h Mon Dec 31 15:28:38 2007
--- stdrusty.h Mon Dec 31 15:42:00 2007
***************
*** 2,8 ****
--- 2,10 ----
#define _STDRUSTY_H
#include <stdbool.h>
#include <string.h>
+ #if !defined(__hpux__)
#include <stdint.h>
+ #endif
/* Is A == B ? */
#define streq(a,b) (strcmp((a),(b)) == 0)
*** ccontrol.c Mon Dec 31 15:28:37 2007
--- ccontrol.c Mon Dec 31 15:40:11 2007
***************
*** 11,16 ****
--- 11,17 ----
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>
+ #include <sys/stat.h>
#include <fcntl.h>
#include "stdrusty.h"
#include "ccontrol.h"
***************
*** 402,404 ****
--- 403,428 ----
}
return ret;
}
+
+ #if defined(__hpux__)
+ int setenv(const char *name, const char *value, int overwrite)
+ {
+ char *env_line;
+ int name_len = strlen(name);
+ int value_len = strlen(value);
+
+ if (!overwrite && getenv(name))
+ return 0;
+ env_line = malloc(name_len + 1 + value_len + 1); /* "name=value\0" */
+ memcpy(env_line, name, name_len);
+ env_line[name_len] = '=';
+ memcpy(env_line + name_len + 1, value, value_len);
+ env_line[name_len + 1 + value_len] = 0;
+ return putenv(env_line);
+ }
+
+ int unsetenv(const char *name)
+ {
+ return putenv(name);
+ }
+ #endif
More information about the ccontrol
mailing list