]> cvs.zerfleddert.de Git - proxmark3-svn/blame - client/gui.c
Fixed some compile warnings in client, minor tidy up with some dbprintf statements
[proxmark3-svn] / client / gui.c
CommitLineData
6658905f 1#include <stdarg.h>
2#include <stdio.h>
3#include <time.h>
4
5#include "proxgui.h"
cd00aa30 6#include "prox.h"
6658905f 7
8int GraphBuffer[MAX_GRAPH_TRACE_LEN];
9int GraphTraceLen;
10double CursorScaleFactor;
f4434ad2 11int PlotGridX, PlotGridY;
6658905f 12int CommandFinished;
d722c4ce 13int offline;
6658905f 14
15static char *logfilename = "proxmark3.log";
16
17void PrintToScrollback(char *fmt, ...) {
5aad6db0 18 va_list argptr, argptr2;
6658905f 19 static FILE *logfile = NULL;
20 static int logging=1;
21
22 if (logging && !logfile) {
23 logfile=fopen(logfilename, "a");
24 if (!logfile) {
25 fprintf(stderr, "Can't open logfile, logging disabled!\n");
26 logging=0;
27 }
28 }
29
30 va_start(argptr, fmt);
5aad6db0 31 va_copy(argptr2, argptr);
6658905f 32 vprintf(fmt, argptr);
5aad6db0 33 va_end(argptr);
6658905f 34 printf("\n");
35 if (logging && logfile) {
36#if 0
37 char zeit[25];
38 time_t jetzt_t;
39 struct tm *jetzt;
40
41 jetzt_t = time(NULL);
42 jetzt = localtime(&jetzt_t);
43 strftime(zeit, 25, "%b %e %T", jetzt);
44
45 fprintf(logfile,"%s ", zeit);
46#endif
5aad6db0 47 vfprintf(logfile, fmt, argptr2);
6658905f 48 fprintf(logfile,"\n");
49 fflush(logfile);
50 }
5aad6db0 51 va_end(argptr2);
6658905f 52}
53
54void setlogfilename(char *fn)
55{
56 logfilename = fn;
57}
Impressum, Datenschutz