]> git.zerfleddert.de Git - proxmark3-svn/blob - client/ui.c
marcan's patch until he gets commit access. Remove C library's includes from the...
[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 // FIXME: ifndef not really nice...
14 // We should eventually get rid of it once
15 // we fully factorize the code between *nix and windows
16 // (using pthread and alikes...)
17 #ifndef WIN32
18 void PrintAndLog(char *fmt, ...)
19 {
20 va_list argptr, argptr2;
21 static FILE *logfile = NULL;
22 static int logging=1;
23
24 if (logging && !logfile) {
25 logfile=fopen(logfilename, "a");
26 if (!logfile) {
27 fprintf(stderr, "Can't open logfile, logging disabled!\n");
28 logging=0;
29 }
30 }
31
32 va_start(argptr, fmt);
33 va_copy(argptr2, argptr);
34 vprintf(fmt, argptr);
35 va_end(argptr);
36 printf("\n");
37 if (logging && logfile) {
38 vfprintf(logfile, fmt, argptr2);
39 fprintf(logfile,"\n");
40 fflush(logfile);
41 }
42 va_end(argptr2);
43 }
44 #endif
45
46 void SetLogFilename(char *fn)
47 {
48 logfilename = fn;
49 }
Impressum, Datenschutz