{"no-defaults",'n',"Return an empty string (useful for scripts)",
0,0,0,GET_NO_ARG,NO_ARG,0,0,0,0,0,0},
{"help",'?',"Display this help message and exit.",
0,0,0,GET_NO_ARG,NO_ARG,0,0,0,0,0,0},
{"version",'V',"Output version information and exit.",
0,0,0,GET_NO_ARG,NO_ARG,0,0,0,0,0,0},
{0,0,0,0,0,0,GET_NO_ARG,NO_ARG,0,0,0,0,0,0}
};
staticvoidusage(my_boolversion)
{
printf("%s Ver 1.3 for %s at %s\n",my_progname,SYSTEM_TYPE,
printf("%s Ver 1.4 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE);
if(version)
return;
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
puts("Prints all arguments that is give to some program using the default files");
{"silent",'s',"Only print the error message",0,0,0,GET_NO_ARG,NO_ARG,
0,0,0,0,0,0},
{"verbose",'v',"Print error code and message (default).",(gptr*)&verbose,
(gptr*)&verbose,0,GET_BOOL,NO_ARG,1,0,0,0,0,0},
{"version",'V',"Displays version information and exits.",
0,0,0,GET_NO_ARG,NO_ARG,0,0,0,0,0,0},
{0,0,0,0,0,0,GET_NO_ARG,NO_ARG,0,0,0,0,0,0}
};
typedefstructha_errors{
interrcode;
constchar*msg;
}HA_ERRORS;
staticintverbose=1,print_all_codes=0;
staticHA_ERRORSha_errlist[]=
{
...
...
@@ -99,57 +109,43 @@ static void usage(void)
printf("Print a description for a system error code or a error code from\na MyISAM/ISAM/BDB table handler.\n");
printf("If you want to get the error for a negative error code, you should use\n-- before the first error code to tell perror that there was no more options.\n\n");
/* Resolves IP's to hostname and hostnames to IP's */
#define RESOLVE_VERSION "2.0"
#define RESOLVE_VERSION "2.1"
#include <my_global.h>
#include <m_ctype.h>
...
...
@@ -30,7 +30,7 @@
#endif
#include <arpa/inet.h>
#include <netdb.h>
#include <getopt.h>
#include <my_getopt.h>
#ifdef SCO
#undef h_errno
...
...
@@ -42,15 +42,19 @@ extern int h_errno;
#endif
staticintsilent=0;
staticmy_boolsilent;
staticstructoptionlong_options[]=
staticstructmy_optionmy_long_options[]=
{
{"help",no_argument,0,'?'},
{"info",no_argument,0,'I'},
{"silent",no_argument,0,'s'},
{"version",no_argument,0,'V'},
{0,0,0,0}
{"help",'?',"Displays this help and exits.",
0,0,0,GET_NO_ARG,NO_ARG,0,0,0,0,0,0},
{"info",'I',"Synonym for --help",
0,0,0,GET_NO_ARG,NO_ARG,0,0,0,0,0,0},
{"silent",'s',"Be more silent.",(gptr*)&silent,(gptr*)&silent,
0,GET_BOOL,NO_ARG,0,0,0,0,0,0},
{"version",'V',"Displays version information and exits.",
0,0,0,GET_NO_ARG,NO_ARG,0,0,0,0,0,0},
{0,0,0,0,0,0,GET_NO_ARG,NO_ARG,0,0,0,0,0,0}
};
...
...
@@ -67,41 +71,39 @@ static void usage(void)
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
puts("Get hostname based on IP-address or IP-address based on hostname.\n");
printf("Usage: %s [OPTIONS] hostname or IP-address\n",my_progname);
printf("\n\
-?, --help Displays this help and exits.\n\
-I, --info Synonym for the above.\n\
-s, --silent Be more silent.\n\
-V, --version Displays version information and exits.\n");