Commit 504f39ee authored by David Byers's avatar David Byers
Browse files

(locate_membership): Declared non-static to avoid conflict with membership.h.

(locate_member): Declared non-static to avoid conflict with membership.h.
(top level): Include crypt.h. Initialize oformat to -1.
(main): Added options to set kom-info fields.
(give_help): Added help for the new options.
parent 8fb8fbda
/*
* $Id: dbck.c,v 0.30 1996/02/25 20:46:58 ceder Exp $
* $Id: dbck.c,v 0.31 1996/06/09 13:54:24 byers Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1995 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -28,7 +28,7 @@
* Author: Per Cederqvist.
*/
static char *rcsid = "$Id: dbck.c,v 0.30 1996/02/25 20:46:58 ceder Exp $";
static char *rcsid = "$Id: dbck.c,v 0.31 1996/06/09 13:54:24 byers Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -41,7 +41,12 @@ USE(rcsid);
#endif
#include <time.h>
#include <sys/types.h>
#ifdef HAVE_CRYPT_H
# include <crypt.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "getopt.h"
#include "misc-types.h"
#include "s-string.h"
......@@ -60,6 +65,14 @@ USE(rcsid);
#include "manipulate.h"
#include "version-info.h"
#define OPT_PERS_PRESENTATION_CONF 1
#define OPT_CONF_PRESENTATION_CONF 2
#define OPT_MOTD_CONF 3
#define OPT_MOTD_OF_KOM 4
#define OPT_KOM_NEWS_CONF 5
static struct option longopts[] = {
{"compact-text-mass", 0, 0, 'g' },
{"interactive", 0, 0, 'i' },
......@@ -72,13 +85,20 @@ static struct option longopts[] = {
{"grant-all", required_argument, 0, 'G' },
{"output-version", required_argument, 0, 'o' },
{"force-output", 0, 0, 'F' },
{"pers-pres-conf", required_argument, 0,
OPT_PERS_PRESENTATION_CONF },
{"conf-pres-conf", required_argument, 0,
OPT_CONF_PRESENTATION_CONF },
{"motd-conf", required_argument, 0, OPT_MOTD_CONF },
{"motd-of-kom", required_argument, 0, OPT_MOTD_OF_KOM },
{"kom-news-conf", required_argument, 0, OPT_KOM_NEWS_CONF },
{"help", 0, 0, 'h' },
{ 0, 0, 0, 0 }
};
Info kom_info; /* Not used, but needed by server-config.o. */
Info kom_info;
struct kom_par param;
/* This is set to TRUE if init_cache finds out that the last part of the
......@@ -95,9 +115,18 @@ static Pers_no grant_all=0; /* Person which should receive all bits. */
/* The following variable holds the output format */
long oformat=0; /* Output format */
long oformat=-1; /* Output format */
long force_output=0; /* Force sync (for conversions) */
/* The following variables hold kom_info modifications */
int pers_pres_conf = -1;
int conf_pres_conf = -1;
int motd_conf = -1;
int motd_of_lyskom = -1;
int kom_news_conf = -1;
/* The following variable corresponds to the -c flag, and is
present here due to a bug in lyskomd 1.6.1. */
int unset_change_name_is_error=0;
......@@ -274,7 +303,7 @@ is_footnoted_in(Text_no parent,
return FALSE;
}
static Member *
Member *
locate_member(Pers_no pers_no,
Conference * conf_c)
{
......@@ -1078,7 +1107,7 @@ check_texts_in_conf(Conf_no cc,
return error;
}
static Membership *
Membership *
locate_membership(Conf_no conf_no,
Person * pers_p)
{
......@@ -1333,6 +1362,12 @@ give_help(const char *default_config)
puts(" -P --clear-password=pno "
"Set password to empty string for a user.");
puts(" -G --grant-all=pno Give a user all available privileges.");
puts(" --pers-pres-conf=N Set conference for user presentations.");
puts(" --conf-pres-conf=N Set conference for conference "
"presentations.");
puts(" --kom-news-conf=N Set conference for news about KOM.");
puts(" --motd-conf=N Set conference for lapps on the doors.");
puts(" --motd-of-kom=N Set KOM login message text.");
puts(" -h --help Display this help.");
puts("Note: the -P and -G options "
"also require a person number as argument");
......@@ -1361,6 +1396,36 @@ main (int argc,
{
switch (optc)
{
case OPT_PERS_PRESENTATION_CONF:
pers_pres_conf = atoi(optarg);
if (pers_pres_conf == 0)
restart_kom("%s: bad conference number %s", argv[0], optarg);
break;
case OPT_CONF_PRESENTATION_CONF:
conf_pres_conf = atoi(optarg);
if (conf_pres_conf == 0)
restart_kom("%s: bad conference number %s", argv[0], optarg);
break;
case OPT_MOTD_CONF:
motd_conf = atoi(optarg);
if (motd_conf == 0)
restart_kom("%s: bad conference number %s", argv[0], optarg);
break;
case OPT_MOTD_OF_KOM:
motd_of_lyskom = atoi(optarg);
if (motd_of_lyskom == 0 && *optarg != '0')
restart_kom("%s: bad text number %s", argv[0], optarg);
break;
case OPT_KOM_NEWS_CONF:
kom_news_conf = atoi(optarg);
if (kom_news_conf == 0)
restart_kom("%s: bad conference number %s", argv[0], optarg);
break;
#ifndef NDEBUG
case 'd':
buglevel++;
......@@ -1447,6 +1512,21 @@ main (int argc,
read_configuration(config_file);
sfree(default_config_file);
/*
* Override configuration with command-line options
*/
if (pers_pres_conf != -1)
kom_info.pers_pres_conf = pers_pres_conf;
if (conf_pres_conf != -1)
kom_info.conf_pres_conf = conf_pres_conf;
if (motd_conf != -1)
kom_info.motd_conf = motd_conf;
if (kom_news_conf != -1)
kom_info.kom_news_conf = kom_news_conf;
if (motd_of_lyskom != -1)
kom_info.motd_of_lyskom = motd_of_lyskom;
if (optind != argc)
restart_kom("%s: too many arguments. %s --help for usage.\n",
argv[0], argv[0]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment