diff options
Diffstat (limited to 'src/netcalc.c')
| -rw-r--r-- | src/netcalc.c | 75 |
1 files changed, 19 insertions, 56 deletions
diff --git a/src/netcalc.c b/src/netcalc.c index 35629e4..2a0a744 100644 --- a/src/netcalc.c +++ b/src/netcalc.c | |||
| @@ -71,27 +71,6 @@ | |||
| 71 | 71 | ||
| 72 | /////////////////// | 72 | /////////////////// |
| 73 | // // | 73 | // // |
| 74 | // i18l Support // | ||
| 75 | // // | ||
| 76 | /////////////////// | ||
| 77 | |||
| 78 | #undef HAVE_GETTEXT | ||
| 79 | #ifdef HAVE_GETTEXT | ||
| 80 | # include <gettext.h> | ||
| 81 | # include <libintl.h> | ||
| 82 | # define _(String) gettext (String) | ||
| 83 | # define gettext_noop(String) String | ||
| 84 | # define N_(String) gettext_noop (String) | ||
| 85 | #else | ||
| 86 | # define _(String) (String) | ||
| 87 | # define N_(String) String | ||
| 88 | # define textdomain(Domain) | ||
| 89 | # define bindtextdomain(Package, Directory) | ||
| 90 | #endif | ||
| 91 | |||
| 92 | |||
| 93 | /////////////////// | ||
| 94 | // // | ||
| 95 | // Definitions // | 74 | // Definitions // |
| 96 | // // | 75 | // // |
| 97 | /////////////////// | 76 | /////////////////// |
| @@ -233,20 +212,14 @@ int netcalc_is_ipv4(const char * str, uint64_t * ipv4_ptr, uint64_t * cidrp) | |||
| 233 | /// displays usage | 212 | /// displays usage |
| 234 | void netcalc_usage(void) | 213 | void netcalc_usage(void) |
| 235 | { | 214 | { |
| 236 | // TRANSLATORS: The following strings provide usage for command. These | 215 | printf("Usage: %s [OPTIONS] address1 address2 ... addressN\n", PROGRAM_NAME); |
| 237 | // strings are displayed if the program is passed `--help' on the command | 216 | printf(" -a display all matching networks\n"); |
| 238 | // line. The two strings referenced are: PROGRAM_NAME, and | 217 | printf(" -c num requested network size in CIDR notation\n"); |
| 239 | // PACKAGE_BUGREPORT | 218 | printf(" -h, --help print this help and exit\n"); |
| 240 | printf(_("Usage: %s [OPTIONS] address1 address2 ... addressN\n" | 219 | printf(" -i num requested network size in amount of IP addresses\n"); |
| 241 | " -a display all matching networks\n" | 220 | printf(" -V, --version print version number and exit\n"); |
| 242 | " -c num requested network size in CIDR notation\n" | 221 | printf("\n"); |
| 243 | " -h, --help print this help and exit\n" | 222 | printf("Report bugs to <%s>.\n", PACKAGE_BUGREPORT); |
| 244 | " -i num requested network size in amount of IP addresses\n" | ||
| 245 | " -V, --version print version number and exit\n" | ||
| 246 | "\n" | ||
| 247 | "Report bugs to <%s>.\n" | ||
| 248 | ), PROGRAM_NAME, PACKAGE_BUGREPORT | ||
| 249 | ); | ||
| 250 | return; | 223 | return; |
| 251 | } | 224 | } |
| 252 | 225 | ||
| @@ -254,18 +227,12 @@ void netcalc_usage(void) | |||
| 254 | /// displays version information | 227 | /// displays version information |
| 255 | void netcalc_version(void) | 228 | void netcalc_version(void) |
| 256 | { | 229 | { |
| 257 | // TRANSLATORS: The following strings provide version and copyright | 230 | printf("%s (%s) %s\n", PROGRAM_NAME, PACKAGE_NAME, PACKAGE_VERSION); |
| 258 | // information if the program is passed --version on the command line. | 231 | printf("Written by David M. Syzdek.\n"); |
| 259 | // The three strings referenced are: PROGRAM_NAME, PACKAGE_NAME, | 232 | printf("\n"); |
| 260 | // PACKAGE_VERSION. | 233 | printf("%s\n", PACKAGE_COPYRIGHT); |
| 261 | printf(_("%s (%s) %s\n" | 234 | printf("This is free software; see the source for copying conditions. There is NO\n"); |
| 262 | "Written by David M. Syzdek.\n" | 235 | printf("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"); |
| 263 | "\n" | ||
| 264 | "%s\n" | ||
| 265 | "This is free software; see the source for copying conditions. There is NO\n" | ||
| 266 | "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" | ||
| 267 | ), PROGRAM_NAME, PACKAGE_NAME, PACKAGE_VERSION, PACKAGE_COPYRIGHT | ||
| 268 | ); | ||
| 269 | return; | 236 | return; |
| 270 | } | 237 | } |
| 271 | 238 | ||
| @@ -324,23 +291,19 @@ int main(int argc, char * argv[]) | |||
| 324 | netcalc_version(); | 291 | netcalc_version(); |
| 325 | return(0); | 292 | return(0); |
| 326 | case '?': | 293 | case '?': |
| 327 | fprintf(stderr, _("Try `%s --help' for more information.\n"), PROGRAM_NAME); | 294 | fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME); |
| 328 | return(1); | 295 | return(1); |
| 329 | default: | 296 | default: |
| 330 | fprintf(stderr, _("%s: unrecognized option `--%c'\n" | 297 | fprintf(stderr, "%s: unrecognized option `--%c'\n", PROGRAM_NAME, c); |
| 331 | "Try `%s --help' for more information.\n" | 298 | fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME); |
| 332 | ), PROGRAM_NAME, c, PROGRAM_NAME | ||
| 333 | ); | ||
| 334 | return(1); | 299 | return(1); |
| 335 | }; | 300 | }; |
| 336 | }; | 301 | }; |
| 337 | 302 | ||
| 338 | if (optind >= argc) | 303 | if (optind >= argc) |
| 339 | { | 304 | { |
| 340 | fprintf(stderr, _("%s: missing required argument\n" | 305 | fprintf(stderr, "%s: missing required argument\n", PROGRAM_NAME); |
| 341 | "Try `%s --help' for more information.\n" | 306 | fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME); |
| 342 | ), PROGRAM_NAME, PROGRAM_NAME | ||
| 343 | ); | ||
| 344 | return(1); | 307 | return(1); |
| 345 | }; | 308 | }; |
| 346 | 309 | ||
