unify quotation in error messages

Use quote() from gnulib to do this.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2015-12-04 21:21:13 +00:00
parent d6486e7730
commit 15802d6648
No known key found for this signature in database
GPG key ID: A9553245FDE9B739
4 changed files with 13 additions and 6 deletions

View file

@ -32,6 +32,7 @@ gnulib_modules="
langinfo
netinet_in
progname
quote
realloc-gnu
stat
stddef

View file

@ -49,6 +49,7 @@
#include "closeout.h"
#include "error.h"
#include "progname.h"
#include "quote.h"
#include "xalloc.h"
#include "dhcpd-pools.h"
@ -81,7 +82,7 @@ static int return_limit(const char c)
if ('0' <= c && c < '8')
return c - '0';
clean_up();
error(EXIT_FAILURE, 0, "return_limit: output mask '%s' is illegal", optarg);
error(EXIT_FAILURE, 0, "return_limit: output mask %s is illegal", quote(optarg));
return 0;
}
@ -241,7 +242,7 @@ int main(int argc, char **argv)
/* Print help */
usage(EXIT_SUCCESS);
default:
error(EXIT_FAILURE, 0, "Try `%s --help' for more information.",
error(EXIT_FAILURE, 0, "Try %s --help for more information.",
program_name);
}
}
@ -284,7 +285,7 @@ int main(int argc, char **argv)
break;
default:
clean_up();
error(EXIT_FAILURE, 0, "main: unknown output format '%c'", print_mac_addreses_tmp[0]);
error(EXIT_FAILURE, 0, "unknown output format: %s", quote(print_mac_addreses_tmp));
}
/* Do the job */
set_ipv_functions(IPvUNKNOWN);

View file

@ -51,6 +51,7 @@
#include "error.h"
#include "progname.h"
#include "quote.h"
#include "dhcpd-pools.h"
#include "defaults.h"
@ -378,7 +379,7 @@ double strtod_or_err(const char *restrict str, const char *restrict errmesg)
goto err;
return num;
err:
error(EXIT_FAILURE, errno, "%s: '%s'", errmesg, str);
error(EXIT_FAILURE, errno, "%s: %s", errmesg, quote(str));
return 0;
}

View file

@ -46,6 +46,7 @@
#include "error.h"
#include "progname.h"
#include "quote.h"
#include "dhcpd-pools.h"
@ -236,8 +237,11 @@ comparer_t field_selector(char c)
case 'e':
return comp_tcperc;
default:
clean_up();
error(EXIT_FAILURE, 0, "field_selector: unknown sort order `%c'", c);
{
char str[2] = { c, '\0' };
clean_up();
error(EXIT_FAILURE, 0, "field_selector: unknown sort order: %s", quote(str));
}
}
return NULL;
}