Clean up the variable handling code a little.
Write /etc/hosts in the right place.
This commit is contained in:
parent
a7f54e2e75
commit
395dda4194
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: config.c,v 1.7 1995/05/26 08:41:35 jkh Exp $
|
* $Id: config.c,v 1.8 1995/05/26 19:28:00 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -311,11 +311,6 @@ configResolv(void)
|
|||||||
fprintf(fp, "nameserver\t%s\n", getenv(VAR_NAMESERVER));
|
fprintf(fp, "nameserver\t%s\n", getenv(VAR_NAMESERVER));
|
||||||
msgNotify("Wrote /etc/resolv.conf");
|
msgNotify("Wrote /etc/resolv.conf");
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
if (getenv(VAR_IPADDR)) {
|
|
||||||
fp = fopen("/etc/hosts", "a");
|
|
||||||
fprintf(fp, "%s\t\t%s\n", getenv(VAR_IPADDR), getenv(VAR_HOSTNAME));
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
alreadyDone = TRUE;
|
alreadyDone = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: install.c,v 1.58 1995/05/26 10:20:46 jkh Exp $
|
* $Id: install.c,v 1.59 1995/05/26 10:32:28 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -220,12 +220,20 @@ static void
|
|||||||
installFinal(void)
|
installFinal(void)
|
||||||
{
|
{
|
||||||
static Boolean alreadyDone = FALSE;
|
static Boolean alreadyDone = FALSE;
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
if (alreadyDone)
|
if (alreadyDone)
|
||||||
return;
|
return;
|
||||||
configFstab();
|
configFstab();
|
||||||
configSysconfig();
|
configSysconfig();
|
||||||
configResolv();
|
configResolv();
|
||||||
|
|
||||||
|
/* Tack ourselves at the end of /etc/hosts */
|
||||||
|
if (getenv(VAR_IPADDR)) {
|
||||||
|
fp = fopen("/etc/hosts", "a");
|
||||||
|
fprintf(fp, "%s\t\t%s\n", getenv(VAR_IPADDR), getenv(VAR_HOSTNAME));
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
alreadyDone = TRUE;
|
alreadyDone = TRUE;
|
||||||
msgConfirm("Installation completed successfully.\nHit return now to go back to the main menu.");
|
msgConfirm("Installation completed successfully.\nHit return now to go back to the main menu.");
|
||||||
SystemWasInstalled = TRUE;
|
SystemWasInstalled = TRUE;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: variable.c,v 1.1 1995/05/01 21:56:32 jkh Exp $
|
* $Id: variable.c,v 1.2 1995/05/20 10:33:13 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -45,32 +45,11 @@
|
|||||||
|
|
||||||
/* Routines for dealing with variable lists */
|
/* Routines for dealing with variable lists */
|
||||||
|
|
||||||
void
|
static void
|
||||||
variable_set(char *var)
|
make_variable(char *var, char *value)
|
||||||
{
|
|
||||||
char tmp[VAR_NAME_MAX + VAR_VALUE_MAX], *cp;
|
|
||||||
Variable *newvar;
|
|
||||||
|
|
||||||
newvar = (Variable *)safe_malloc(sizeof(Variable));
|
|
||||||
strncpy(tmp, var, VAR_NAME_MAX + VAR_VALUE_MAX);
|
|
||||||
if ((cp = index(tmp, '=')) == NULL)
|
|
||||||
msgFatal("Invalid variable format: %s", var);
|
|
||||||
*cp = '\0';
|
|
||||||
strncpy(newvar->name, tmp, VAR_NAME_MAX);
|
|
||||||
strncpy(newvar->value, cp + 1, VAR_VALUE_MAX);
|
|
||||||
newvar->next = VarHead;
|
|
||||||
VarHead = newvar;
|
|
||||||
setenv(newvar->name, newvar->value, 1);
|
|
||||||
msgInfo("Set %s to %s", newvar->name, newvar->value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
variable_set2(char *var, char *value)
|
|
||||||
{
|
{
|
||||||
Variable *newvar;
|
Variable *newvar;
|
||||||
|
|
||||||
if (!var || !value)
|
|
||||||
msgFatal("Null name or value passed to set_variable2!");
|
|
||||||
setenv(var, value, 1);
|
setenv(var, value, 1);
|
||||||
newvar = (Variable *)safe_malloc(sizeof(Variable));
|
newvar = (Variable *)safe_malloc(sizeof(Variable));
|
||||||
strncpy(newvar->name, var, VAR_NAME_MAX);
|
strncpy(newvar->name, var, VAR_NAME_MAX);
|
||||||
@ -80,3 +59,25 @@ variable_set2(char *var, char *value)
|
|||||||
setenv(newvar->name, newvar->value, 1);
|
setenv(newvar->name, newvar->value, 1);
|
||||||
msgInfo("Set %s to %s", newvar->name, newvar->value);
|
msgInfo("Set %s to %s", newvar->name, newvar->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
variable_set(char *var)
|
||||||
|
{
|
||||||
|
char tmp[VAR_NAME_MAX + VAR_VALUE_MAX], *cp;
|
||||||
|
|
||||||
|
strncpy(tmp, var, VAR_NAME_MAX + VAR_VALUE_MAX);
|
||||||
|
if ((cp = index(tmp, '=')) == NULL)
|
||||||
|
msgFatal("Invalid variable format: %s", var);
|
||||||
|
*(cp++) = '\0';
|
||||||
|
make_variable(tmp, cp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
variable_set2(char *var, char *value)
|
||||||
|
{
|
||||||
|
Variable *newvar;
|
||||||
|
|
||||||
|
if (!var || !value)
|
||||||
|
msgFatal("Null name or value passed to set_variable2!");
|
||||||
|
make_variable(var, value);
|
||||||
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: config.c,v 1.7 1995/05/26 08:41:35 jkh Exp $
|
* $Id: config.c,v 1.8 1995/05/26 19:28:00 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -311,11 +311,6 @@ configResolv(void)
|
|||||||
fprintf(fp, "nameserver\t%s\n", getenv(VAR_NAMESERVER));
|
fprintf(fp, "nameserver\t%s\n", getenv(VAR_NAMESERVER));
|
||||||
msgNotify("Wrote /etc/resolv.conf");
|
msgNotify("Wrote /etc/resolv.conf");
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
if (getenv(VAR_IPADDR)) {
|
|
||||||
fp = fopen("/etc/hosts", "a");
|
|
||||||
fprintf(fp, "%s\t\t%s\n", getenv(VAR_IPADDR), getenv(VAR_HOSTNAME));
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
alreadyDone = TRUE;
|
alreadyDone = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: install.c,v 1.58 1995/05/26 10:20:46 jkh Exp $
|
* $Id: install.c,v 1.59 1995/05/26 10:32:28 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -220,12 +220,20 @@ static void
|
|||||||
installFinal(void)
|
installFinal(void)
|
||||||
{
|
{
|
||||||
static Boolean alreadyDone = FALSE;
|
static Boolean alreadyDone = FALSE;
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
if (alreadyDone)
|
if (alreadyDone)
|
||||||
return;
|
return;
|
||||||
configFstab();
|
configFstab();
|
||||||
configSysconfig();
|
configSysconfig();
|
||||||
configResolv();
|
configResolv();
|
||||||
|
|
||||||
|
/* Tack ourselves at the end of /etc/hosts */
|
||||||
|
if (getenv(VAR_IPADDR)) {
|
||||||
|
fp = fopen("/etc/hosts", "a");
|
||||||
|
fprintf(fp, "%s\t\t%s\n", getenv(VAR_IPADDR), getenv(VAR_HOSTNAME));
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
alreadyDone = TRUE;
|
alreadyDone = TRUE;
|
||||||
msgConfirm("Installation completed successfully.\nHit return now to go back to the main menu.");
|
msgConfirm("Installation completed successfully.\nHit return now to go back to the main menu.");
|
||||||
SystemWasInstalled = TRUE;
|
SystemWasInstalled = TRUE;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: variable.c,v 1.1 1995/05/01 21:56:32 jkh Exp $
|
* $Id: variable.c,v 1.2 1995/05/20 10:33:13 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -45,32 +45,11 @@
|
|||||||
|
|
||||||
/* Routines for dealing with variable lists */
|
/* Routines for dealing with variable lists */
|
||||||
|
|
||||||
void
|
static void
|
||||||
variable_set(char *var)
|
make_variable(char *var, char *value)
|
||||||
{
|
|
||||||
char tmp[VAR_NAME_MAX + VAR_VALUE_MAX], *cp;
|
|
||||||
Variable *newvar;
|
|
||||||
|
|
||||||
newvar = (Variable *)safe_malloc(sizeof(Variable));
|
|
||||||
strncpy(tmp, var, VAR_NAME_MAX + VAR_VALUE_MAX);
|
|
||||||
if ((cp = index(tmp, '=')) == NULL)
|
|
||||||
msgFatal("Invalid variable format: %s", var);
|
|
||||||
*cp = '\0';
|
|
||||||
strncpy(newvar->name, tmp, VAR_NAME_MAX);
|
|
||||||
strncpy(newvar->value, cp + 1, VAR_VALUE_MAX);
|
|
||||||
newvar->next = VarHead;
|
|
||||||
VarHead = newvar;
|
|
||||||
setenv(newvar->name, newvar->value, 1);
|
|
||||||
msgInfo("Set %s to %s", newvar->name, newvar->value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
variable_set2(char *var, char *value)
|
|
||||||
{
|
{
|
||||||
Variable *newvar;
|
Variable *newvar;
|
||||||
|
|
||||||
if (!var || !value)
|
|
||||||
msgFatal("Null name or value passed to set_variable2!");
|
|
||||||
setenv(var, value, 1);
|
setenv(var, value, 1);
|
||||||
newvar = (Variable *)safe_malloc(sizeof(Variable));
|
newvar = (Variable *)safe_malloc(sizeof(Variable));
|
||||||
strncpy(newvar->name, var, VAR_NAME_MAX);
|
strncpy(newvar->name, var, VAR_NAME_MAX);
|
||||||
@ -80,3 +59,25 @@ variable_set2(char *var, char *value)
|
|||||||
setenv(newvar->name, newvar->value, 1);
|
setenv(newvar->name, newvar->value, 1);
|
||||||
msgInfo("Set %s to %s", newvar->name, newvar->value);
|
msgInfo("Set %s to %s", newvar->name, newvar->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
variable_set(char *var)
|
||||||
|
{
|
||||||
|
char tmp[VAR_NAME_MAX + VAR_VALUE_MAX], *cp;
|
||||||
|
|
||||||
|
strncpy(tmp, var, VAR_NAME_MAX + VAR_VALUE_MAX);
|
||||||
|
if ((cp = index(tmp, '=')) == NULL)
|
||||||
|
msgFatal("Invalid variable format: %s", var);
|
||||||
|
*(cp++) = '\0';
|
||||||
|
make_variable(tmp, cp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
variable_set2(char *var, char *value)
|
||||||
|
{
|
||||||
|
Variable *newvar;
|
||||||
|
|
||||||
|
if (!var || !value)
|
||||||
|
msgFatal("Null name or value passed to set_variable2!");
|
||||||
|
make_variable(var, value);
|
||||||
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: config.c,v 1.7 1995/05/26 08:41:35 jkh Exp $
|
* $Id: config.c,v 1.8 1995/05/26 19:28:00 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -311,11 +311,6 @@ configResolv(void)
|
|||||||
fprintf(fp, "nameserver\t%s\n", getenv(VAR_NAMESERVER));
|
fprintf(fp, "nameserver\t%s\n", getenv(VAR_NAMESERVER));
|
||||||
msgNotify("Wrote /etc/resolv.conf");
|
msgNotify("Wrote /etc/resolv.conf");
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
if (getenv(VAR_IPADDR)) {
|
|
||||||
fp = fopen("/etc/hosts", "a");
|
|
||||||
fprintf(fp, "%s\t\t%s\n", getenv(VAR_IPADDR), getenv(VAR_HOSTNAME));
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
alreadyDone = TRUE;
|
alreadyDone = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: install.c,v 1.58 1995/05/26 10:20:46 jkh Exp $
|
* $Id: install.c,v 1.59 1995/05/26 10:32:28 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -220,12 +220,20 @@ static void
|
|||||||
installFinal(void)
|
installFinal(void)
|
||||||
{
|
{
|
||||||
static Boolean alreadyDone = FALSE;
|
static Boolean alreadyDone = FALSE;
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
if (alreadyDone)
|
if (alreadyDone)
|
||||||
return;
|
return;
|
||||||
configFstab();
|
configFstab();
|
||||||
configSysconfig();
|
configSysconfig();
|
||||||
configResolv();
|
configResolv();
|
||||||
|
|
||||||
|
/* Tack ourselves at the end of /etc/hosts */
|
||||||
|
if (getenv(VAR_IPADDR)) {
|
||||||
|
fp = fopen("/etc/hosts", "a");
|
||||||
|
fprintf(fp, "%s\t\t%s\n", getenv(VAR_IPADDR), getenv(VAR_HOSTNAME));
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
alreadyDone = TRUE;
|
alreadyDone = TRUE;
|
||||||
msgConfirm("Installation completed successfully.\nHit return now to go back to the main menu.");
|
msgConfirm("Installation completed successfully.\nHit return now to go back to the main menu.");
|
||||||
SystemWasInstalled = TRUE;
|
SystemWasInstalled = TRUE;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* This is probably the last program in the `sysinstall' line - the next
|
* This is probably the last program in the `sysinstall' line - the next
|
||||||
* generation being essentially a complete rewrite.
|
* generation being essentially a complete rewrite.
|
||||||
*
|
*
|
||||||
* $Id: variable.c,v 1.1 1995/05/01 21:56:32 jkh Exp $
|
* $Id: variable.c,v 1.2 1995/05/20 10:33:13 jkh Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
* Jordan Hubbard. All rights reserved.
|
* Jordan Hubbard. All rights reserved.
|
||||||
@ -45,32 +45,11 @@
|
|||||||
|
|
||||||
/* Routines for dealing with variable lists */
|
/* Routines for dealing with variable lists */
|
||||||
|
|
||||||
void
|
static void
|
||||||
variable_set(char *var)
|
make_variable(char *var, char *value)
|
||||||
{
|
|
||||||
char tmp[VAR_NAME_MAX + VAR_VALUE_MAX], *cp;
|
|
||||||
Variable *newvar;
|
|
||||||
|
|
||||||
newvar = (Variable *)safe_malloc(sizeof(Variable));
|
|
||||||
strncpy(tmp, var, VAR_NAME_MAX + VAR_VALUE_MAX);
|
|
||||||
if ((cp = index(tmp, '=')) == NULL)
|
|
||||||
msgFatal("Invalid variable format: %s", var);
|
|
||||||
*cp = '\0';
|
|
||||||
strncpy(newvar->name, tmp, VAR_NAME_MAX);
|
|
||||||
strncpy(newvar->value, cp + 1, VAR_VALUE_MAX);
|
|
||||||
newvar->next = VarHead;
|
|
||||||
VarHead = newvar;
|
|
||||||
setenv(newvar->name, newvar->value, 1);
|
|
||||||
msgInfo("Set %s to %s", newvar->name, newvar->value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
variable_set2(char *var, char *value)
|
|
||||||
{
|
{
|
||||||
Variable *newvar;
|
Variable *newvar;
|
||||||
|
|
||||||
if (!var || !value)
|
|
||||||
msgFatal("Null name or value passed to set_variable2!");
|
|
||||||
setenv(var, value, 1);
|
setenv(var, value, 1);
|
||||||
newvar = (Variable *)safe_malloc(sizeof(Variable));
|
newvar = (Variable *)safe_malloc(sizeof(Variable));
|
||||||
strncpy(newvar->name, var, VAR_NAME_MAX);
|
strncpy(newvar->name, var, VAR_NAME_MAX);
|
||||||
@ -80,3 +59,25 @@ variable_set2(char *var, char *value)
|
|||||||
setenv(newvar->name, newvar->value, 1);
|
setenv(newvar->name, newvar->value, 1);
|
||||||
msgInfo("Set %s to %s", newvar->name, newvar->value);
|
msgInfo("Set %s to %s", newvar->name, newvar->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
variable_set(char *var)
|
||||||
|
{
|
||||||
|
char tmp[VAR_NAME_MAX + VAR_VALUE_MAX], *cp;
|
||||||
|
|
||||||
|
strncpy(tmp, var, VAR_NAME_MAX + VAR_VALUE_MAX);
|
||||||
|
if ((cp = index(tmp, '=')) == NULL)
|
||||||
|
msgFatal("Invalid variable format: %s", var);
|
||||||
|
*(cp++) = '\0';
|
||||||
|
make_variable(tmp, cp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
variable_set2(char *var, char *value)
|
||||||
|
{
|
||||||
|
Variable *newvar;
|
||||||
|
|
||||||
|
if (!var || !value)
|
||||||
|
msgFatal("Null name or value passed to set_variable2!");
|
||||||
|
make_variable(var, value);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user