mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-12 13:30:19 +00:00
Applied patch from (Raja R Harinath <harinath@cs.umn.edu>) to add function
Wed Jan 21 01:13:25 1998 Tim Janik <timj@psynet.net> * Applied patch from (Raja R Harinath <harinath@cs.umn.edu>) to add function g_snprintf. * configure.in (AC_CHECK_FUNCS): Check for vsnprintf. * glib.h: Add prototype for g_snprintf. * glibconfig.h.in: Add HAVE_VSNPRINTF. * gutils.c (g_snprintf): new function.
This commit is contained in:
parent
18ee22d93b
commit
3ae8c300bb
@ -1,3 +1,12 @@
|
|||||||
|
Wed Jan 21 01:13:25 1998 Tim Janik <timj@psynet.net>
|
||||||
|
|
||||||
|
* Applied patch from (Raja R Harinath <harinath@cs.umn.edu>)
|
||||||
|
to add function g_snprintf.
|
||||||
|
* configure.in (AC_CHECK_FUNCS): Check for vsnprintf.
|
||||||
|
* glib.h: Add prototype for g_snprintf.
|
||||||
|
* glibconfig.h.in: Add HAVE_VSNPRINTF.
|
||||||
|
* gutils.c (g_snprintf): new function.
|
||||||
|
|
||||||
Sat Jan 17 23:52:40 1998 Owen Taylor <owt1@cornell.edu>
|
Sat Jan 17 23:52:40 1998 Owen Taylor <owt1@cornell.edu>
|
||||||
|
|
||||||
* gstring.{c,h} gscanner.c:
|
* gstring.{c,h} gscanner.c:
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#undef HAVE_SYS_SELECT_H
|
#undef HAVE_SYS_SELECT_H
|
||||||
#undef HAVE_STRERROR
|
#undef HAVE_STRERROR
|
||||||
#undef HAVE_STRSIGNAL
|
#undef HAVE_STRSIGNAL
|
||||||
|
#undef HAVE_VSNPRINTF
|
||||||
#undef HAVE_VALUES_H
|
#undef HAVE_VALUES_H
|
||||||
#undef HAVE_VPRINTF
|
#undef HAVE_VPRINTF
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ AC_CHECK_HEADERS(limits.h, AC_DEFINE(HAVE_LIMITS_H))
|
|||||||
AC_CHECK_HEADERS(values.h, AC_DEFINE(HAVE_VALUES_H))
|
AC_CHECK_HEADERS(values.h, AC_DEFINE(HAVE_VALUES_H))
|
||||||
|
|
||||||
# Check for strerror, strsignal, and memmove functions
|
# Check for strerror, strsignal, and memmove functions
|
||||||
AC_CHECK_FUNCS(strerror strsignal memmove)
|
AC_CHECK_FUNCS(strerror strsignal memmove vsnprintf)
|
||||||
|
|
||||||
# Check for sys_errlist
|
# Check for sys_errlist
|
||||||
AC_MSG_CHECKING(sys_errlist)
|
AC_MSG_CHECKING(sys_errlist)
|
||||||
|
@ -630,6 +630,8 @@ gchar* g_strconcat (const gchar *string1, ...); /* NULL terminated */
|
|||||||
gdouble g_strtod (const gchar *nptr, gchar **endptr);
|
gdouble g_strtod (const gchar *nptr, gchar **endptr);
|
||||||
gchar* g_strerror (gint errnum);
|
gchar* g_strerror (gint errnum);
|
||||||
gchar* g_strsignal (gint signum);
|
gchar* g_strsignal (gint signum);
|
||||||
|
gint g_snprintf (gchar *str, gulong n, gchar const *fmt, ...);
|
||||||
|
|
||||||
|
|
||||||
/* We make the assumption that if memmove isn't available, then
|
/* We make the assumption that if memmove isn't available, then
|
||||||
* bcopy will do the job. This isn't safe everywhere. (bcopy can't
|
* bcopy will do the job. This isn't safe everywhere. (bcopy can't
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#undef HAVE_SYS_SELECT_H
|
#undef HAVE_SYS_SELECT_H
|
||||||
#undef HAVE_STRERROR
|
#undef HAVE_STRERROR
|
||||||
#undef HAVE_STRSIGNAL
|
#undef HAVE_STRSIGNAL
|
||||||
|
#undef HAVE_VSNPRINTF
|
||||||
#undef HAVE_VALUES_H
|
#undef HAVE_VALUES_H
|
||||||
#undef HAVE_VPRINTF
|
#undef HAVE_VPRINTF
|
||||||
|
|
||||||
@ -61,6 +62,9 @@
|
|||||||
/* Define if you have the strsignal function. */
|
/* Define if you have the strsignal function. */
|
||||||
#undef HAVE_STRSIGNAL
|
#undef HAVE_STRSIGNAL
|
||||||
|
|
||||||
|
/* Define if you have the vsnprintf function. */
|
||||||
|
#undef HAVE_VSNPRINTF
|
||||||
|
|
||||||
/* Define if you have the <float.h> header file. */
|
/* Define if you have the <float.h> header file. */
|
||||||
#undef HAVE_FLOAT_H
|
#undef HAVE_FLOAT_H
|
||||||
|
|
||||||
|
@ -804,6 +804,41 @@ g_set_print_handler (GPrintFunc func)
|
|||||||
|
|
||||||
old_print_func = print_func;
|
old_print_func = print_func;
|
||||||
print_func = func;
|
print_func = func;
|
||||||
|
|
||||||
return old_print_func;
|
return old_print_func;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gint
|
||||||
|
g_snprintf (gchar *str,
|
||||||
|
gulong n,
|
||||||
|
gchar const *fmt,
|
||||||
|
...)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_VSNPRINTF
|
||||||
|
va_list args;
|
||||||
|
gint retval;
|
||||||
|
|
||||||
|
va_start (args, fmt);
|
||||||
|
retval = vsnprintf (str, n, fmt, args);
|
||||||
|
va_end (args);
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
|
||||||
|
#else
|
||||||
|
gchar *printed;
|
||||||
|
va_list args, args2;
|
||||||
|
|
||||||
|
va_start (args, fmt);
|
||||||
|
va_start (args2, fmt);
|
||||||
|
|
||||||
|
printed = g_vsprintf (fmt, &args, &args2);
|
||||||
|
strncpy (str, printed, n);
|
||||||
|
str[n-1] = '\0';
|
||||||
|
|
||||||
|
va_end (args2);
|
||||||
|
va_end (args);
|
||||||
|
|
||||||
|
return strlen (str);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user