summaryrefslogtreecommitdiffstats
path: root/cpukit/pppd
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2005-01-20 17:00:38 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2005-01-20 17:00:38 +0000
commit4ca43d72e1e6af22688f868463e4ccf429e3f5c9 (patch)
treef7e2b7d3c7d0a61729e6952b907273df9897f630 /cpukit/pppd
parentCosmetics. (diff)
downloadrtems-4ca43d72e1e6af22688f868463e4ccf429e3f5c9.tar.bz2
2005-01-20 Joel Sherrill <joel@OARcorp.com>
PR 736/pppd * libnetworking/pppd/chat.c, libnetworking/pppd/demand.c, libnetworking/pppd/pppd.h, libnetworking/pppd/rtemsmain.c, libnetworking/pppd/sys-rtems.c, libnetworking/pppd/utils.c: ttyfd should not be static and should have a name more specific to pppd.
Diffstat (limited to 'cpukit/pppd')
-rw-r--r--cpukit/pppd/chat.c16
-rw-r--r--cpukit/pppd/demand.c2
-rw-r--r--cpukit/pppd/pppd.h4
-rw-r--r--cpukit/pppd/rtemsmain.c30
-rw-r--r--cpukit/pppd/sys-rtems.c6
-rw-r--r--cpukit/pppd/utils.c5
6 files changed, 32 insertions, 31 deletions
diff --git a/cpukit/pppd/chat.c b/cpukit/pppd/chat.c
index 6623004d35..7697d09a86 100644
--- a/cpukit/pppd/chat.c
+++ b/cpukit/pppd/chat.c
@@ -163,7 +163,7 @@ static int use_env = 0;
static int exit_code = 0;
static char *phone_num = (char *) 0;
static char *phone_num2 = (char *) 0;
-static int ttyfd;
+/* static */ int pppd_ttyfd;
static int timeout = DEFAULT_CHAT_TIMEOUT;
#ifdef TERMIOS
@@ -246,7 +246,7 @@ int chatmain(int fd, int mode, char *pScript)
/* initialize exit code */
exit_code = 0;
- ttyfd = fd;
+ pppd_ttyfd = fd;
script=pScript;
@@ -271,14 +271,14 @@ int chatmain(int fd, int mode, char *pScript)
}
}
}
- ttyfd = (int)-1;
+ pppd_ttyfd = (int)-1;
return ( exit_code );
}
void break_sequence()
{
- tcsendbreak(ttyfd, 0);
+ tcsendbreak(pppd_ttyfd, 0);
}
/*
@@ -699,7 +699,7 @@ static int get_char()
while(tries)
{
- status = read(ttyfd, &c, 1);
+ status = read(pppd_ttyfd, &c, 1);
switch (status) {
case 1:
return ((int)c & 0x7F);
@@ -715,7 +715,7 @@ int c;
{
char ch = c;
- return(write(ttyfd, &ch, 1));
+ return(write(pppd_ttyfd, &ch, 1));
}
static int write_char (c)
@@ -791,10 +791,10 @@ register char *in_string;
memset(temp2, 0, sizeof(temp2));
- tcgetattr(ttyfd, &tios);
+ tcgetattr(pppd_ttyfd, &tios);
tios.c_cc[VMIN] = 0;
tios.c_cc[VTIME] = timeout*10/MAX_TIMEOUTS;
- tcsetattr(ttyfd, TCSANOW, &tios);
+ tcsetattr(pppd_ttyfd, TCSANOW, &tios);
string = clean(in_string, 0);
len = strlen(string);
diff --git a/cpukit/pppd/demand.c b/cpukit/pppd/demand.c
index 0b807575c2..1165355ff3 100644
--- a/cpukit/pppd/demand.c
+++ b/cpukit/pppd/demand.c
@@ -45,7 +45,7 @@
static const char rcsid[] = RCSID;
-static char *frame;
+static unsigned char *frame;
static int framelen;
static int framemax;
static int escape_flag;
diff --git a/cpukit/pppd/pppd.h b/cpukit/pppd/pppd.h
index 0ecd2e1d23..ddc5571b23 100644
--- a/cpukit/pppd/pppd.h
+++ b/cpukit/pppd/pppd.h
@@ -141,7 +141,7 @@ extern int pppd_kill_link; /* Signal to terminate processing loop */
extern int hungup; /* Physical layer has disconnected */
extern int pppifunit; /* Interface unit number */
extern char ifname[]; /* Interface name */
-extern int ttyfd; /* Serial device file descriptor */
+extern int pppd_ttyfd; /* Serial device file descriptor */
extern char hostname[]; /* Our hostname */
extern u_char outpacket_buf[]; /* Buffer for outgoing packets */
extern int pppd_phase; /* Current state of link - see values below */
@@ -301,7 +301,7 @@ void new_phase __P((int)); /* signal start of new phase */
/* Procedures exported from utils.c. */
void log_packet __P((u_char *, int, char *, int));
/* Format a packet and log it with syslog */
-void print_string __P((char *, int, void (*) (void *, char *, ...),
+void print_string __P((void *, int, void (*) (void *, char *, ...),
void *)); /* Format a string for output */
int slprintf __P((char *, int, char *, ...)); /* sprintf++ */
int vslprintf __P((char *, int, char *, va_list)); /* vsprintf++ */
diff --git a/cpukit/pppd/rtemsmain.c b/cpukit/pppd/rtemsmain.c
index 2c0832b94f..eb92ae120f 100644
--- a/cpukit/pppd/rtemsmain.c
+++ b/cpukit/pppd/rtemsmain.c
@@ -77,7 +77,7 @@ int pppifunit; /* Interface unit number */
char hostname[MAXNAMELEN]; /* Our hostname */
static char ppp_devnam[MAXPATHLEN]; /* name of PPP tty (maybe ttypx) */
-int ttyfd; /* Serial port file descriptor */
+/* int pppd_ttyfd; * Serial port file descriptor */
int baud_rate; /* Actual bits/second for serial device */
int hungup; /* terminal has been hung up */
int privileged; /* we're running as real uid root */
@@ -232,7 +232,7 @@ pppdmain(argc, argv)
for (;;) {
need_holdoff = 1;
- ttyfd = -1;
+ pppd_ttyfd = -1;
real_ttyfd = -1;
pppd_status = EXIT_OK;
++unsuccess;
@@ -264,9 +264,9 @@ pppdmain(argc, argv)
/* If the user specified the device name, become the
user before opening it. */
int err;
- ttyfd = open(devnam, O_NONBLOCK | O_RDWR, 0);
+ pppd_ttyfd = open(devnam, O_NONBLOCK | O_RDWR, 0);
err = errno;
- if (ttyfd >= 0) {
+ if (pppd_ttyfd >= 0) {
break;
}
errno = err;
@@ -277,8 +277,8 @@ pppdmain(argc, argv)
if (!persist || err != EINTR)
goto fail;
}
- if ((fdflags = fcntl(ttyfd, F_GETFL)) == -1
- || fcntl(ttyfd, F_SETFL, fdflags & ~O_NONBLOCK) < 0)
+ if ((fdflags = fcntl(pppd_ttyfd, F_GETFL)) == -1
+ || fcntl(pppd_ttyfd, F_SETFL, fdflags & ~O_NONBLOCK) < 0)
warn("Couldn't reset non-blocking mode on device: %m");
/*
@@ -291,9 +291,9 @@ pppdmain(argc, argv)
* successfully to the modem with CLOCAL clear and CD down,
* we could clear CLOCAL at this point.
*/
- set_up_tty(ttyfd, ((connector != NULL && connector[0] != 0)
+ set_up_tty(pppd_ttyfd, ((connector != NULL && connector[0] != 0)
|| initializer != NULL));
- real_ttyfd = ttyfd;
+ real_ttyfd = pppd_ttyfd;
}
/* run connection script */
@@ -308,7 +308,7 @@ pppdmain(argc, argv)
}
if (initializer && initializer[0]) {
- if (device_script(ttyfd, DIALER_INIT, initializer) < 0) {
+ if (device_script(pppd_ttyfd, DIALER_INIT, initializer) < 0) {
error("Initializer script failed");
pppd_status = EXIT_INIT_FAILED;
goto fail;
@@ -320,7 +320,7 @@ pppdmain(argc, argv)
}
if (connector && connector[0]) {
- if (device_script(ttyfd, DIALER_CONNECT, connector) < 0) {
+ if (device_script(pppd_ttyfd, DIALER_CONNECT, connector) < 0) {
error("Connect script failed");
pppd_status = EXIT_CONNECT_FAILED;
goto fail;
@@ -360,12 +360,12 @@ pppdmain(argc, argv)
/* run welcome script, if any */
if (welcomer && welcomer[0]) {
- if (device_script(ttyfd, DIALER_WELCOME, welcomer) < 0)
+ if (device_script(pppd_ttyfd, DIALER_WELCOME, welcomer) < 0)
warn("Welcome script failed");
}
/* set up the serial device as a ppp interface */
- fd_ppp = establish_ppp(ttyfd);
+ fd_ppp = establish_ppp(pppd_ttyfd);
if (fd_ppp < 0) {
pppd_status = EXIT_FATAL_ERROR;
goto disconnect;
@@ -415,7 +415,7 @@ pppdmain(argc, argv)
clean_check();
if (demand)
restore_loop();
- disestablish_ppp(ttyfd);
+ disestablish_ppp(pppd_ttyfd);
fd_ppp = -1;
if (!hungup)
lcp_lowerdown(0);
@@ -429,7 +429,7 @@ pppdmain(argc, argv)
new_phase(PHASE_DISCONNECT);
if (real_ttyfd >= 0)
set_up_tty(real_ttyfd, 1);
- if (device_script(ttyfd, DIALER_DISCONNECT, disconnect_script) < 0) {
+ if (device_script(pppd_ttyfd, DIALER_DISCONNECT, disconnect_script) < 0) {
warn("disconnect script failed");
} else {
info("Serial link disconnected.");
@@ -685,7 +685,7 @@ cleanup()
sys_cleanup();
if (fd_ppp >= 0)
- disestablish_ppp(ttyfd);
+ disestablish_ppp(pppd_ttyfd);
if (real_ttyfd >= 0)
close_tty();
diff --git a/cpukit/pppd/sys-rtems.c b/cpukit/pppd/sys-rtems.c
index 0fc3e139b9..f85a571aa0 100644
--- a/cpukit/pppd/sys-rtems.c
+++ b/cpukit/pppd/sys-rtems.c
@@ -488,7 +488,7 @@ output(unit, p, len)
dbglog("sent %P", p, len);
/* printf("sent packet [%d]\n", len); */
- if (write(ttyfd, p, len) < 0) {
+ if (write(pppd_ttyfd, p, len) < 0) {
if (errno != EIO)
error("write: %m");
}
@@ -531,7 +531,7 @@ read_packet(buf)
{
int len;
- if ((len = read(ttyfd, buf, PPP_MTU + PPP_HDRLEN)) < 0) {
+ if ((len = read(pppd_ttyfd, buf, PPP_MTU + PPP_HDRLEN)) < 0) {
if (errno == EWOULDBLOCK || errno == EINTR) len = -1;
/*fatal("read: %m"); */
}
@@ -649,7 +649,7 @@ ccp_test(unit, opt_ptr, opt_len, for_transmit)
data.ptr = opt_ptr;
data.length = opt_len;
data.transmit = for_transmit;
- if (ioctl(ttyfd, PPPIOCSCOMPRESS, (caddr_t) &data) >= 0)
+ if (ioctl(pppd_ttyfd, PPPIOCSCOMPRESS, (caddr_t) &data) >= 0)
return 1;
return (errno == ENOBUFS)? 0: -1;
}
diff --git a/cpukit/pppd/utils.c b/cpukit/pppd/utils.c
index fd799e6a35..15cdf6b763 100644
--- a/cpukit/pppd/utils.c
+++ b/cpukit/pppd/utils.c
@@ -468,13 +468,14 @@ pr_log __V((void *arg, char *fmt, ...))
* printer.
*/
void
-print_string(p, len, printer, arg)
- char *p;
+print_string(p_arg, len, printer, arg)
+ void *p_arg;
int len;
void (*printer) __P((void *, char *, ...));
void *arg;
{
int c;
+ unsigned char *p = (unsigned char *)p_arg;
printer(arg, "\"");
for (; len > 0; --len) {