Init network at proper time.

This commit is contained in:
jkh 1996-06-17 21:48:33 +00:00
parent 257dcecd29
commit a2bb2b476e
9 changed files with 69 additions and 20 deletions

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: ftp_strat.c,v 1.17 1996/05/23 11:50:11 jkh Exp $
* $Id: ftp_strat.c,v 1.18 1996/06/16 21:57:30 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -110,18 +110,12 @@ mediaInitFTP(Device *dev)
int i, retries;
char *cp, *rel, *hostname, *dir;
char *user, *login_name, password[80];
Device *netDevice = (Device *)dev->private;
if (ftpInitted)
return TRUE;
if (isDebug())
msgDebug("Init routine for FTP called. Net device is %x\n", netDevice);
if (!netDevice->init(netDevice)) {
if (isDebug())
msgDebug("InitFTP: Net device init returns FALSE\n");
return FALSE;
}
msgDebug("Init routine for FTP called.\n");
if (!ftp && (ftp = FtpInit()) == NULL) {
msgConfirm("FTP initialisation failed!");
@ -143,12 +137,11 @@ mediaInitFTP(Device *dev)
login_name = user;
strcpy(password, variable_get(VAR_FTP_PASS) ? variable_get(VAR_FTP_PASS) : login_name);
}
retries = 0;
hostname = variable_get(VAR_FTP_HOST);
dir = variable_get(VAR_FTP_DIR);
if (!hostname || !dir)
msgFatal("Missing FTP host or directory specification - something's wrong!");
retries = 0;
retry:
msgNotify("Logging in as %s..", login_name);
if (FtpOpen(ftp, hostname, login_name, password) != 0) {

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: media.c,v 1.39 1996/06/08 07:02:21 jkh Exp $
* $Id: media.c,v 1.40 1996/06/16 21:57:31 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -288,6 +288,11 @@ mediaSetFTP(dialogMenuItem *self)
if (!tcpDeviceSelect())
return DITEM_FAILURE | DITEM_RESTORE | DITEM_RECREATE;
if (!mediaDevice || !mediaDevice->init(mediaDevice)) {
if (isDebug())
msgDebug("mediaSetFTP: Net device init failed.\n");
return DITEM_FAILURE | DITEM_RESTORE | DITEM_RECREATE;
}
hostname = cp + 6;
if ((cp = index(hostname, ':')) != NULL) {
*(cp++) = '\0';
@ -310,7 +315,7 @@ mediaSetFTP(dialogMenuItem *self)
}
variable_set2(VAR_FTP_HOST, hostname);
variable_set2(VAR_FTP_DIR, dir ? dir : "/");
variable_set2(VAR_FTP_PORT, itoa(port));
ftpDevice.type = DEVICE_TYPE_FTP;
ftpDevice.init = mediaInitFTP;
ftpDevice.get = mediaGetFTP;
@ -376,6 +381,11 @@ mediaSetNFS(dialogMenuItem *self)
/* str == NULL means we were just called to change NFS paths, not network interfaces */
if (!tcpDeviceSelect())
return DITEM_FAILURE;
if (!mediaDevice || !mediaDevice->init(mediaDevice)) {
if (isDebug())
msgDebug("mediaSetNFS: Net device init failed\n");
return DITEM_FAILURE;
}
*idx = '\0';
msgNotify("Looking up host %s..", cp);
if ((gethostbyname(cp) == NULL) && (inet_addr(cp) == INADDR_NONE)) {

View File

@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
* $Id: misc.c,v 1.17 1996/04/23 01:29:29 jkh Exp $
* $Id: misc.c,v 1.18 1996/04/28 03:27:21 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -122,6 +122,16 @@ string_copy(char *s1, char *s2)
return s1;
}
/* convert an integer to a string, using a static buffer */
char *
itoa(int value)
{
static char buf[13];
snprintf(buf, 12, "%d", value);
return buf;
}
Boolean
directory_exists(const char *dirname)
{

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: sysinstall.h,v 1.62 1996/06/16 21:57:35 jkh Exp $
* $Id: sysinstall.h,v 1.63 1996/06/16 23:17:35 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -95,6 +95,7 @@
#define VAR_FTP_ONERROR "ftpOnError"
#define VAR_FTP_PASS "ftpPass"
#define VAR_FTP_PATH "ftp"
#define VAR_FTP_PORT "ftpPort"
#define VAR_FTP_RETRIES "ftpRetryCount"
#define VAR_FTP_STATE "ftpState"
#define VAR_FTP_USER "ftpUser"
@ -520,6 +521,7 @@ extern Boolean mediaVerify(void);
extern Boolean file_readable(char *fname);
extern Boolean file_executable(char *fname);
extern Boolean directory_exists(const char *dirname);
extern char *itoa(int value);
extern char *string_concat(char *p1, char *p2);
extern char *string_concat3(char *p1, char *p2, char *p3);
extern char *string_prune(char *str);

View File

@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
* $Id: misc.c,v 1.17 1996/04/23 01:29:29 jkh Exp $
* $Id: misc.c,v 1.18 1996/04/28 03:27:21 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -122,6 +122,16 @@ string_copy(char *s1, char *s2)
return s1;
}
/* convert an integer to a string, using a static buffer */
char *
itoa(int value)
{
static char buf[13];
snprintf(buf, 12, "%d", value);
return buf;
}
Boolean
directory_exists(const char *dirname)
{

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: sysinstall.h,v 1.62 1996/06/16 21:57:35 jkh Exp $
* $Id: sysinstall.h,v 1.63 1996/06/16 23:17:35 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -95,6 +95,7 @@
#define VAR_FTP_ONERROR "ftpOnError"
#define VAR_FTP_PASS "ftpPass"
#define VAR_FTP_PATH "ftp"
#define VAR_FTP_PORT "ftpPort"
#define VAR_FTP_RETRIES "ftpRetryCount"
#define VAR_FTP_STATE "ftpState"
#define VAR_FTP_USER "ftpUser"
@ -520,6 +521,7 @@ extern Boolean mediaVerify(void);
extern Boolean file_readable(char *fname);
extern Boolean file_executable(char *fname);
extern Boolean directory_exists(const char *dirname);
extern char *itoa(int value);
extern char *string_concat(char *p1, char *p2);
extern char *string_concat3(char *p1, char *p2, char *p3);
extern char *string_prune(char *str);

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: media.c,v 1.39 1996/06/08 07:02:21 jkh Exp $
* $Id: media.c,v 1.40 1996/06/16 21:57:31 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -288,6 +288,11 @@ mediaSetFTP(dialogMenuItem *self)
if (!tcpDeviceSelect())
return DITEM_FAILURE | DITEM_RESTORE | DITEM_RECREATE;
if (!mediaDevice || !mediaDevice->init(mediaDevice)) {
if (isDebug())
msgDebug("mediaSetFTP: Net device init failed.\n");
return DITEM_FAILURE | DITEM_RESTORE | DITEM_RECREATE;
}
hostname = cp + 6;
if ((cp = index(hostname, ':')) != NULL) {
*(cp++) = '\0';
@ -310,7 +315,7 @@ mediaSetFTP(dialogMenuItem *self)
}
variable_set2(VAR_FTP_HOST, hostname);
variable_set2(VAR_FTP_DIR, dir ? dir : "/");
variable_set2(VAR_FTP_PORT, itoa(port));
ftpDevice.type = DEVICE_TYPE_FTP;
ftpDevice.init = mediaInitFTP;
ftpDevice.get = mediaGetFTP;
@ -376,6 +381,11 @@ mediaSetNFS(dialogMenuItem *self)
/* str == NULL means we were just called to change NFS paths, not network interfaces */
if (!tcpDeviceSelect())
return DITEM_FAILURE;
if (!mediaDevice || !mediaDevice->init(mediaDevice)) {
if (isDebug())
msgDebug("mediaSetNFS: Net device init failed\n");
return DITEM_FAILURE;
}
*idx = '\0';
msgNotify("Looking up host %s..", cp);
if ((gethostbyname(cp) == NULL) && (inet_addr(cp) == INADDR_NONE)) {

View File

@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
* $Id: misc.c,v 1.17 1996/04/23 01:29:29 jkh Exp $
* $Id: misc.c,v 1.18 1996/04/28 03:27:21 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -122,6 +122,16 @@ string_copy(char *s1, char *s2)
return s1;
}
/* convert an integer to a string, using a static buffer */
char *
itoa(int value)
{
static char buf[13];
snprintf(buf, 12, "%d", value);
return buf;
}
Boolean
directory_exists(const char *dirname)
{

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: sysinstall.h,v 1.62 1996/06/16 21:57:35 jkh Exp $
* $Id: sysinstall.h,v 1.63 1996/06/16 23:17:35 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -95,6 +95,7 @@
#define VAR_FTP_ONERROR "ftpOnError"
#define VAR_FTP_PASS "ftpPass"
#define VAR_FTP_PATH "ftp"
#define VAR_FTP_PORT "ftpPort"
#define VAR_FTP_RETRIES "ftpRetryCount"
#define VAR_FTP_STATE "ftpState"
#define VAR_FTP_USER "ftpUser"
@ -520,6 +521,7 @@ extern Boolean mediaVerify(void);
extern Boolean file_readable(char *fname);
extern Boolean file_executable(char *fname);
extern Boolean directory_exists(const char *dirname);
extern char *itoa(int value);
extern char *string_concat(char *p1, char *p2);
extern char *string_concat3(char *p1, char *p2, char *p3);
extern char *string_prune(char *str);