Commit a more general version of the last patch; don't do any back-filling
of values more than once. User might want to override them.
This commit is contained in:
parent
3e9638ef1f
commit
31faa7fc3f
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: tcpip.c,v 1.76 1999/05/06 11:03:18 jkh Exp $
|
||||
* $Id: tcpip.c,v 1.77 1999/05/06 11:05:19 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Gary J Palmer. All rights reserved.
|
||||
@ -151,7 +151,7 @@ tcpOpenDialog(Device *devp)
|
||||
{
|
||||
WINDOW *ds_win, *save = NULL;
|
||||
ComposeObj *obj = NULL;
|
||||
int n = 0, cancel = FALSE;
|
||||
int n = 0, filled = 0, cancel = FALSE;
|
||||
int max, ret = DITEM_SUCCESS;
|
||||
char *tmp;
|
||||
char title[80];
|
||||
@ -263,24 +263,27 @@ tcpOpenDialog(Device *devp)
|
||||
reenter:
|
||||
cancelbutton = okbutton = 0;
|
||||
while (layoutDialogLoop(ds_win, layout, &obj, &n, max, &cancelbutton, &cancel)) {
|
||||
/* Insert a default value for the netmask, 0xffffff00 is
|
||||
the most appropriate one (entire class C, or subnetted
|
||||
class A/B network). */
|
||||
if (netmask[0] == '\0') {
|
||||
strcpy(netmask, "255.255.255.0");
|
||||
RefreshStringObj(layout[LAYOUT_NETMASK].obj);
|
||||
}
|
||||
if (!index(hostname, '.') && domainname[0]) {
|
||||
strcat(hostname, ".");
|
||||
strcat(hostname, domainname);
|
||||
RefreshStringObj(layout[LAYOUT_HOSTNAME].obj);
|
||||
}
|
||||
else if (((tmp = index(hostname, '.')) != NULL) && !domainname[0]) {
|
||||
SAFE_STRCPY(domainname, tmp + 1);
|
||||
RefreshStringObj(layout[LAYOUT_DOMAINNAME].obj);
|
||||
/* Prevent this from being irritating if user really means NO */
|
||||
if (!filled) {
|
||||
filled = 1;
|
||||
/* Insert a default value for the netmask, 0xffffff00 is
|
||||
the most appropriate one (entire class C, or subnetted
|
||||
class A/B network). */
|
||||
if (netmask[0] == '\0') {
|
||||
strcpy(netmask, "255.255.255.0");
|
||||
RefreshStringObj(layout[LAYOUT_NETMASK].obj);
|
||||
}
|
||||
if (!index(hostname, '.') && domainname[0]) {
|
||||
strcat(hostname, ".");
|
||||
strcat(hostname, domainname);
|
||||
RefreshStringObj(layout[LAYOUT_HOSTNAME].obj);
|
||||
}
|
||||
else if (((tmp = index(hostname, '.')) != NULL) && !domainname[0]) {
|
||||
SAFE_STRCPY(domainname, tmp + 1);
|
||||
RefreshStringObj(layout[LAYOUT_DOMAINNAME].obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!cancel && !verifySettings())
|
||||
goto reenter;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: tcpip.c,v 1.76 1999/05/06 11:03:18 jkh Exp $
|
||||
* $Id: tcpip.c,v 1.77 1999/05/06 11:05:19 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Gary J Palmer. All rights reserved.
|
||||
@ -151,7 +151,7 @@ tcpOpenDialog(Device *devp)
|
||||
{
|
||||
WINDOW *ds_win, *save = NULL;
|
||||
ComposeObj *obj = NULL;
|
||||
int n = 0, cancel = FALSE;
|
||||
int n = 0, filled = 0, cancel = FALSE;
|
||||
int max, ret = DITEM_SUCCESS;
|
||||
char *tmp;
|
||||
char title[80];
|
||||
@ -263,24 +263,27 @@ tcpOpenDialog(Device *devp)
|
||||
reenter:
|
||||
cancelbutton = okbutton = 0;
|
||||
while (layoutDialogLoop(ds_win, layout, &obj, &n, max, &cancelbutton, &cancel)) {
|
||||
/* Insert a default value for the netmask, 0xffffff00 is
|
||||
the most appropriate one (entire class C, or subnetted
|
||||
class A/B network). */
|
||||
if (netmask[0] == '\0') {
|
||||
strcpy(netmask, "255.255.255.0");
|
||||
RefreshStringObj(layout[LAYOUT_NETMASK].obj);
|
||||
}
|
||||
if (!index(hostname, '.') && domainname[0]) {
|
||||
strcat(hostname, ".");
|
||||
strcat(hostname, domainname);
|
||||
RefreshStringObj(layout[LAYOUT_HOSTNAME].obj);
|
||||
}
|
||||
else if (((tmp = index(hostname, '.')) != NULL) && !domainname[0]) {
|
||||
SAFE_STRCPY(domainname, tmp + 1);
|
||||
RefreshStringObj(layout[LAYOUT_DOMAINNAME].obj);
|
||||
/* Prevent this from being irritating if user really means NO */
|
||||
if (!filled) {
|
||||
filled = 1;
|
||||
/* Insert a default value for the netmask, 0xffffff00 is
|
||||
the most appropriate one (entire class C, or subnetted
|
||||
class A/B network). */
|
||||
if (netmask[0] == '\0') {
|
||||
strcpy(netmask, "255.255.255.0");
|
||||
RefreshStringObj(layout[LAYOUT_NETMASK].obj);
|
||||
}
|
||||
if (!index(hostname, '.') && domainname[0]) {
|
||||
strcat(hostname, ".");
|
||||
strcat(hostname, domainname);
|
||||
RefreshStringObj(layout[LAYOUT_HOSTNAME].obj);
|
||||
}
|
||||
else if (((tmp = index(hostname, '.')) != NULL) && !domainname[0]) {
|
||||
SAFE_STRCPY(domainname, tmp + 1);
|
||||
RefreshStringObj(layout[LAYOUT_DOMAINNAME].obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!cancel && !verifySettings())
|
||||
goto reenter;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user