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