]> git.zerfleddert.de Git - proxmark3-svn/blob - client/ui.c
f0fa8e733ab94ef08e7e3c2d15876fff7e8bbdbe
[proxmark3-svn] / client / ui.c
1 #include <stdarg.h>
2 #include <stdio.h>
3 #include <time.h>
4
5 #include "ui.h"
6
7 double CursorScaleFactor;
8 int PlotGridX, PlotGridY;
9 int offline;
10
11 static char *logfilename = "proxmark3.log";
12
13 void PrintAndLog(char *fmt, ...)
14 {
15 va_list argptr, argptr2;
16 static FILE *logfile = NULL;
17 static int logging=1;
18
19 if (logging && !logfile) {
20 logfile=fopen(logfilename, "a");
21 if (!logfile) {
22 fprintf(stderr, "Can't open logfile, logging disabled!\n");
23 logging=0;
24 }
25 }
26
27 va_start(argptr, fmt);
28 va_copy(argptr2, argptr);
29 vprintf(fmt, argptr);
30 va_end(argptr);
31 printf("\n");
32 if (logging && logfile) {
33 vfprintf(logfile, fmt, argptr2);
34 fprintf(logfile,"\n");
35 fflush(logfile);
36 }
37 va_end(argptr2);
38 }
39
40 void SetLogFilename(char *fn)
41 {
42 logfilename = fn;
43 }
Impressum, Datenschutz