]> git.zerfleddert.de Git - proxmark3-svn/blame - client/ui.c
marcan's patch until he gets commit access. Remove C library's includes from the...
[proxmark3-svn] / client / ui.c
CommitLineData
7fe9b0b7 1#include <stdarg.h>
2#include <stdio.h>
3#include <time.h>
4
5#include "ui.h"
6
7double CursorScaleFactor;
8int PlotGridX, PlotGridY;
9int offline;
10
11static char *logfilename = "proxmark3.log";
12
91c38cf7 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
7fe9b0b7 18void 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) {
7fe9b0b7 38 vfprintf(logfile, fmt, argptr2);
39 fprintf(logfile,"\n");
40 fflush(logfile);
41 }
42 va_end(argptr2);
43}
91c38cf7 44#endif
7fe9b0b7 45
46void SetLogFilename(char *fn)
47{
48 logfilename = fn;
49}
Impressum, Datenschutz