#include <stdarg.h>
#include <stdio.h>
#include <string.h>
+#include <assert.h>
#include <sys/types.h>
#include "config.h"
#include "common.h"
#include "lib.h"
+#include "both.h"
char *xstrcat3save(const char *a, const char *b, const char *c) {
char *r;
return r;
}
-char *xstrsave(const char *s) {
- char *r;
-
- r= xmalloc(strlen(s)+1);
- strcpy(r,s);
- return r;
-}
-
char *xstrsubsave(const char *begin, int len) {
char *r;
return r;
}
-void *xmalloc(size_t s) {
- void *p;
- p= malloc(s?s:1); if (!p) syscallerror("malloc");
- return p;
-}
-
-void *xrealloc(void *p, size_t s) {
- p= realloc(p,s); if (!p) syscallerror("realloc");
- return p;
-}
-
int makeroom(char **buffer, int *size, int needed) {
if (needed > MAX_GENERAL_STRING) return -1;
if (*size >= needed) return 0;
vsnytprintfcat(buffer,size,fmt,al);
va_end(al);
}
+
+#ifndef HAVE_SETENV
+int setenv(const char *name, const char *value, int overwrite) {
+ char *buffer= 0;
+
+ assert(overwrite==1);
+ buffer= xmalloc(strlen(name)+strlen(value)+2);
+
+ sprintf(buffer,"%s=%s",name,value);
+ return putenv(buffer);
+}
+#endif /* HAVE_SETENV */