summaryrefslogtreecommitdiff
path: root/pkgtools/posix_headers/files/stdlib.h
blob: edc4fb54cfbd2b28ee12a3741749c79296bd1b49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* $NetBSD: stdlib.h,v 1.2 2007/04/28 21:25:06 tnn Exp $ */
#ifndef _PKGSRC_STDLIB_H_
#define _PKGSRC_STDLIB_H_
#include "@REAL_HEADER@"
#ifdef __hpux
/* What were they thinking? */
#include <inttypes.h>
#define strtoll __strtoll
#define strtoull __strtoull
#include <string.h>
#include <stdio.h>
/* provide a setenv(3) implementation */
static __inline int setenv(const char *name, const char *value, int overwrite);
static __inline int setenv(const char *name, const char *value, int overwrite) {
	char *c;
	int ret;
	if (!overwrite && getenv(name)) return(-1);
	c = (char*)malloc(strlen(name)+strlen(value)+2);
	if(!c) return(-1);
	sprintf(c, "%s=%s", name, value);
	ret = putenv(c);
	free(c);
	return(ret);
}
#endif /* __hpux */
#endif /* _PKGSRC_STDLIB_H_ */