Programs that use efun.

This commit is contained in:
christos 2006-08-26 18:14:28 +00:00
parent 8919424bdb
commit 2a1607d040
25 changed files with 69 additions and 275 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: params.c,v 1.15 2006/03/17 13:58:27 elad Exp $ */ /* $NetBSD: params.c,v 1.16 2006/08/26 18:14:28 christos Exp $ */
/*- /*-
* Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: params.c,v 1.15 2006/03/17 13:58:27 elad Exp $"); __RCSID("$NetBSD: params.c,v 1.16 2006/08/26 18:14:28 christos Exp $");
#endif #endif
#include <sys/types.h> #include <sys/types.h>
@ -49,6 +49,7 @@ __RCSID("$NetBSD: params.c,v 1.15 2006/03/17 13:58:27 elad Exp $");
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <err.h> #include <err.h>
#include <util.h>
#include "params.h" #include "params.h"
#include "pkcs5_pbkdf2.h" #include "pkcs5_pbkdf2.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: pkcs5_pbkdf2.c,v 1.8 2006/05/11 00:40:54 mrg Exp $ */ /* $NetBSD: pkcs5_pbkdf2.c,v 1.9 2006/08/26 18:14:28 christos Exp $ */
/*- /*-
* Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@ -53,7 +53,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: pkcs5_pbkdf2.c,v 1.8 2006/05/11 00:40:54 mrg Exp $"); __RCSID("$NetBSD: pkcs5_pbkdf2.c,v 1.9 2006/08/26 18:14:28 christos Exp $");
#endif #endif
#include <sys/resource.h> #include <sys/resource.h>
@ -61,6 +61,8 @@ __RCSID("$NetBSD: pkcs5_pbkdf2.c,v 1.8 2006/05/11 00:40:54 mrg Exp $");
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <err.h>
#include <util.h>
#include <openssl/hmac.h> #include <openssl/hmac.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: utils.c,v 1.14 2006/05/11 00:42:08 mrg Exp $ */ /* $NetBSD: utils.c,v 1.15 2006/08/26 18:14:28 christos Exp $ */
/*- /*-
* Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: utils.c,v 1.14 2006/05/11 00:42:08 mrg Exp $"); __RCSID("$NetBSD: utils.c,v 1.15 2006/08/26 18:14:28 christos Exp $");
#endif #endif
#include <sys/param.h> #include <sys/param.h>
@ -46,6 +46,7 @@ __RCSID("$NetBSD: utils.c,v 1.14 2006/05/11 00:42:08 mrg Exp $");
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <err.h> #include <err.h>
#include <util.h>
/* include the resolver gunk in order that we can use b64 routines */ /* include the resolver gunk in order that we can use b64 routines */
#include <netinet/in.h> #include <netinet/in.h>
@ -55,33 +56,6 @@ __RCSID("$NetBSD: utils.c,v 1.14 2006/05/11 00:42:08 mrg Exp $");
#include "utils.h" #include "utils.h"
void *
emalloc(size_t len)
{
void *ptr = malloc(len);
if (ptr == NULL)
err(1, NULL);
return ptr;
}
void *
ecalloc(size_t nel, size_t len)
{
void *ptr = calloc(nel, len);
if (ptr == NULL)
err(1, NULL);
return ptr;
}
char *
estrdup(const char *str)
{
char *ptr = strdup(str);
if (ptr == NULL)
err(1, NULL);
return ptr;
}
/* just strsep(3), but skips empty fields. */ /* just strsep(3), but skips empty fields. */
static char * static char *

View File

@ -1,4 +1,4 @@
/* $NetBSD: utils.h,v 1.5 2005/03/30 17:10:18 christos Exp $ */ /* $NetBSD: utils.h,v 1.6 2006/08/26 18:14:28 christos Exp $ */
/*- /*-
* Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@ -50,9 +50,6 @@ struct bits;
typedef struct bits bits_t; typedef struct bits bits_t;
__BEGIN_DECLS __BEGIN_DECLS
void *emalloc(size_t);
void *ecalloc(size_t, size_t);
char *estrdup(const char *);
char **words(const char *, int *); char **words(const char *, int *);
void words_free(char **, int); void words_free(char **, int);

View File

@ -1,7 +1,10 @@
# $NetBSD: Makefile,v 1.16 2004/08/19 23:02:51 christos Exp $ # $NetBSD: Makefile,v 1.17 2006/08/26 18:14:28 christos Exp $
PROG= fsck PROG= fsck
SRCS= fsck.c fsutil.c preen.c SRCS= fsck.c fsutil.c preen.c
MAN= fsck.8 MAN= fsck.8
LDADD+=-lutil
DPADD+=${LIBUTIL}
.include <bsd.prog.mk> .include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: fsck.c,v 1.42 2006/03/20 01:27:44 christos Exp $ */ /* $NetBSD: fsck.c,v 1.43 2006/08/26 18:14:28 christos Exp $ */
/* /*
* Copyright (c) 1996 Christos Zoulas. All rights reserved. * Copyright (c) 1996 Christos Zoulas. All rights reserved.
@ -36,7 +36,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: fsck.c,v 1.42 2006/03/20 01:27:44 christos Exp $"); __RCSID("$NetBSD: fsck.c,v 1.43 2006/08/26 18:14:28 christos Exp $");
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -59,6 +59,7 @@ __RCSID("$NetBSD: fsck.c,v 1.42 2006/03/20 01:27:44 christos Exp $");
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <util.h>
#include "pathnames.h" #include "pathnames.h"
#include "fsutil.h" #include "fsutil.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: fsutil.c,v 1.15 2006/06/05 16:52:05 christos Exp $ */ /* $NetBSD: fsutil.c,v 1.16 2006/08/26 18:14:28 christos Exp $ */
/* /*
* Copyright (c) 1990, 1993 * Copyright (c) 1990, 1993
@ -31,7 +31,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: fsutil.c,v 1.15 2006/06/05 16:52:05 christos Exp $"); __RCSID("$NetBSD: fsutil.c,v 1.16 2006/08/26 18:14:28 christos Exp $");
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -242,39 +242,3 @@ retry:
*/ */
return (origname); return (origname);
} }
void *
emalloc(size_t s)
{
void *p;
p = malloc(s);
if (p == NULL)
err(1, "malloc failed");
return (p);
}
void *
erealloc(void *p, size_t s)
{
void *q;
q = realloc(p, s);
if (q == NULL)
err(1, "realloc failed");
return (q);
}
char *
estrdup(const char *s)
{
char *p;
p = strdup(s);
if (p == NULL)
err(1, "strdup failed");
return (p);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: fsutil.h,v 1.11 2006/06/05 16:52:05 christos Exp $ */ /* $NetBSD: fsutil.h,v 1.12 2006/08/26 18:14:28 christos Exp $ */
/* /*
* Copyright (c) 1996 Christos Zoulas. All rights reserved. * Copyright (c) 1996 Christos Zoulas. All rights reserved.
@ -49,9 +49,6 @@ const char *blockcheck(const char *);
const char *cdevname(void); const char *cdevname(void);
void setcdevname(const char *, int); void setcdevname(const char *, int);
int hotroot(void); int hotroot(void);
void *emalloc(size_t);
void *erealloc(void *, size_t);
char *estrdup(const char *);
#define CHECK_PREEN 1 #define CHECK_PREEN 1
#define CHECK_VERBOSE 2 #define CHECK_VERBOSE 2

View File

@ -1,4 +1,4 @@
/* $NetBSD: preen.c,v 1.27 2005/01/13 22:56:09 christos Exp $ */ /* $NetBSD: preen.c,v 1.28 2006/08/26 18:14:28 christos Exp $ */
/* /*
* Copyright (c) 1990, 1993 * Copyright (c) 1990, 1993
@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95"; static char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95";
#else #else
__RCSID("$NetBSD: preen.c,v 1.27 2005/01/13 22:56:09 christos Exp $"); __RCSID("$NetBSD: preen.c,v 1.28 2006/08/26 18:14:28 christos Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -50,6 +50,7 @@ __RCSID("$NetBSD: preen.c,v 1.27 2005/01/13 22:56:09 christos Exp $");
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <util.h>
#include "fsutil.h" #include "fsutil.h"

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.12 2006/05/11 23:16:29 mrg Exp $ # $NetBSD: Makefile,v 1.13 2006/08/26 18:14:28 christos Exp $
# @(#)Makefile 8.1 (Berkeley) 6/5/93 # @(#)Makefile 8.1 (Berkeley) 6/5/93
.include <bsd.own.mk> .include <bsd.own.mk>
@ -13,6 +13,9 @@ CPPFLAGS+= -I${FSCK}
.include <bsd.prog.mk> .include <bsd.prog.mk>
LDADD+=-lutil
DPADD+=${LIBUTIL}
.if ${HAVE_GCC} == 4 .if ${HAVE_GCC} == 4
.for f in pass5 utilities .for f in pass5 utilities
COPTS.${f}.c+= -Wno-pointer-sign COPTS.${f}.c+= -Wno-pointer-sign

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.13 2006/07/18 23:37:13 perseant Exp $ # $NetBSD: Makefile,v 1.14 2006/08/26 18:14:28 christos Exp $
# @(#)Makefile 8.1 (Berkeley) 6/5/93 # @(#)Makefile 8.1 (Berkeley) 6/5/93
.include <bsd.own.mk> .include <bsd.own.mk>
@ -12,4 +12,7 @@ FSCK= ${NETBSDSRCDIR}/sbin/fsck
.PATH: ${NETBSDSRCDIR}/sys/ufs/lfs ${FSCK} .PATH: ${NETBSDSRCDIR}/sys/ufs/lfs ${FSCK}
CPPFLAGS+=-I${.CURDIR} -I${FSCK} -DIN_FSCK_LFS # -DVERBOSE_BLOCKMAP CPPFLAGS+=-I${.CURDIR} -I${FSCK} -DIN_FSCK_LFS # -DVERBOSE_BLOCKMAP
LDADD+=-lutil
DPADD+=${LIBUTIL}
.include <bsd.prog.mk> .include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.10 2005/01/20 16:39:23 xtraeme Exp $ # $NetBSD: Makefile,v 1.11 2006/08/26 18:14:28 christos Exp $
.include <bsd.own.mk> .include <bsd.own.mk>
@ -10,4 +10,7 @@ FSCK= ${NETBSDSRCDIR}/sbin/fsck
CPPFLAGS+= -I${FSCK} CPPFLAGS+= -I${FSCK}
.PATH: ${FSCK} .PATH: ${FSCK}
LDADD+=-lutil
DPADD+=${LIBUTIL}
.include <bsd.prog.mk> .include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: af_atalk.c,v 1.3 2006/06/16 23:48:35 elad Exp $ */ /* $NetBSD: af_atalk.c,v 1.4 2006/08/26 18:14:28 christos Exp $ */
/* /*
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@ -33,7 +33,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: af_atalk.c,v 1.3 2006/06/16 23:48:35 elad Exp $"); __RCSID("$NetBSD: af_atalk.c,v 1.4 2006/08/26 18:14:28 christos Exp $");
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -49,6 +49,7 @@ __RCSID("$NetBSD: af_atalk.c,v 1.3 2006/06/16 23:48:35 elad Exp $");
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <util.h>
#include "extern.h" #include "extern.h"
#include "af_atalk.h" #include "af_atalk.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: af_inet.c,v 1.3 2006/06/16 23:48:35 elad Exp $ */ /* $NetBSD: af_inet.c,v 1.4 2006/08/26 18:14:28 christos Exp $ */
/* /*
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@ -31,7 +31,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: af_inet.c,v 1.3 2006/06/16 23:48:35 elad Exp $"); __RCSID("$NetBSD: af_inet.c,v 1.4 2006/08/26 18:14:28 christos Exp $");
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -51,6 +51,7 @@ __RCSID("$NetBSD: af_inet.c,v 1.3 2006/06/16 23:48:35 elad Exp $");
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <util.h>
#include "extern.h" #include "extern.h"
#include "af_inet.h" #include "af_inet.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: af_inet6.c,v 1.4 2006/06/16 23:48:35 elad Exp $ */ /* $NetBSD: af_inet6.c,v 1.5 2006/08/26 18:14:28 christos Exp $ */
/* /*
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@ -31,7 +31,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: af_inet6.c,v 1.4 2006/06/16 23:48:35 elad Exp $"); __RCSID("$NetBSD: af_inet6.c,v 1.5 2006/08/26 18:14:28 christos Exp $");
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -50,6 +50,7 @@ __RCSID("$NetBSD: af_inet6.c,v 1.4 2006/06/16 23:48:35 elad Exp $");
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <util.h>
#include "extern.h" #include "extern.h"
#include "af_inet6.h" #include "af_inet6.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: af_iso.c,v 1.3 2006/06/16 23:48:35 elad Exp $ */ /* $NetBSD: af_iso.c,v 1.4 2006/08/26 18:14:28 christos Exp $ */
/* /*
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@ -33,7 +33,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: af_iso.c,v 1.3 2006/06/16 23:48:35 elad Exp $"); __RCSID("$NetBSD: af_iso.c,v 1.4 2006/08/26 18:14:28 christos Exp $");
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -54,6 +54,7 @@ __RCSID("$NetBSD: af_iso.c,v 1.3 2006/06/16 23:48:35 elad Exp $");
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <util.h>
#include "extern.h" #include "extern.h"
#include "af_iso.h" #include "af_iso.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.9 2006/06/16 23:48:35 elad Exp $ */ /* $NetBSD: extern.h,v 1.10 2006/08/26 18:14:28 christos Exp $ */
/* /*
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@ -70,4 +70,3 @@ const struct afswtch *lookup_af_bynum(int);
const char *get_string(const char *, const char *, u_int8_t *, int *); const char *get_string(const char *, const char *, u_int8_t *, int *);
void print_string(const u_int8_t *, int); void print_string(const u_int8_t *, int);
void getsock(int); void getsock(int);
void estrlcpy(char *, char *, size_t);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211.c,v 1.6 2006/06/16 23:48:35 elad Exp $ */ /* $NetBSD: ieee80211.c,v 1.7 2006/08/26 18:14:28 christos Exp $ */
/* /*
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@ -31,7 +31,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: ieee80211.c,v 1.6 2006/06/16 23:48:35 elad Exp $"); __RCSID("$NetBSD: ieee80211.c,v 1.7 2006/08/26 18:14:28 christos Exp $");
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -50,6 +50,7 @@ __RCSID("$NetBSD: ieee80211.c,v 1.6 2006/06/16 23:48:35 elad Exp $");
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <util.h>
#include "extern.h" #include "extern.h"
#include "ieee80211.h" #include "ieee80211.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: ifconfig.c,v 1.175 2006/08/26 16:59:27 matt Exp $ */ /* $NetBSD: ifconfig.c,v 1.176 2006/08/26 18:14:28 christos Exp $ */
/*- /*-
* Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc. * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@ -76,7 +76,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
#else #else
__RCSID("$NetBSD: ifconfig.c,v 1.175 2006/08/26 16:59:27 matt Exp $"); __RCSID("$NetBSD: ifconfig.c,v 1.176 2006/08/26 18:14:28 christos Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -1568,12 +1568,3 @@ usage(void)
progname, progname, progname, progname, progname, progname); progname, progname, progname, progname, progname, progname);
exit(1); exit(1);
} }
void
estrlcpy(char *dst, char *src, size_t len)
{
if (strlcpy(dst, src, len) >= len) {
errno = ENAMETOOLONG;
err(1, "Cannot copy `%s'", src);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tunnel.c,v 1.6 2006/06/16 23:48:35 elad Exp $ */ /* $NetBSD: tunnel.c,v 1.7 2006/08/26 18:14:28 christos Exp $ */
/* /*
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@ -31,7 +31,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: tunnel.c,v 1.6 2006/06/16 23:48:35 elad Exp $"); __RCSID("$NetBSD: tunnel.c,v 1.7 2006/08/26 18:14:28 christos Exp $");
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -50,6 +50,7 @@ __RCSID("$NetBSD: tunnel.c,v 1.6 2006/06/16 23:48:35 elad Exp $");
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <util.h>
#include "extern.h" #include "extern.h"
#include "tunnel.h" #include "tunnel.h"

View File

@ -1,7 +1,10 @@
# $NetBSD: Makefile,v 1.5 2005/06/27 01:00:06 christos Exp $ # $NetBSD: Makefile,v 1.6 2006/08/26 18:14:29 christos Exp $
PROG= rcorder PROG= rcorder
SRCS= ealloc.c hash.c rcorder.c SRCS= hash.c rcorder.c
MAN= rcorder.8 MAN= rcorder.8
LDADD+=-lutil
DPADD+=${LIBUTIL}
.include <bsd.prog.mk> .include <bsd.prog.mk>

View File

@ -1,149 +0,0 @@
/* $NetBSD: ealloc.c,v 1.3 2003/08/07 10:04:36 agc Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Adam de Boor.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Copyright (c) 1989 by Berkeley Softworks
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Adam de Boor.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: ealloc.c,v 1.3 2003/08/07 10:04:36 agc Exp $");
#endif /* not lint */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <err.h>
#include "ealloc.h"
static void enomem(void);
/*
* enomem --
* die when out of memory.
*/
static void
enomem(void)
{
errx(2, "Cannot allocate memory.");
}
/*
* emalloc --
* malloc, but die on error.
*/
void *
emalloc(size_t len)
{
void *p;
if ((p = malloc(len)) == NULL)
enomem();
return(p);
}
/*
* estrdup --
* strdup, but die on error.
*/
char *
estrdup(const char *str)
{
char *p;
if ((p = strdup(str)) == NULL)
enomem();
return(p);
}
/*
* erealloc --
* realloc, but die on error.
*/
void *
erealloc(void *ptr, size_t size)
{
if ((ptr = realloc(ptr, size)) == NULL)
enomem();
return(ptr);
}
/*
* ecalloc --
* calloc, but die on error.
*/
void *
ecalloc(size_t nmemb, size_t size)
{
void *ptr;
if ((ptr = calloc(nmemb, size)) == NULL)
enomem();
return(ptr);
}

View File

@ -1,6 +0,0 @@
/* $NetBSD: ealloc.h,v 1.2 2002/06/30 14:17:44 lukem Exp $ */
void *emalloc(size_t);
char *estrdup(const char *);
void *erealloc(void *, size_t);
void *ecalloc(size_t, size_t);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hash.c,v 1.3 2003/08/07 10:04:37 agc Exp $ */ /* $NetBSD: hash.c,v 1.4 2006/08/26 18:14:29 christos Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/ */
#ifdef MAKE_BOOTSTRAP #ifdef MAKE_BOOTSTRAP
static char rcsid[] = "$NetBSD: hash.c,v 1.3 2003/08/07 10:04:37 agc Exp $"; static char rcsid[] = "$NetBSD: hash.c,v 1.4 2006/08/26 18:14:29 christos Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)hash.c 8.1 (Berkeley) 6/6/93"; static char sccsid[] = "@(#)hash.c 8.1 (Berkeley) 6/6/93";
#else #else
__RCSID("$NetBSD: hash.c,v 1.3 2003/08/07 10:04:37 agc Exp $"); __RCSID("$NetBSD: hash.c,v 1.4 2006/08/26 18:14:29 christos Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -87,6 +87,8 @@ __RCSID("$NetBSD: hash.c,v 1.3 2003/08/07 10:04:37 agc Exp $");
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <err.h>
#include <util.h>
/* hash.c -- /* hash.c --
* *
@ -96,7 +98,6 @@ __RCSID("$NetBSD: hash.c,v 1.3 2003/08/07 10:04:37 agc Exp $");
* information increases. * information increases.
*/ */
#include "hash.h" #include "hash.h"
#include "ealloc.h"
/* /*
* Forward references to local procedures that are used before they're * Forward references to local procedures that are used before they're

View File

@ -1,4 +1,4 @@
/* $NetBSD: rcorder.c,v 1.13 2004/09/21 15:47:32 rumble Exp $ */ /* $NetBSD: rcorder.c,v 1.14 2006/08/26 18:14:29 christos Exp $ */
/* /*
* Copyright (c) 1998, 1999 Matthew R. Green * Copyright (c) 1998, 1999 Matthew R. Green
@ -66,8 +66,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <util.h>
#include "ealloc.h"
#include "hash.h" #include "hash.h"
#ifdef DEBUG #ifdef DEBUG