* man2hlp.c: Include <glib.h> and use g_snprintf()/g_vsnprintf()

instead of sprintf()/vsprintf().
This commit is contained in:
Andrew V. Samoilov 2002-10-15 15:38:15 +00:00
parent cd456a3042
commit f8cf5b28bf
2 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,9 @@
2002-10-15 Andrew V. Samoilov <sav@bcs.zp.ua>
* Makefile.am (man2hlp_LDADD): Set to $(GLIB_LIBS).
* man2hlp.c: Include <glib.h> and use g_snprintf()/g_vsnprintf()
instead of sprintf()/vsprintf().
* man2hlp.c: Report about stale links.
2002-10-13 Pavel Roskin <proski@gnu.org>

View File

@ -23,6 +23,7 @@
#include <stdarg.h>
#include <string.h>
#include <glib.h>
#include "help.h"
#define BUFFER_SIZE 256
@ -131,7 +132,8 @@ fopen_check (const char *filename, const char *flags)
f = fopen (filename, flags);
if (f == NULL) {
sprintf (tmp, "man2hlp: Cannot open file \"%s\"", filename);
g_snprintf (tmp, sizeof (tmp), "man2hlp: Cannot open file \"%s\"",
filename);
perror (tmp);
exit (3);
}
@ -269,7 +271,7 @@ printf_string (const char *format, ...)
char buffer[BUFFER_SIZE];
va_start (args, format);
vsprintf (buffer, format, args);
g_vsnprintf (buffer, sizeof (buffer), format, args);
va_end (args);
print_string (buffer);
}
@ -752,7 +754,8 @@ main (int argc, char **argv)
}
}
if (!found) {
sprintf (buffer, "Stale link \"%s\"", current_link->linkname);
g_snprintf (buffer, sizeof (buffer), "Stale link \"%s\"",
current_link->linkname);
c_in = current_link->filename;
in_row = current_link->line;
print_error (buffer);