diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2002-11-13 11:50:54 +0000 |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2002-11-13 11:50:54 +0000 |
commit | 9e009c4b1128352c6039d25b39213fd480e9b055 (patch) | |
tree | e1495ef4ada6f8e092e20bc474195719f1b2b4aa /plugins/utils.c | |
parent | 9728dcad931d1c442a6d8e3e6765e2d9870600d1 (diff) | |
download | monitoring-plugins-9e009c4b1128352c6039d25b39213fd480e9b055.tar.gz |
remove call_getopt and asprintf
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@190 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/utils.c')
-rw-r--r-- | plugins/utils.c | 67 |
1 files changed, 0 insertions, 67 deletions
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); @@ -496,72 +495,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 * the provided delimiter is copied. * |