/* This file is part of Grot. -*- c -*-
Copyright (C) 2009, 2010 Sergey Poznyakoff
Grot is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
Grot is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with grot. If not, see . */
#include "grot.h"
#include
#define gettext(s) s
#define _(s) gettext(s)
#define N_(s) s
char *grot_host;
char *grot_password;
int password_option;
unsigned grot_port;
char *grot_socket;
char *grot_user;
int verbose;
int dry_run_option;
int flush_logs_option = 1;
size_t keep_count;
OPTIONS_BEGIN(gnu, "grot",
[])
OPTION(host,H,[NAME],
[])
BEGIN
grot_host = optarg;
END
OPTION(password,p,[PASS],
[])
BEGIN
grot_password = optarg;
password_option = 1;
END
OPTION(port,P,NUMBER,
[])
BEGIN
char *p;
grot_port = strtoul(optarg, &p, 10);
if (!grot_port || *p)
terror(1, NULL, "invalid port number: %s", optarg);
END
OPTION(socket,S,STRING,
[])
BEGIN
grot_socket = optarg;
END
OPTION(user,u,NAME,
[])
BEGIN
grot_user = optarg;
END
OPTION(verbose,v,,
[])
BEGIN
verbose++;
END
OPTION(dry-run,n,,
[])
BEGIN
dry_run_option = 1;
verbose++;
END
OPTION(no-flush,,,
[])
BEGIN
flush_logs_option = 0;
END
OPTION(keep,k,NUMBER,
[])
BEGIN
char *p;
keep_count = strtoul(optarg, &p, 0);
if (*p)
terror(1, NULL, "invalid number: %s", optarg);
END
OPTIONS_END
void
read_options(int argc, char *argv[])
{
GETOPT(argc, argv)
}