Found when trying to do a simple dbglog(__FUNCTION__);
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
* novm - log an error message saying we ran out of memory, and die.
*/
void
* novm - log an error message saying we ran out of memory, and die.
*/
void
{
fatal("Virtual memory exhausted allocating %s\n", msg);
}
{
fatal("Virtual memory exhausted allocating %s\n", msg);
}
static FILE *debugFile;
void
static FILE *debugFile;
void
+fatal(const char *fmt, ...)
{
va_list pvar;
va_start(pvar, fmt);
{
va_list pvar;
va_start(pvar, fmt);
+error(const char *fmt, ...)
{
va_list pvar;
va_start(pvar, fmt);
{
va_list pvar;
va_start(pvar, fmt);
+warn(const char *fmt, ...)
{
va_list pvar;
va_start(pvar, fmt);
{
va_list pvar;
va_start(pvar, fmt);
+info(const char *fmt, ...)
{
va_list pvar;
va_start(pvar, fmt);
{
va_list pvar;
va_start(pvar, fmt);
bool debug_on();
/* Safe sprintf++ */
bool debug_on();
/* Safe sprintf++ */
-int slprintf(char *, int, char *, ...);
+int slprintf(char *, int, const char *, ...);
-int vslprintf(char *, int, char *, va_list);
+int vslprintf(char *, int, const char *, va_list);
/* safe strcpy */
size_t strlcpy(char *, const char *, size_t);
/* safe strcpy */
size_t strlcpy(char *, const char *, size_t);
size_t strlcat(char *, const char *, size_t);
/* log a debug message */
size_t strlcat(char *, const char *, size_t);
/* log a debug message */
-void dbglog(char *, ...);
+void dbglog(const char *, ...);
/* log an informational message */
/* log an informational message */
+void info(const char *, ...);
/* log a notice-level message */
/* log a notice-level message */
-void notice(char *, ...);
+void notice(const char *, ...);
/* log a warning message */
/* log a warning message */
+void warn(const char *, ...);
/* log an error message */
/* log an error message */
-void error(char *, ...);
+void error(const char *, ...);
/* log an error message and die(1) */
/* log an error message and die(1) */
-void fatal(char *, ...);
+void fatal(const char *, ...);
/* Say we ran out of memory, and die */
/* Say we ran out of memory, and die */
+void novm(const char *);
/* Format a packet and log it with syslog */
void log_packet(unsigned char *, int, char *, int);
/* Format a packet and log it with syslog */
void log_packet(unsigned char *, int, char *, int);
extern char *strerror();
#endif
extern char *strerror();
#endif
-static void logit(int, char *, va_list);
+static void logit(int, const char *, va_list);
static void log_write(int, char *);
static void vslp_printer(void *, char *, ...);
static void format_packet(u_char *, int, printer_func, void *);
static void log_write(int, char *);
static void vslp_printer(void *, char *, ...);
static void format_packet(u_char *, int, printer_func, void *);
* Returns the number of chars put into buf.
*/
int
* Returns the number of chars put into buf.
*/
int
-slprintf(char *buf, int buflen, char *fmt, ...)
+slprintf(char *buf, int buflen, const char *fmt, ...)
#define OUTCHAR(c) (buflen > 0? (--buflen, *buf++ = (c)): 0)
int
#define OUTCHAR(c) (buflen > 0? (--buflen, *buf++ = (c)): 0)
int
-vslprintf(char *buf, int buflen, char *fmt, va_list args)
+vslprintf(char *buf, int buflen, const char *fmt, va_list args)
{
int c, i, n;
int width, prec, fillch;
int base, len, neg, quoted;
long lval = 0;
unsigned long val = 0;
{
int c, i, n;
int width, prec, fillch;
int base, len, neg, quoted;
long lval = 0;
unsigned long val = 0;
+ char *str, *buf0;
+ const char *f;
unsigned char *p;
char num[32];
time_t t;
unsigned char *p;
char num[32];
time_t t;
* logit - does the hard work for fatal et al.
*/
static void
* logit - does the hard work for fatal et al.
*/
static void
-logit(int level, char *fmt, va_list args)
+logit(int level, const char *fmt, va_list args)
* fatal - log an error message and die horribly.
*/
void
* fatal - log an error message and die horribly.
*/
void
+fatal(const char *fmt, ...)
* error - log an error message.
*/
void
* error - log an error message.
*/
void
+error(const char *fmt, ...)
* warn - log a warning message.
*/
void
* warn - log a warning message.
*/
void
+warn(const char *fmt, ...)
* notice - log a notice-level message.
*/
void
* notice - log a notice-level message.
*/
void
+notice(const char *fmt, ...)
* info - log an informational message.
*/
void
* info - log an informational message.
*/
void
+info(const char *fmt, ...)
* dbglog - log a debug message.
*/
void
* dbglog - log a debug message.
*/
void
+dbglog(const char *fmt, ...)