| 1 |
/* |
| 2 |
* avarice - The "avarice" program. |
| 3 |
* Copyright (C) 2001 Scott Finneran |
| 4 |
* Copyright (C) 2002 Intel Corporation |
| 5 |
* |
| 6 |
* This program is free software; you can redistribute it and/or modify |
| 7 |
* it under the terms of the GNU General Public License Version 2 |
| 8 |
* as published by the Free Software Foundation. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program; if not, write to the Free Software |
| 17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. |
| 18 |
* |
| 19 |
*/ |
| 20 |
|
| 21 |
#include <stdio.h> |
| 22 |
#include <stdarg.h> |
| 23 |
#include <errno.h> |
| 24 |
#include <stdlib.h> |
| 25 |
#include <string.h> |
| 26 |
|
| 27 |
#include "avarice.h" |
| 28 |
#include "remote.h" |
| 29 |
|
| 30 |
bool debugMode = false; |
| 31 |
|
| 32 |
void vdebugOut(const char *fmt, va_list args) |
| 33 |
{ |
| 34 |
if (debugMode) |
| 35 |
{ |
| 36 |
(void)vfprintf(stderr, fmt, args); |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
void debugOut(const char *fmt, ...) |
| 41 |
{ |
| 42 |
va_list args; |
| 43 |
va_start(args, fmt); |
| 44 |
vdebugOut(fmt, args); |
| 45 |
va_end(args); |
| 46 |
} |
| 47 |
|
| 48 |
void vstatusOut(const char *fmt, va_list args) |
| 49 |
{ |
| 50 |
vprintf(fmt, args); |
| 51 |
} |
| 52 |
|
| 53 |
void statusOut(const char *fmt, ...) |
| 54 |
{ |
| 55 |
va_list args; |
| 56 |
va_start(args, fmt); |
| 57 |
vstatusOut(fmt, args); |
| 58 |
va_end(args); |
| 59 |
} |
| 60 |
|
| 61 |
void statusFlush() |
| 62 |
{ |
| 63 |
fflush(stdout); |
| 64 |
} |
| 65 |
|
| 66 |
void unknownDevice(unsigned int devid, bool generic) |
| 67 |
{ |
| 68 |
fprintf(stderr, |
| 69 |
"Device ID 0x%04x is not known to AVaRICE.\n" |
| 70 |
"Please ask for it being added to the code", |
| 71 |
devid); |
| 72 |
if (generic) |
| 73 |
fprintf(stderr, |
| 74 |
", or use\n" |
| 75 |
"-P <device> to override the automatic decision.\n"); |
| 76 |
else |
| 77 |
fprintf(stderr, ".\n"); |
| 78 |
} |