dd31d057ff171ad47c1c0be31a25b4c5d3f24553
* Copyright (c) 1992 Diomidis Spinellis.
* Copyright (c) 1992 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* Diomidis Spinellis of Imperial College, University of London.
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)misc.c 5.2 (Berkeley) %G%";
* malloc with result test
if ((p
= malloc(size
)) == NULL
)
err(FATAL
, "%s", strerror(errno
));
* realloc with result test
if (p
== NULL
) /* Compatibility hack. */
if ((p
= realloc(p
, size
)) == NULL
)
err(FATAL
, "%s", strerror(errno
));
* Return a string for a regular expression error passed. This is a overkill,
* because of the silly semantics of regerror (we can never know the size of
strregerror(errcode
, preg
)
s
= regerror(errcode
, preg
, "", 0);
(void)regerror(errcode
, preg
, oe
, s
);
* Error reporting function
err(int severity
, const char *fmt
, ...)
err(severity
, fmt
, va_alist
)
(void)fprintf(stderr
, "sed: ");
(void)fprintf(stderr
, "%s(%lu): ", fname
, linenum
);
(void)vfprintf(stderr
, fmt
, ap
);
(void)fprintf(stderr
, "\n");