]>
git.zerfleddert.de Git - proxmark3-svn/blob - client/ui.c
1eb877d84e1a8875f203f53910bd5d1d910f1de4
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2009 Michael Gernoth <michael at gernoth.net>
3 // Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
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
8 //-----------------------------------------------------------------------------
10 //-----------------------------------------------------------------------------
16 #include <readline/readline.h>
20 double CursorScaleFactor
;
21 int PlotGridX
, PlotGridY
;
24 static char *logfilename
= "proxmark3.log";
26 void PrintAndLog(char *fmt
, ...)
30 va_list argptr
, argptr2
;
31 static FILE *logfile
= NULL
;
34 if (logging
&& !logfile
) {
35 logfile
=fopen(logfilename
, "a");
37 fprintf(stderr
, "Can't open logfile, logging disabled!\n");
42 int need_hack
= (rl_readline_state
& RL_STATE_READCMD
) > 0;
45 saved_point
= rl_point
;
46 saved_line
= rl_copy_text(0, rl_end
);
48 rl_replace_line("", 0);
52 va_start(argptr
, fmt
);
53 va_copy(argptr2
, argptr
);
55 vprintf(" ", 0); // cleaning prompt
61 rl_replace_line(saved_line
, 0);
62 rl_point
= saved_point
;
67 if (logging
&& logfile
) {
68 vfprintf(logfile
, fmt
, argptr2
);
69 fprintf(logfile
,"\n");
75 void SetLogFilename(char *fn
)