#include "timestamp.h"
#include "amxml.h"
#include "physmem.h"
+#include <getopt.h>
#define BUFFER_SIZE 32768
void
usage(void)
{
- g_printf(_("Usage: amcheck [-am] [-w] [-sclt] [-M <address>] [-o configoption]* <conf> [host [disk]* ]*\n"));
+ g_printf(_("Usage: amcheck [--version] [-am] [-w] [-sclt] [-M <address>] [--client-verbose] [-o configoption]* <conf> [host [disk]* ]*\n"));
exit(1);
/*NOTREACHED*/
}
static char *displayunit;
static long int unitdivisor;
+static int client_verbose = FALSE;
+static struct option long_options[] = {
+ {"client-verbose", 0, NULL, 1},
+ {"version" , 0, NULL, 2},
+ {NULL, 0, NULL, 0}
+};
+
int
main(
int argc,
int do_clientchk, client_probs;
int do_localchk, do_tapechk, server_probs;
pid_t clientchk_pid, serverchk_pid;
- int opt, tempfd, mainfd;
+ int tempfd, mainfd;
size_t size;
amwait_t retstat;
pid_t pid;
/* process arguments */
cfg_ovr = new_config_overrides(argc/2);
- while((opt = getopt(argc, argv, "M:mawsclto:")) != EOF) {
- switch(opt) {
+ while (1) {
+ int option_index = 0;
+ int c;
+ c = getopt_long (argc, argv, "M:mawsclto:", long_options, &option_index);
+ if (c == -1) {
+ break;
+ }
+
+ switch(c) {
+ case 1: client_verbose = TRUE;
+ break;
+ case 2: printf("amcheck-%s\n", VERSION);
+ return(0);
+ break;
case 'M': if (mailto) {
g_printf(_("Multiple -M options\n"));
exit(1);
char *t;
int ch;
int tch;
+ gboolean printed_hostname = FALSE;
hostp = (am_host_t *)datap;
hostp->up = HOST_READY;
continue;
}
+ if (client_verbose && !printed_hostname) {
+ g_fprintf(outf, "HOST %s\n", hostp->hostname);
+ printed_hostname = TRUE;
+ }
+
if(strncmp_const(line, "OK ") == 0) {
+ if (client_verbose) {
+ g_fprintf(outf, "%s\n", line);
+ }
continue;
}