make including config.h always depend on HAVE_CONFIG_H; replace printf() by debug()

This commit is contained in:
marschap
2007-06-17 10:20:55 +00:00
parent 0e6b1253a9
commit 1899ff755c
24 changed files with 80 additions and 51 deletions
+3 -1
View File
@@ -14,7 +14,9 @@
#include <unistd.h>
#include <string.h>
#include "config.h"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "client.h"
#include "screenlist.h"
+4 -4
View File
@@ -17,15 +17,15 @@
#include <unistd.h>
#include <string.h>
#ifndef WIN32
#include <sys/errno.h>
#include <dlfcn.h>
# include <sys/errno.h>
# include <dlfcn.h>
#else
#include <windows.h>
# include <windows.h>
#endif
#include <string.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
# include "config.h"
#endif
#include "main.h" /* for timer */
+1 -1
View File
@@ -20,7 +20,7 @@
#include <sys/errno.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
# include "config.h"
#endif
#include "shared/LL.h"
+24 -17
View File
@@ -46,8 +46,7 @@
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include "config.h"
#include <errno.h> /* only required for debugging */
#if defined(HAVE_SYS_SELECT_H)
# include <sys/select.h>
@@ -56,7 +55,12 @@
# include <sys/types.h>
#endif /* defined(HAVE_SYS_SELECT_H) */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "CFontz633io.h"
#include "report.h"
#define TRY_AGAIN 0
@@ -75,7 +79,9 @@ static void send_packet(int fd, COMMAND_PACKET *out, COMMAND_PACKET *in);
static int get_crc(unsigned char *buf, int len, int seed);
static int test_packet(int fd, unsigned char response, COMMAND_PACKET *in);
static int check_for_packet(int fd, COMMAND_PACKET *in, unsigned char expected_length);
#ifdef DEBUG
static void print_packet(COMMAND_PACKET *packet);
#endif
/* global variables */
@@ -101,7 +107,7 @@ void EmptyKeyRing(KeyRing *kr)
int AddKeyToKeyRing(KeyRing *kr, unsigned char key)
{
if (((kr->head + 1) % KEYRINGSIZE) != (kr->tail % KEYRINGSIZE)) {
/* fprintf(stderr, "We add key: %d\n", key); */
debug(RPT_DEBUG, "%s: add key: %d", __FUNCTION__, key);
kr->contents[kr->head % KEYRINGSIZE] = key;
kr->head = (kr->head + 1) % KEYRINGSIZE;
@@ -125,7 +131,8 @@ unsigned char GetKeyFromKeyRing(KeyRing *kr)
kr->tail = (kr->tail + 1) % KEYRINGSIZE;
}
/* if (retval) fprintf(stderr, "We remove key: %d\n", retval); */
if (retval)
debug(RPT_DEBUG, "%s: remove key: %d", __FUNCTION__, retval);
return retval;
}
@@ -302,26 +309,25 @@ void SyncReceiveBuffer(ReceiveBuffer *rb, int fd, unsigned int number)
BytesRead = read(fd, buffer, number);
if (BytesRead == -1) {
/* this shouldnot happen with the select() above */
/* fprintf(stderr, "~~~Problem reading: %s .\n", strerror(errno)); */
/* this should not happen with the select() above */
debug(RPT_WARNING, "%s: ~~~Problem reading: %s", __FUNCTION__, strerror(errno));
}
else {
int i;
/* fprintf(stderr, "Read %d Bytes:", BytesRead); */
debug(RPT_DEBUG, "%s: read %d bytes:", __FUNCTION__, BytesRead);
/* wrap write pointer to the receive buffer */
rb->head %= RECEIVEBUFFERSIZE;
/* store the bytes read */
for (i = 0; i < BytesRead; i++) {
/* fprintf(stderr, " %02x", buffer[i]); */
debug(RPT_DEBUG, "%s: reading byte %02x", __FUNCTION__, buffer[i]);
rb->contents[rb->head] = buffer[i];
/* increment write pointer (wrap if needed) */
rb->head = (rb->head + 1) % RECEIVEBUFFERSIZE;
}
/* fprintf(stderr, "\n"); */
}
}
@@ -480,7 +486,7 @@ check_for_packet(int fd, COMMAND_PACKET *in, unsigned char expected_length)
//First off, there must be at least 4 bytes available in the input stream
//for there to be a valid command in it (command, length, no data, CRC).
if (BytesAvail(&receivebuffer) < 4) {
/* fprintf(stderr, "Not enough bytes available for even the smallest message.\n"); */
debug(RPT_INFO, "%s: not enough bytes available for even the smallest message", __FUNCTION__);
return(GIVE_UP); /* We don't need to retry before more byte are received */
}
@@ -494,7 +500,7 @@ check_for_packet(int fd, COMMAND_PACKET *in, unsigned char expected_length)
if (MAX_COMMAND < (0x3F & in->command)) {
/* Throw out one byte of garbage. Next pass through should re-sync. */
GetByte(&receivebuffer);
/* fprintf(stderr, "###: Unknown command.\n"); */
debug(RPT_INFO, "%s: unknown command", __FUNCTION__);
return(TRY_AGAIN);
}
@@ -505,7 +511,7 @@ check_for_packet(int fd, COMMAND_PACKET *in, unsigned char expected_length)
if (MAX_DATA_LENGTH < in->data_length) {
//Throw out one byte of garbage. Next pass through should re-sync.
GetByte(&receivebuffer);
/* fprintf(stderr, "###: Too long packet: %d.\n", in->data_length); */
debug(RPT_INFO, "%s: too long packet: %d", __FUNCTION__, in->data_length);
return(TRY_AGAIN);
}
@@ -514,7 +520,7 @@ check_for_packet(int fd, COMMAND_PACKET *in, unsigned char expected_length)
if ((int) PeekBytesAvail(&receivebuffer) < (in->data_length + 2)) {
//It looked like a valid start of a packet, but it does not look
//like the complete packet has been received yet.
/* fprintf(stderr, "Not enough read to check the complete message.\n"); */
debug(RPT_INFO, "%s: not enough read to check the complete message", __FUNCTION__);
return(GIVE_UP); /* Let's not return until more byte are available */
}
@@ -534,7 +540,7 @@ check_for_packet(int fd, COMMAND_PACKET *in, unsigned char expected_length)
//This is a good packet. Remove the packet from the serial buffer.
AcceptPeekedData(&receivebuffer);
//Let our caller know that incoming_command has good stuff in it.
/* print_packet(&outgoing_response); */
/* print_packet(in); */
return(GOOD_MSG);
}
@@ -543,12 +549,13 @@ check_for_packet(int fd, COMMAND_PACKET *in, unsigned char expected_length)
* Next pass through should re-sync.
*/
GetByte(&receivebuffer);
/* fprintf(stderr, "###: Wrong CheckSum. computed/real %04x:%04x \n",
testcrc, incoming_command.crc); */
debug(RPT_INFO, "%s: wrong CheckSum: computed %04x / real %04x",
__FUNCTION__, testcrc, in->crc);
return(TRY_AGAIN);
}
#ifdef DEBUG
/*
* This is a debugging function.
* It should be removed or compiled in conditionally.
@@ -571,4 +578,4 @@ print_packet(COMMAND_PACKET *packet)
fprintf(stderr, " ] %02x %02x .\n", packet->crc & 0xFF, (packet->crc >> 8) & 0xFF);
}
#endif /* DEBUG */
+1 -1
View File
@@ -217,7 +217,7 @@ EyeboxOne_init (Driver *drvthis)
/* keypad test mode? */
if (drvthis->config_get_bool(drvthis->name, "keypad_test_mode", 0, 0)) {
fprintf( stdout, "EyeBO: Entering keypad test mode...\n");
fprintf(stdout, "EyeBO: Entering keypad test mode...\n");
p->keypad_test_mode = 1;
stay_in_foreground = 1;
}
+1 -1
View File
@@ -311,7 +311,7 @@ MtxOrb_init (Driver *drvthis)
/* keypad test mode? */
if (drvthis->config_get_bool(drvthis->name, "keypad_test_mode", 0, 0)) {
fprintf( stdout, "MtxOrb: Entering keypad test mode...\n");
fprintf(stdout, "MtxOrb: Entering keypad test mode...\n");
p->keypad_test_mode = 1;
stay_in_foreground = 1;
}
+5 -1
View File
@@ -2,7 +2,7 @@
/* Copyright (C) 1999 David Glaude loosely based on workmanir.c */
/* workmanir.c - test/demo of LIBIR's high level command functions */
/* Copyright (C) 1998 Tom Wheeley, see file COPYING for details */
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
@@ -22,6 +22,10 @@
#define NAME_LENGTH 128
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "lcd.h"
#include "irmanin.h"
#include "report.h"
+1 -1
View File
@@ -5,7 +5,7 @@
#include "lcd.h"
#ifdef HAVE_CONFIG_H
# include <config.h>
# include "config.h"
#endif
+4 -1
View File
@@ -20,7 +20,6 @@
*
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h> /* for semaphore functions */
@@ -28,6 +27,10 @@
#include <sys/sem.h>
#include <errno.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "lcd_sem.h"
// according to X/OPEN we have to define it ourselves
+1 -1
View File
@@ -464,7 +464,7 @@ lis_init(Driver *drvthis)
err = ftdi_usb_open(&p->ftdic, p->VendorID, p->ProductID);
if (err < 0) {
report(RPT_ERR, "%s: cannot open USB device %x:%x",
drvthis->name
drvthis->name,
p->VendorID,
p->ProductID);
goto err_framebuf;
+1 -1
View File
@@ -52,7 +52,7 @@ not be in this file but in lpt-port.h ...
#define PORT_H
#ifdef HAVE_CONFIG_H
# include <config.h>
# include "config.h"
#endif
#include <stdio.h>
+2 -2
View File
@@ -897,7 +897,7 @@ pyramid_icon (Driver *drvthis, int x, int y, int icon)
//
// Leaving this in the code as notification for other similar cases
if (p->custom == bign) {
printf("Switching to beat\n");
debug(RPT_DEBUG, "%s: Switching to beat", __FUNCTION__);
p->custom = beat;
}
#endif
@@ -958,7 +958,7 @@ pyramid_icon (Driver *drvthis, int x, int y, int icon)
break;
default:
printf("x=%d, y=%d, icon=%x\n", x,y,icon);
debug(RPT_INFO, "%s: x=%d, y=%d, icon=%x", __FUNCTION__, x, y, icon);
return -1;
}
return 0;
+3 -1
View File
@@ -29,7 +29,9 @@
#include <vga.h>
#include <vgagl.h>
#include "config.h"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "lcd.h"
#include "report.h"
+3 -1
View File
@@ -25,7 +25,9 @@
*
*/
#include "config.h"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
+3 -1
View File
@@ -29,7 +29,9 @@
#include <unistd.h>
#include <assert.h>
#include "config.h"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "menuitem.h"
#include "menu.h"
+1 -1
View File
@@ -19,7 +19,7 @@
#include <string.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
# include "config.h"
#endif
#include "shared/report.h"
+4 -2
View File
@@ -13,13 +13,15 @@
*
*/
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "shared/report.h"
+1 -1
View File
@@ -5,7 +5,7 @@
#include <stdio.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#include "config.h"
#endif
/* DEBUGGING
+1 -1
View File
@@ -26,7 +26,7 @@
#endif
#ifdef HAVE_CONFIG_H
# include <config.h>
# include "config.h"
#else
# if !defined __STDC__ || !__STDC__
/* This is a separate conditional since some stdc systems
+1 -1
View File
@@ -19,7 +19,7 @@
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#include "config.h"
#else
#if !defined __STDC__ || !__STDC__
/* This is a separate conditional since some stdc systems
+1 -1
View File
@@ -56,7 +56,7 @@
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
# include "config.h"
#endif
#include <stdarg.h>
+3 -1
View File
@@ -218,7 +218,9 @@
* the fact that this work is dual licensed.
*/
#include "config.h"
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
/* Define HAVE_SNPRINTF if your system already has snprintf and vsnprintf.
*
+1 -1
View File
@@ -5,7 +5,7 @@
#define PORTABLE_SNPRINTF_VERSION_MINOR 2
#ifdef HAVE_CONFIG_H
#include <config.h>
# include "config.h"
#endif
#ifdef HAVE_SNPRINTF
+10 -7
View File
@@ -1,4 +1,3 @@
#include "config.h"
#include <unistd.h>
#include <stddef.h>
#include <stdio.h>
@@ -7,17 +6,21 @@
#include <stdlib.h>
#include <sys/types.h>
#ifndef WINSOCK2
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
# include <sys/socket.h>
# include <sys/un.h>
# include <netinet/in.h>
# include <netdb.h>
# include <arpa/inet.h>
#else
#include <winsock2.h>
# include <winsock2.h>
#endif
#include <stdarg.h>
#include <fcntl.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "report.h"
#include "sockets.h"