From 46caa267c440bf634a5f5fb3781f744ea236c035 Mon Sep 17 00:00:00 2001 From: Erik Alexandre Pucci <eap08@c3sl.ufpr.br> Date: Wed, 11 Aug 2010 11:05:45 -0300 Subject: [PATCH] client.c: Replaced every "if (DEBUG)" by the new DEBUG macro The new DEBUG macro simplifies the use of debug messages, using only one line in code instead of the old if-then check followed by a printf. Signed-off-by: Erik Alexandre Pucci <eap08@c3sl.ufpr.br> Acked-by: Ricardo Tavares de Oliveira <rto07@c3sl.ufpr.br> Signed-off-by: Danilo K. S. Yorinori <danilok@c3sl.ufpr.br> --- src/client.c | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/src/client.c b/src/client.c index 3d0de65..8d29a86 100644 --- a/src/client.c +++ b/src/client.c @@ -61,10 +61,7 @@ int main(int argc, char **argv) basedir = (char *) malloc(sizeof(char) * (arglen - len + 1)); strncpy(basedir, argv[0], (arglen - len)); - if (DEBUG) - { - printf("Arg: %s basedir: %s\n", argv[0], basedir); - } + DEBUG("Arg: %s basedir: %s\n", argv[0], basedir); if ((option < 2) && (inep) && (inep[0] == '\0')) { @@ -318,11 +315,8 @@ static char *read_version_file(char *basedir) strcpy(filepath, basedir); strcat(filepath, VERSIONFILE); - if (DEBUG) - { - printf("Basedir: %s Versionfile: %s ", basedir, VERSIONFILE); - printf("Filepath %s\n", filepath); - } + DEBUG("Basedir: %s Versionfile: %s ", basedir, VERSIONFILE); + DEBUG("Filepath %s\n", filepath); /* Allocate memory for version text */ if ( ! (version = (char *) malloc(11 * sizeof(char))) ) @@ -365,10 +359,7 @@ void print_update_link(struct soap *soap, char *url) } /* Get update link from response */ - if (DEBUG) - { - printf("UpdateLink: %s\n", updateLink); - } + DEBUG("UpdateLink: %s\n", updateLink); /* Verify received update link and print appropriate messages */ if (updateLink == NULL) @@ -401,10 +392,7 @@ void check_version(struct soap *soap, char *url, char *clientVersion) exit(2); } - if (DEBUG) - { - printf("Version from server: %s\n", versionFromServer); - } + DEBUG("Version from server: %s\n", versionFromServer); /* Check server version string for errors */ if (versionFromServer == NULL) @@ -460,10 +448,7 @@ void availability(struct soap *soap, char *url, char *inep, char *macAddr) } /* Get availability result from response */ - if (DEBUG) - { - printf("AvailResult: %s\n",availResult); - } + DEBUG("AvailResult: %s\n", availResult); /* Verify response and print approriate message */ if (strcmp(availResult, "Success") == 0) @@ -500,10 +485,8 @@ char *read_xml_file(char *basedir) /* Construct filePath */ strcpy(filePath, basedir); strcat(filePath, COLLECTDATAFILE); - if (DEBUG) - { - printf("%s %s %s\n", basedir, COLLECTDATAFILE, filePath); - } + + DEBUG("%s %s %s\n", basedir, COLLECTDATAFILE, filePath); /* Open XML collect data file and check for errors */ xmlFile = fopen(filePath, "r"); @@ -558,10 +541,7 @@ void inventory(struct soap *soap, char *url, char *basedir) } /* Get inventory result from response */ - if (DEBUG) - { - printf("InvResult: %s\n", invResult); - } + DEBUG("InvResult: %s\n", invResult); /* Verify response and print appropriate message */ if (strcmp(invResult, "Success") == 0) -- GitLab