Don't pass global vars as args.

Remove local/global conflicts.
This commit is contained in:
Brian Somers 1997-11-08 00:28:11 +00:00
parent 5a583f9c34
commit 9780ef311d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=31034
10 changed files with 65 additions and 65 deletions

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: ccp.c,v 1.16 1997/09/10 21:33:31 brian Exp $
* $Id: ccp.c,v 1.17 1997/10/26 01:02:10 brian Exp $
*
* TODO:
* o Support other compression protocols
@ -209,7 +209,7 @@ CcpOpen()
}
static void
CcpDecodeConfig(u_char *cp, int plen, int mode)
CcpDecodeConfig(u_char *cp, int plen, int mode_type)
{
int type, length;
char tbuff[100];
@ -232,7 +232,7 @@ CcpDecodeConfig(u_char *cp, int plen, int mode)
switch (type) {
case TY_PRED1:
switch (mode) {
switch (mode_type) {
case MODE_REQ:
if (Acceptable(ConfPred1)) {
memcpy(ackp, cp, length);

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: command.c,v 1.89 1997/10/26 12:42:09 brian Exp $
* $Id: command.c,v 1.90 1997/11/04 01:16:59 brian Exp $
*
*/
#include <sys/param.h>
@ -164,7 +164,7 @@ DialCommand(struct cmdtab const * cmdlist, int argc, char **argv)
do {
if (VarTerm)
fprintf(VarTerm, "Dial attempt %u of %d\n", ++tries, VarDialTries);
if (OpenModem(mode) < 0) {
if (OpenModem() < 0) {
if (VarTerm)
fprintf(VarTerm, "Failed to open modem.\n");
break;
@ -748,7 +748,7 @@ TerminalCommand(struct cmdtab const * list, int argc, char **argv)
}
if (!IsInteractive(1))
return (1);
if (OpenModem(mode) < 0) {
if (OpenModem() < 0) {
if (VarTerm)
fprintf(VarTerm, "Failed to open modem.\n");
return (1);

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: ipcp.c,v 1.32 1997/10/26 12:42:11 brian Exp $
* $Id: ipcp.c,v 1.33 1997/10/29 01:19:40 brian Exp $
*
* TODO:
* o More RFC1772 backwoard compatibility
@ -357,7 +357,7 @@ AcceptableAddr(struct in_range * prange, struct in_addr ipaddr)
}
static void
IpcpDecodeConfig(u_char * cp, int plen, int mode)
IpcpDecodeConfig(u_char * cp, int plen, int mode_type)
{
int type, length;
u_long *lp, compproto;
@ -384,7 +384,7 @@ IpcpDecodeConfig(u_char * cp, int plen, int mode)
ipaddr.s_addr = *lp;
LogPrintf(LogIPCP, "%s %s\n", tbuff, inet_ntoa(ipaddr));
switch (mode) {
switch (mode_type) {
case MODE_REQ:
if (!AcceptableAddr(&DefHisAddress, ipaddr)) {
/*
@ -422,7 +422,7 @@ IpcpDecodeConfig(u_char * cp, int plen, int mode)
compproto = htonl(*lp);
LogPrintf(LogIPCP, "%s %08x\n", tbuff, compproto);
switch (mode) {
switch (mode_type) {
case MODE_REQ:
if (!Acceptable(ConfVjcomp)) {
memcpy(rejp, cp, length);
@ -485,7 +485,7 @@ IpcpDecodeConfig(u_char * cp, int plen, int mode)
snprintf(tbuff2, sizeof(tbuff2), "%s %s,", tbuff, inet_ntoa(ipaddr));
LogPrintf(LogIPCP, "%s %s\n", tbuff2, inet_ntoa(dstipaddr));
switch (mode) {
switch (mode_type) {
case MODE_REQ:
IpcpInfo.his_ipaddr = ipaddr;
IpcpInfo.want_ipaddr = dstipaddr;
@ -519,7 +519,7 @@ IpcpDecodeConfig(u_char * cp, int plen, int mode)
rejp += length;
break;
}
switch (mode) {
switch (mode_type) {
case MODE_REQ:
lp = (u_long *) (cp + 2);
dnsstuff.s_addr = *lp;
@ -568,7 +568,7 @@ IpcpDecodeConfig(u_char * cp, int plen, int mode)
rejp += length;
break;
}
switch (mode) {
switch (mode_type) {
case MODE_REQ:
lp = (u_long *) (cp + 2);
dnsstuff.s_addr = *lp;

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: lcp.c,v 1.41 1997/10/26 12:42:11 brian Exp $
* $Id: lcp.c,v 1.42 1997/10/29 01:19:41 brian Exp $
*
* TODO:
* o Validate magic number received from peer.
@ -367,9 +367,9 @@ LcpDown()
}
void
LcpOpen(int mode)
LcpOpen(int open_mode)
{
LcpFsm.open_mode = mode;
LcpFsm.open_mode = open_mode;
LcpFailedMagic = 0;
FsmOpen(&LcpFsm);
}
@ -387,7 +387,7 @@ LcpClose()
* XXX: Should validate option length
*/
static void
LcpDecodeConfig(u_char * cp, int plen, int mode)
LcpDecodeConfig(u_char * cp, int plen, int mode_type)
{
char *request;
int type, length, mru, mtu;
@ -413,7 +413,7 @@ LcpDecodeConfig(u_char * cp, int plen, int mode)
mru = htons(*sp);
LogPrintf(LogLCP, " %s %d\n", request, mru);
switch (mode) {
switch (mode_type) {
case MODE_REQ:
mtu = VarPrefMTU;
if (mtu == 0)
@ -446,7 +446,7 @@ LcpDecodeConfig(u_char * cp, int plen, int mode)
accmap = htonl(*lp);
LogPrintf(LogLCP, " %s %08x\n", request, accmap);
switch (mode) {
switch (mode_type) {
case MODE_REQ:
LcpInfo.his_accmap = accmap;
memcpy(ackp, cp, 6);
@ -465,7 +465,7 @@ LcpDecodeConfig(u_char * cp, int plen, int mode)
proto = ntohs(*sp);
LogPrintf(LogLCP, " %s proto = %04x\n", request, proto);
switch (mode) {
switch (mode_type) {
case MODE_REQ:
switch (proto) {
case PROTO_PAP:
@ -529,7 +529,7 @@ LcpDecodeConfig(u_char * cp, int plen, int mode)
req = (struct lqrreq *) cp;
LogPrintf(LogLCP, " %s proto: %x, interval: %dms\n",
request, ntohs(req->proto), ntohl(req->period) * 10);
switch (mode) {
switch (mode_type) {
case MODE_REQ:
if (ntohs(req->proto) != PROTO_LQR || !Acceptable(ConfLqr))
goto reqreject;
@ -554,7 +554,7 @@ LcpDecodeConfig(u_char * cp, int plen, int mode)
magic = ntohl(*lp);
LogPrintf(LogLCP, " %s %08x\n", request, magic);
switch (mode) {
switch (mode_type) {
case MODE_REQ:
if (LcpInfo.want_magic) {
/* Validate magic number */
@ -591,7 +591,7 @@ LcpDecodeConfig(u_char * cp, int plen, int mode)
case TY_PROTOCOMP:
LogPrintf(LogLCP, " %s\n", request);
switch (mode) {
switch (mode_type) {
case MODE_REQ:
if (Acceptable(ConfProtocomp)) {
LcpInfo.his_protocomp = 1;
@ -620,7 +620,7 @@ LcpDecodeConfig(u_char * cp, int plen, int mode)
break;
case TY_ACFCOMP:
LogPrintf(LogLCP, " %s\n", request);
switch (mode) {
switch (mode_type) {
case MODE_REQ:
if (Acceptable(ConfAcfcomp)) {
LcpInfo.his_acfcomp = 1;
@ -649,7 +649,7 @@ LcpDecodeConfig(u_char * cp, int plen, int mode)
break;
case TY_SDP:
LogPrintf(LogLCP, " %s\n", request);
switch (mode) {
switch (mode_type) {
case MODE_REQ:
case MODE_NAK:
case MODE_REJ:
@ -658,7 +658,7 @@ LcpDecodeConfig(u_char * cp, int plen, int mode)
break;
default:
LogPrintf(LogLCP, " ???[%02x]\n", type);
if (mode == MODE_REQ) {
if (mode_type == MODE_REQ) {
reqreject:
memcpy(rejp, cp, length);
rejp += length;

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: lcp.h,v 1.9 1997/10/26 01:02:58 brian Exp $
* $Id: lcp.h,v 1.10 1997/10/26 12:42:12 brian Exp $
*
* TODO:
*/
@ -75,7 +75,7 @@ extern struct fsm LcpFsm;
extern void LcpInit(void);
extern void LcpUp(void);
extern void LcpSendProtoRej(u_char *, int);
extern void LcpOpen(int mode);
extern void LcpOpen(int);
extern void LcpClose(void);
extern void LcpDown(void);
extern void PutConfValue(u_char **, char **, u_char, int, u_long);

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: main.c,v 1.86 1997/10/29 01:19:42 brian Exp $
* $Id: main.c,v 1.87 1997/11/04 01:17:02 brian Exp $
*
* TODO:
* o Add commands for traffic summary, version display, etc.
@ -501,7 +501,7 @@ main(int argc, char **argv)
void
PacketMode()
{
if (RawModem(modem) < 0) {
if (RawModem() < 0) {
LogPrintf(LogWARN, "PacketMode: Not connected.\n");
return;
}
@ -713,13 +713,13 @@ DoLoop()
if (mode & MODE_DIRECT) {
LogPrintf(LogDEBUG, "Opening modem\n");
if (OpenModem(mode) < 0)
if (OpenModem() < 0)
return;
LogPrintf(LogPHASE, "Packet mode enabled\n");
PacketMode();
} else if (mode & MODE_DEDICATED) {
if (modem < 0)
while (OpenModem(mode) < 0)
while (OpenModem() < 0)
nointr_sleep(VarReconnectTimer);
}
fflush(VarTerm);
@ -773,7 +773,7 @@ DoLoop()
*/
if (dial_up && RedialTimer.state != TIMER_RUNNING) {
LogPrintf(LogDEBUG, "going to dial: modem = %d\n", modem);
if (OpenModem(mode) < 0) {
if (OpenModem() < 0) {
tries++;
if (!(mode & MODE_DDIAL) && VarDialTries)
LogPrintf(LogCHAT, "Failed to open modem (attempt %u of %d)\n",

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: modem.c,v 1.60 1997/10/26 01:03:24 brian Exp $
* $Id: modem.c,v 1.61 1997/10/29 01:19:44 brian Exp $
*
* TODO:
*/
@ -487,7 +487,7 @@ HaveModem()
static struct termios modemios;
int
OpenModem(int mode)
OpenModem()
{
struct termios rstio;
int oldflag;
@ -633,7 +633,7 @@ ModemSpeed()
* Put modem tty line into raw mode which is necessary in packet mode operation
*/
int
RawModem(int modem)
RawModem()
{
struct termios rstio;
int oldflag;
@ -661,7 +661,7 @@ RawModem(int modem)
}
static void
UnrawModem(int modem)
UnrawModem()
{
int oldflag;
@ -742,7 +742,7 @@ HangupModem(int flag)
strcpy(ScriptBuffer, VarHangupScript); /* arrays are the same size */
DoChat(ScriptBuffer);
tcflush(modem, TCIOFLUSH);
UnrawModem(modem);
UnrawModem();
CloseLogicalModem();
}
} else if (modem >= 0) {

View File

@ -15,17 +15,17 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: modem.h,v 1.11 1997/10/26 12:42:13 brian Exp $
* $Id: modem.h,v 1.12 1997/10/29 01:19:45 brian Exp $
*
* TODO:
*/
extern int RawModem(int);
extern int RawModem(void);
extern void UpModem(int);
extern void DownModem(int);
extern void WriteModem(int, char *, int);
extern void ModemStartOutput(int);
extern int OpenModem(int);
extern int OpenModem(void);
extern int ModemSpeed(void);
extern int ModemQlen(void);
extern int DialModem(void);

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: os.c,v 1.28 1997/10/26 01:03:26 brian Exp $
* $Id: os.c,v 1.29 1997/10/29 01:19:47 brian Exp $
*
*/
#include <sys/param.h>
@ -68,7 +68,7 @@ SetIpDevice(struct in_addr myaddr,
struct in_addr netmask,
int updown)
{
struct sockaddr_in *sin;
struct sockaddr_in *sock_in;
int s;
int changeaddr = 0;
u_long mask, addr;
@ -115,18 +115,18 @@ SetIpDevice(struct in_addr myaddr,
/*
* Set interface address
*/
sin = (struct sockaddr_in *) & (ifra.ifra_addr);
sin->sin_family = AF_INET;
sin->sin_addr = oldmine = myaddr;
sin->sin_len = sizeof(*sin);
sock_in = (struct sockaddr_in *) & (ifra.ifra_addr);
sock_in->sin_family = AF_INET;
sock_in->sin_addr = oldmine = myaddr;
sock_in->sin_len = sizeof(*sock_in);
/*
* Set destination address
*/
sin = (struct sockaddr_in *) & (ifra.ifra_broadaddr);
sin->sin_family = AF_INET;
sin->sin_addr = oldhis = hisaddr;
sin->sin_len = sizeof(*sin);
sock_in = (struct sockaddr_in *) & (ifra.ifra_broadaddr);
sock_in->sin_family = AF_INET;
sock_in->sin_addr = oldhis = hisaddr;
sock_in->sin_len = sizeof(*sock_in);
/*
* */
@ -144,10 +144,10 @@ SetIpDevice(struct in_addr myaddr,
if (netmask.s_addr && (ntohl(netmask.s_addr) & mask) == mask)
mask = ntohl(netmask.s_addr);
sin = (struct sockaddr_in *) & (ifra.ifra_mask);
sin->sin_family = AF_INET;
sin->sin_addr.s_addr = htonl(mask);
sin->sin_len = sizeof(*sin);
sock_in = (struct sockaddr_in *) & (ifra.ifra_mask);
sock_in->sin_family = AF_INET;
sock_in->sin_addr.s_addr = htonl(mask);
sock_in->sin_len = sizeof(*sock_in);
if (changeaddr) {

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: route.c,v 1.19 1997/08/31 22:59:47 brian Exp $
* $Id: route.c,v 1.20 1997/10/26 01:03:37 brian Exp $
*
*/
@ -138,10 +138,10 @@ p_sockaddr(struct sockaddr * sa, int width)
{
if (VarTerm) {
register char *cp;
register struct sockaddr_in *sin = (struct sockaddr_in *) sa;
register struct sockaddr_in *sock_in = (struct sockaddr_in *) sa;
cp = (sin->sin_addr.s_addr == 0) ? "default" :
inet_ntoa(sin->sin_addr);
cp = (sock_in->sin_addr.s_addr == 0) ? "default" :
inet_ntoa(sock_in->sin_addr);
fprintf(VarTerm, "%-*.*s ", width, width, cp);
}
}
@ -364,7 +364,7 @@ GetIfIndex(char *name)
{
char *buffer;
struct ifreq *ifrp;
int s, len, elen, index;
int s, len, elen, newIfIndex;
struct ifconf ifconfs;
/* struct ifreq reqbuf[256]; -- obsoleted :) */
@ -400,20 +400,20 @@ GetIfIndex(char *name)
ifrp = ifconfs.ifc_req;
index = 1;
newIfIndex = 1;
for (len = ifconfs.ifc_len; len > 0; len -= sizeof(struct ifreq)) {
elen = ifrp->ifr_addr.sa_len - sizeof(struct sockaddr);
if (ifrp->ifr_addr.sa_family == AF_LINK) {
LogPrintf(LogDEBUG, "GetIfIndex: %d: %-*.*s, %d, %d\n",
index, IFNAMSIZ, IFNAMSIZ, ifrp->ifr_name,
newIfIndex, IFNAMSIZ, IFNAMSIZ, ifrp->ifr_name,
ifrp->ifr_addr.sa_family, elen);
if (strcmp(ifrp->ifr_name, name) == 0) {
IfIndex = index;
IfIndex = newIfIndex;
close(s);
free(buffer);
return (index);
return (newIfIndex);
}
index++;
newIfIndex++;
}
len -= elen;
ifrp = (struct ifreq *) ((char *) ifrp + elen);