/* wydawca - automatic release submission daemon
Copyright (C) 2007-2020 Sergey Poznyakoff
Wydawca 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 of the License, or (at your
option) any later version.
Wydawca 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 wydawca. If not, see <http://www.gnu.org/licenses/>. */
#include "wydawca.h"
#include "sql.h"
static int create_directories;
static struct directory_metadata global_directory_metadata;
struct keyword {
char *name;
int tok;
};
enum {
CASE_SENSITIVE,
CASE_INSENSITIVE
};
static int
keyword_to_tok(const char *str, struct keyword *kw, int ci, int *pres)
{
for (; kw->name; kw++)
if ((ci ? strcasecmp : strcmp) (kw->name, str) == 0) {
*pres = kw->tok;
return 0;
}
return 1;
}
static int
tok_to_keyword(int tok, struct keyword *kw, const char **pres)
{
for (; kw->name; kw++)
if (kw->tok == tok) {
*pres = kw->name;
return 0;
}
return 1;
}
static struct keyword kwfac[] = {
{ "USER", LOG_USER },
{ "DAEMON", LOG_DAEMON },
{ "AUTH", LOG_AUTH },
{ "AUTHPRIV", LOG_AUTHPRIV },
{ "MAIL", LOG_MAIL },
{ "CRON", LOG_CRON },
{ "LOCAL0", LOG_LOCAL0 },
{ "LOCAL1", LOG_LOCAL1 },
{ "LOCAL2", LOG_LOCAL2 },
{ "LOCAL3", LOG_LOCAL3 },
{ "LOCAL
|