Commit 77a60365 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(main): Use get_default_config_file_name() to find the config file.

parent 3719d2c5
/*
* $Id: dbck.c,v 0.73 2003/07/12 22:26:32 ceder Exp $
* $Id: dbck.c,v 0.74 2003/08/15 19:46:27 ceder Exp $
* Copyright (C) 1991-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -1456,8 +1456,7 @@ main (int argc,
{
int hflag = 0;
int errors;
char *default_config_file;
char *config_file;
const char *config_file;
int optc;
int need_rw = 0;
int have_lock = 0;
......@@ -1602,25 +1601,19 @@ main (int argc,
}
}
/* Start reading in the configuration file. */
default_config_file = smalloc(strlen(DEFAULT_DBASE_DIR) +
strlen(CONFIG_FILE) + 2);
sprintf(default_config_file, "%s/%s", DEFAULT_DBASE_DIR, CONFIG_FILE);
/* Check if help was requested. */
if (hflag > 0)
give_help(default_config_file);
give_help(get_default_config_file_name());
/* Continue reading in the configuration file. */
if (optind < argc)
config_file = argv[optind++];
else
config_file = default_config_file;
config_file = get_default_config_file_name();
read_configuration(config_file);
sfree(default_config_file);
free_default_config_file_name();
/*
* Override configuration with command-line options
......
/*
* $Id: komrunning.c,v 1.8 2003/08/12 13:14:05 ceder Exp $
* $Id: komrunning.c,v 1.9 2003/08/15 19:46:22 ceder Exp $
* Copyright (C) 1999, 2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -147,8 +147,7 @@ int
main (int argc,
char **argv)
{
char *default_config_file = NULL;
char *config_file = NULL;
const char *config_file = NULL;
int bring_up = 0;
int bring_down = 0;
int i;
......@@ -208,12 +207,7 @@ main (int argc,
/* Read in the configuration file. */
if (config_file == NULL)
{
default_config_file = smalloc(strlen(DEFAULT_DBASE_DIR) +
strlen(CONFIG_FILE) + 2);
sprintf(default_config_file, "%s/%s", DEFAULT_DBASE_DIR, CONFIG_FILE);
config_file = default_config_file;
}
config_file = get_default_config_file_name();
read_configuration(config_file);
......@@ -263,6 +257,7 @@ main (int argc,
}
}
}
free_default_config_file_name();
return 0;
}
......@@ -285,8 +285,7 @@ main (int argc,
char **argv)
{
int i;
char *default_config_file = NULL;
char *config_file = NULL;
const char *config_file = NULL;
int fulldump = 0;
if (getuid() == 0 || geteuid() == 0)
......@@ -347,14 +346,10 @@ main (int argc,
/* Read in the configuration file. */
if (config_file == NULL)
{
default_config_file = smalloc(strlen(DEFAULT_DBASE_DIR) +
strlen(CONFIG_FILE) + 2);
sprintf(default_config_file, "%s/%s", DEFAULT_DBASE_DIR, CONFIG_FILE);
config_file = default_config_file;
}
config_file = get_default_config_file_name();
read_configuration(config_file);
free_default_config_file_name();
compute_filenames();
......
/*
* $Id: updateLysKOM.c,v 1.21 2003/08/12 13:14:20 ceder Exp $
* $Id: updateLysKOM.c,v 1.22 2003/08/15 19:45:51 ceder Exp $
* Copyright (C) 1994-1995, 1998-1999, 2001-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -175,8 +175,7 @@ main (int argc,
int i;
FILE *fp;
long pid;
char *default_config_file = NULL;
char *config_file = NULL;
const char *config_file = NULL;
if (getuid() == 0 || geteuid() == 0)
{
......@@ -225,14 +224,10 @@ main (int argc,
/* Read in the configuration file. */
if (config_file == NULL)
{
default_config_file = smalloc(strlen(DEFAULT_DBASE_DIR) +
strlen(CONFIG_FILE) + 2);
sprintf(default_config_file, "%s/%s", DEFAULT_DBASE_DIR, CONFIG_FILE);
config_file = default_config_file;
}
config_file = get_default_config_file_name();
read_configuration(config_file);
free_default_config_file_name();
pid = read_pid_file(param.pid_name, argv[0]);
if (pid == 1)
......
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