2 * User FTP Server, Share folders over FTP without being root.
3 * Copyright (C) 2008 Isaac Jurado
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option) any later
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
34 * Logging utility. Display a printf()-like formatted message (msg, args) with
35 * the current PID and a severity label at the beginning of the line. If
36 * show_error is true, append a human readable version of the last system error.
38 static void message ( int show_error
,
47 printf("(%5d) [%-7s] ", (int) getpid(), severity
);
50 if (show_error
&& error_code
!= 0)
51 printf(": %s.\n", strerror(error_code
));
58 * Debug message. Only enabled for debug compilations.
61 void debug (const char *msg
, ...)
66 message(0, "DEBUG", msg
, args
);
73 * Informational message.
75 void notice (const char *msg
, ...)
80 message(0, "NOTICE", msg
, args
);
86 * Program error message.
88 void warning (const char *msg
, ...)
93 message(0, "WARNING", msg
, args
);
99 * System error message. Displays system error information when the last error
102 void error (const char *msg
, ...)
107 message(1, "ERROR", msg
, args
);
113 * Fatal error. Displays a message similar to error() but also terminates the
116 void fatal (const char *msg
, ...)
121 message(1, "FATAL", msg
, args
);