From 9e009c4b1128352c6039d25b39213fd480e9b055 Mon Sep 17 00:00:00 2001 From: Karl DeBisschop Date: Wed, 13 Nov 2002 11:50:54 +0000 Subject: remove call_getopt and asprintf git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@190 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/utils.c | 67 --------------------------------------------------------- 1 file changed, 67 deletions(-) (limited to 'plugins/utils.c') diff --git a/plugins/utils.c b/plugins/utils.c index bf1d2047..5dc6cfdb 100644 --- a/plugins/utils.c +++ b/plugins/utils.c @@ -50,7 +50,6 @@ void strip (char *); char *strscpy (char *dest, const char *src); char *strscat (char *dest, const char *src); char *strnl (char *str); -char *ssprintf (char *str, const char *fmt, ...); char *strpcpy (char *dest, const char *src, const char *str); char *strpcat (char *dest, const char *src, const char *str); @@ -494,72 +493,6 @@ strnl (char *str) -/****************************************************************************** - * - * Does a formatted print to a string variable - * - * Given a pointer destination string, which may or may not already - * hold some text, and a source string with additional text (possibly - * NULL or empty), returns a pointer to a string that cntains the - * results of the specified formatted print - * - * Example: - * - * char *str=NULL; - * str = ssprintf(str,"%d %s",1,"string"); - * - *****************************************************************************/ - -char * -ssprintf (char *ptr, const char *fmt, ...) -{ - va_list ap; - int nchars; - size_t size; - char *str = NULL; - - if (str == NULL) { - str = malloc (TXTBLK); - if (str == NULL) - terminate (STATE_UNKNOWN, "malloc failed in ssprintf"); - size = TXTBLK; - } - else - size = max (strlen (str), TXTBLK); - - va_start (ap, fmt); - - while (1) { - - nchars = vsnprintf (str, size, fmt, ap); - - if (nchars > -1) - if (nchars < (int) size) { - va_end (ap); - str[nchars] = '\0'; - if (ptr) - free (ptr); - return str; - } - else { - size = (size_t) (nchars + 1); - } - - else - size *= 2; - - str = realloc (str, size); - - if (str == NULL) - terminate (STATE_UNKNOWN, "realloc failed in ssprintf"); - } - -} - - - - - /****************************************************************************** * * Like strscpy, except only the portion of the source string up to -- cgit v1.2.3