X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/6982ac2612c12af9fa65437bf4279007d734cc59..7fe9b0b742d7dae9c5af1d292d11840b5c3cbfae:/client/ui.c diff --git a/client/ui.c b/client/ui.c new file mode 100644 index 00000000..9f4377c8 --- /dev/null +++ b/client/ui.c @@ -0,0 +1,54 @@ +#include +#include +#include + +#include "ui.h" + +double CursorScaleFactor; +int PlotGridX, PlotGridY; +int offline; + +static char *logfilename = "proxmark3.log"; + +void PrintAndLog(char *fmt, ...) +{ + va_list argptr, argptr2; + static FILE *logfile = NULL; + static int logging=1; + + if (logging && !logfile) { + logfile=fopen(logfilename, "a"); + if (!logfile) { + fprintf(stderr, "Can't open logfile, logging disabled!\n"); + logging=0; + } + } + + va_start(argptr, fmt); + va_copy(argptr2, argptr); + vprintf(fmt, argptr); + va_end(argptr); + printf("\n"); + if (logging && logfile) { +#if 0 + char zeit[25]; + time_t jetzt_t; + struct tm *jetzt; + + jetzt_t = time(NULL); + jetzt = localtime(&jetzt_t); + strftime(zeit, 25, "%b %e %T", jetzt); + + fprintf(logfile,"%s ", zeit); +#endif + vfprintf(logfile, fmt, argptr2); + fprintf(logfile,"\n"); + fflush(logfile); + } + va_end(argptr2); +} + +void SetLogFilename(char *fn) +{ + logfilename = fn; +}