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