Skip to content
Snippets Groups Projects
Commit 46caa267 authored by Erik Alexandre Pucci's avatar Erik Alexandre Pucci Committed by Danilo K. S. Yorinori
Browse files

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: default avatarErik Alexandre Pucci <eap08@c3sl.ufpr.br>
Acked-by: default avatarRicardo Tavares de Oliveira <rto07@c3sl.ufpr.br>
Signed-off-by: default avatarDanilo K. S. Yorinori <danilok@c3sl.ufpr.br>
parent 812e6f57
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment