/* $RCSfile: util.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:29 $
*
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999,
* 2000, 2001, by Larry Wall and others
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
*
* $Log: util.c,v $
*/
#include "EXTERN.h"
#include "a2p.h"
#include "INTERN.h"
#include "util.h"
#include <stdarg.h>
#define FLUSH
/* paranoid version of malloc */
{
/* malloc(0) is NASTY on some systems */
#ifdef DEBUGGING
if (debug & 128)
#endif
return ptr;
else {
exit(1);
}
/*NOTREACHED*/
return 0;
}
/* paranoid version of realloc */
{
/* realloc(0) is NASTY on some systems */
#ifdef DEBUGGING
if (debug & 128) {
}
#endif
return ptr;
else {
exit(1);
}
/*NOTREACHED*/
return 0;
}
/* safe version of free */
{
#ifdef DEBUGGING
if (debug & 128)
#endif
}
/* safe version of string copy */
char *
{
*dest = '\0';
return to;
}
/* copy a string up to some (non-backslashed) delimiter, if any */
char *
{
if (*from == '\\') {
from++;
}
break;
}
*to = '\0';
return from;
}
char *
{
if (*from == '\\')
else if (*from == '$')
*to++ = '\\';
break;
}
*to = '\0';
return from;
}
/* return ptr to little string in big string, NULL if not found */
char *
{
register char *t, *s, *x;
for (t = big; *t; t++) {
for (x=t,s=little; *s; x++,s++) {
if (!*x)
return Nullch;
if (*s != *x)
break;
}
if (!*s)
return t;
}
return Nullch;
}
/* copy a string to a safe spot */
char *
{
return newaddr;
}
/* grow a static string to at least a certain length */
void
{
if (*curlen)
else
}
}
void
{
#if defined(HAS_VPRINTF)
#else
#endif
exit(1);
}
void
{
#if defined(HAS_VPRINTF)
#else
#endif
exit(1);
}
#if defined(DARWIN)
__private_extern__ /* warn() conflicts with libc */
#endif
void
{
#if defined(HAS_VPRINTF)
#else
#endif
}