diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2024-11-14 19:35:45 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2024-11-14 19:35:45 +0100 |
commit | df5520aa2dae5b3ce7abf8733dcdd152898af163 (patch) | |
tree | 00d3047bfb14f682bfb5a21010c731ed649bfed7 /app/bin/lprintf.c | |
parent | df247efec654e512242e4f4f1b0212034f9e01fe (diff) | |
parent | ec3c0f6f6e7153fa797dc57a0e95779cbc63a23b (diff) |
Merge branch 'release/debian/1_5.3.0GA-1'debian/1_5.3.0GA-1
Diffstat (limited to 'app/bin/lprintf.c')
-rw-r--r-- | app/bin/lprintf.c | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/app/bin/lprintf.c b/app/bin/lprintf.c index 23cc44a..0989ec9 100644 --- a/app/bin/lprintf.c +++ b/app/bin/lprintf.c @@ -17,26 +17,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> -#ifndef WINDOWS -#include <time.h> -#else -#include <time.h> -#include <sys/timeb.h> -#endif - #include "custom.h" #include "fileio.h" -#include "messages.h" #include "paths.h" #include "track.h" +#include "common-ui.h" /**************************************************************************** @@ -58,8 +46,9 @@ static void LogInit( void ) { int inx=0; - if ( logTable_da.cnt != 0 ) + if ( logTable_da.cnt != 0 ) { return; + } DYNARR_APPEND( logTable_t, logTable_da,10); logTable(inx).name = ""; logTable(inx).level = 0; @@ -86,14 +75,17 @@ static void LogDoOpen( void ) if ( logFileName ) { logFile = fopen( logFileName, "a" ); if ( logFile == NULL ) { - NoticeMessage( MSG_OPEN_FAIL, "Continue", NULL, "Log", logFileName, strerror(errno) ); + NoticeMessage( MSG_OPEN_FAIL, "Continue", NULL, "Log", logFileName, + strerror(errno) ); perror( logFileName ); return; } } - fprintf( logFile, "# %s Version: %s, Date: %s\n", sProdName, sVersion, ctime(&logClock) ); - if ( recordF ) + fprintf( logFile, "# %s Version: %s, Date: %s\n", sProdName, sVersion, + ctime(&logClock) ); + if ( recordF ) { fprintf( recordF, "# LOG CLOCK %s\n", ctime(&logClock) ); + } } EXPORT void LogClose( void ) @@ -102,10 +94,11 @@ EXPORT void LogClose( void ) if ( logFile ) { time(&clock); fprintf( logFile, "LOG END %s\n", ctime(&clock) ); - if ( logFile != stdout ) + if ( logFile != stdout ) { fclose( logFile ); - } - logFile = NULL; + } + } + logFile = NULL; } EXPORT void LogSet( char * name, int level ) @@ -117,26 +110,28 @@ EXPORT void LogSet( char * name, int level ) } -EXPORT int LogFindIndex( char * name ) +EXPORT int LogFindIndex( const char * name ) { int inx; for ( inx=0; inx<logTable_da.cnt; inx++ ) - if ( strcasecmp( logTable(inx).name, name ) == 0 ) + if ( strcasecmp( logTable(inx).name, name ) == 0 ) { return inx; + } return 0; } EXPORT void LogPrintf( - char * format, - ... ) + const char * format, + ... ) { va_list ap; if (!logInitted) { LogDoOpen(); logInitted = TRUE; } - if ( logFile == NULL ) + if ( logFile == NULL ) { return; + } logLineNumber++; if ( logLineNumber % 100 == 0 ) { if ( recordF ) { |