]> git.zerfleddert.de Git - proxmark3-svn/blob - client/ui.c
iso14a reader patches [Hagen Fritsch]
[proxmark3-svn] / client / ui.c
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2009 Michael Gernoth <michael at gernoth.net>
3 // Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
4 //
5 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
6 // at your option, any later version. See the LICENSE.txt file for the text of
7 // the license.
8 //-----------------------------------------------------------------------------
9 // UI utilities
10 //-----------------------------------------------------------------------------
11
12 #include <stdarg.h>
13 #include <stdio.h>
14 #include <time.h>
15
16 #include "ui.h"
17
18 double CursorScaleFactor;
19 int PlotGridX, PlotGridY;
20 int offline;
21
22 static char *logfilename = "proxmark3.log";
23
24 void PrintAndLog(char *fmt, ...)
25 {
26 va_list argptr, argptr2;
27 static FILE *logfile = NULL;
28 static int logging=1;
29
30 if (logging && !logfile) {
31 logfile=fopen(logfilename, "a");
32 if (!logfile) {
33 fprintf(stderr, "Can't open logfile, logging disabled!\n");
34 logging=0;
35 }
36 }
37
38 va_start(argptr, fmt);
39 va_copy(argptr2, argptr);
40 vprintf(fmt, argptr);
41 va_end(argptr);
42 printf("\n");
43 if (logging && logfile) {
44 vfprintf(logfile, fmt, argptr2);
45 fprintf(logfile,"\n");
46 fflush(logfile);
47 }
48 va_end(argptr2);
49 }
50
51 void SetLogFilename(char *fn)
52 {
53 logfilename = fn;
54 }
Impressum, Datenschutz