From 78d6a5000398cc4813a6644ab525ab32a056d066 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 8 Dec 2000 22:06:54 +0000 Subject: 2000-12-08 Joel Sherrill * libc/linkaddr.c: Initialized variable to remove warning. * modem/ppp.c, modem/ppp_tty.c: Made numerous variable declarations conditional on PPP_COMPRESS and PPP_FILTER. Commented out variables that were not used because the code using them was commented out. Removed totally unused variables. * modem/pppcompress.c: Added parentheses to avoid warnings. * pppd/pppmain.c: Removed numerous warnings. --- c/src/libnetworking/ChangeLog | 10 ++++++++++ c/src/libnetworking/libc/linkaddr.c | 3 ++- c/src/libnetworking/modem/ppp.c | 20 ++++++++++++++------ c/src/libnetworking/modem/ppp_tty.c | 17 ++++------------- c/src/libnetworking/modem/pppcompress.c | 6 +++--- c/src/libnetworking/pppd/pppmain.c | 28 +++++++++++++++++++--------- 6 files changed, 52 insertions(+), 32 deletions(-) (limited to 'c/src/libnetworking') diff --git a/c/src/libnetworking/ChangeLog b/c/src/libnetworking/ChangeLog index a31e6912cb..c09d5419e9 100644 --- a/c/src/libnetworking/ChangeLog +++ b/c/src/libnetworking/ChangeLog @@ -1,3 +1,13 @@ +2000-12-08 Joel Sherrill + + * libc/linkaddr.c: Initialized variable to remove warning. + * modem/ppp.c, modem/ppp_tty.c: Made numerous variable declarations + conditional on PPP_COMPRESS and PPP_FILTER. Commented out variables + that were not used because the code using them was commented out. + Removed totally unused variables. + * modem/pppcompress.c: Added parentheses to avoid warnings. + * pppd/pppmain.c: Removed numerous warnings. + 2000-11-30 Joel Sherrill * modem/ppp_tty.c: Changed to include since diff --git a/c/src/libnetworking/libc/linkaddr.c b/c/src/libnetworking/libc/linkaddr.c index 28c16cff05..2bad464b12 100644 --- a/c/src/libnetworking/libc/linkaddr.c +++ b/c/src/libnetworking/libc/linkaddr.c @@ -60,7 +60,8 @@ link_addr(addr, sdl) { register char *cp = sdl->sdl_data; char *cplim = sdl->sdl_len + (char *)sdl; - register int byte = 0, state = NAMING, new; + register int byte = 0, state = NAMING, + new=0; /* new=0 to avoid warning */ bzero((char *)&sdl->sdl_family, sdl->sdl_len - 1); sdl->sdl_family = AF_LINK; diff --git a/c/src/libnetworking/modem/ppp.c b/c/src/libnetworking/modem/ppp.c index 9b31b678fb..589089822d 100644 --- a/c/src/libnetworking/modem/ppp.c +++ b/c/src/libnetworking/modem/ppp.c @@ -134,8 +134,10 @@ extern struct ifqueue ipintrq; static int pppsioctl __P((struct ifnet *, int, caddr_t)); static void ppp_requeue __P((struct ppp_softc *)); +#ifdef PPP_COMPRESS static void ppp_ccp __P((struct ppp_softc *, struct mbuf *m, int rcvd)); static void ppp_ccp_closed __P((struct ppp_softc *)); +#endif static void ppp_inproc __P((struct ppp_softc *, struct mbuf *)); static void pppdumpm __P((struct mbuf *m0)); @@ -193,7 +195,8 @@ int rtems_ppp_driver_attach (struct rtems_bsdnet_ifconfig *config, { register struct ppp_softc *sc; register int i = 0; - extern void (*netisrs[])__P((void)); +/* XXX unused in rtems + extern void (*netisrs[])__P((void)); */ for (sc = ppp_softc; i < NPPP; sc++) { sc->sc_if.if_name = "ppp"; @@ -336,17 +339,19 @@ pppioctl(sc, cmd, data, flag, p) int flag; struct proc *p; { - int s, error, flags, mru, nb, npx; - struct ppp_option_data *odp; - struct compressor **cp; + int s, flags, mru, npx; struct npioctl *npi; time_t t; #ifdef PPP_FILTER + int error; struct bpf_program *bp, *nbp; struct bpf_insn *newcode, *oldcode; int newcodelen; #endif /* PPP_FILTER */ #ifdef PPP_COMPRESS + int nb; + struct ppp_option_data *odp; + struct compressor **cp; u_char ccp_option[CCP_MAX_OPTION_LENGTH]; #endif @@ -1016,7 +1021,7 @@ void pppintr() { struct ppp_softc *sc; - int i, s, s2; + int i, s2; struct mbuf *m; sc = ppp_softc; @@ -1189,7 +1194,10 @@ ppp_inproc(sc, m) struct ifqueue *inq; int s, ilen, xlen, proto, rv; u_char *cp, adrs, ctrl; - struct mbuf *mp, *dmp = NULL; + struct mbuf *mp; +#ifdef PPP_COMPRESS + *dmp = NULL; +#endif u_char *iphdr; u_int hlen; diff --git a/c/src/libnetworking/modem/ppp_tty.c b/c/src/libnetworking/modem/ppp_tty.c index 8e2dd1ddc5..27fff62a29 100644 --- a/c/src/libnetworking/modem/ppp_tty.c +++ b/c/src/libnetworking/modem/ppp_tty.c @@ -303,8 +303,6 @@ static void pppasyncrelinq(sc) struct ppp_softc *sc; { - int s; - if (sc->sc_outm) { m_freem(sc->sc_outm); sc->sc_outm = NULL; @@ -322,7 +320,7 @@ pppasyncrelinq(sc) /* * Line specific (tty) read routine. */ -pppread(struct rtems_termios_tty *tty, +int pppread(struct rtems_termios_tty *tty, rtems_libio_rw_args_t *rw_args) { char *buffer; @@ -330,8 +328,6 @@ pppread(struct rtems_termios_tty *tty, rtems_status_code status; struct mbuf *m, *m0; - register int s; - int error = 0; rtems_interval ticks; register struct ppp_softc *sc = (struct ppp_softc *)tty->t_sc; buffer = rw_args->buffer; @@ -380,7 +376,7 @@ int pppwrite(struct rtems_termios_tty *tty, rtems_libio_rw_args_t *rw_args) { - int count,len; + int len; char *out_buffer; int n,maximum; @@ -574,15 +570,11 @@ pppasyncstart(sc) void modem_sendpacket(struct rtems_termios_tty *tty) { - struct mbuf *l = NULL; - rtems_unsigned16 status; - int curr; register struct mbuf *m; register int len; register u_char *start, *stop, *cp; - int n, ndone, done, idle; + int n, ndone, done; struct mbuf *m2; - int s; char c; register struct ppp_softc *sc=tty->t_sc; @@ -679,7 +671,7 @@ void modem_sendpacket(struct rtems_termios_tty *tty) */ done = len == 0; if (done && m->m_next == NULL) { - u_char *p, *q; + u_char *p; int c; u_char endseq[8]; @@ -791,7 +783,6 @@ ppp_timeout(x) struct rtems_termios_tty *tty = ((struct rtems_termios_tty *)x); struct ppp_softc *sc = tty->t_sc; struct rtems_termios_tty *tp = (struct rtems_termios_tty *) sc->sc_devp; - int s; sc->sc_flags &= ~SC_TIMEOUT; pppstart(tp); diff --git a/c/src/libnetworking/modem/pppcompress.c b/c/src/libnetworking/modem/pppcompress.c index a7d2734c8d..aebe441fd3 100644 --- a/c/src/libnetworking/modem/pppcompress.c +++ b/c/src/libnetworking/modem/pppcompress.c @@ -278,19 +278,19 @@ vj_compress_tcp(m, ip, comp, compress_cid) * with it. */ goto uncompressed; - if (deltaS = (u_short)(ntohs(th->th_win) - ntohs(oth->th_win))) { + if ((deltaS = (u_short)(ntohs(th->th_win) - ntohs(oth->th_win)))) { ENCODE(deltaS); changes |= NEW_W; } - if (deltaA = ntohl(th->th_ack) - ntohl(oth->th_ack)) { + if ((deltaA = ntohl(th->th_ack) - ntohl(oth->th_ack))) { if (deltaA > 0xffff) goto uncompressed; ENCODE(deltaA); changes |= NEW_A; } - if (deltaS = ntohl(th->th_seq) - ntohl(oth->th_seq)) { + if ((deltaS = ntohl(th->th_seq) - ntohl(oth->th_seq))) { if (deltaS > 0xffff) goto uncompressed; ENCODE(deltaS); diff --git a/c/src/libnetworking/pppd/pppmain.c b/c/src/libnetworking/pppd/pppmain.c index 9036dfcb54..0bf8d68e87 100644 --- a/c/src/libnetworking/pppd/pppmain.c +++ b/c/src/libnetworking/pppd/pppmain.c @@ -39,10 +39,12 @@ #include #include #include -#include #include #include +#include +#include + /* #include */ #include "pppd.h" #include "magic.h" @@ -72,6 +74,9 @@ extern char *strerror(); void SetStatusInfo(int state, char * text, int res); +/* prototypes for routines in this file */ +int connect_script(int fd); + /* interface vars */ char ifname[32]; /* Interface name */ int interfunit; /* Interface unit number */ @@ -107,15 +112,17 @@ char *no_ppp_msg = "lack of PPP\n"; /* Prototypes for procedures local to this file. */ static void cleanup(void); -static void create_pidfile __P((void)); static void close_tty __P((void)); static void get_input __P((void)); static void calltimeout __P((void)); static struct timeval *timeleft __P((struct timeval *)); static void holdoff_end __P((void *)); -static int device_script __P((char *[], int, int)); static void reap_kids __P((void)); +/* XXX currently unused */ +#if 0 +static int device_script __P((char *[], int, int)); static void pr_log __P((void *, char *,...)); +#endif extern char *ttyname __P((int)); extern char *getlogin __P((void)); @@ -164,10 +171,14 @@ int argc; char *argv[]; { int i; +#if 0 struct timeval timo; +#endif struct protent *protp; struct stat statbuf; +#if 0 char t[100]; +#endif phase = PHASE_INITIALIZE; @@ -757,15 +768,9 @@ int sig; kill_link = 1; } -static int input_fd, output_fd; -#include - - - int modem_fd; /* FIXME: should not be global... */ int connect_script(int fd) { - int status; #if 0 /* FIXME: This is WinNT special */ char program[256] = "TIMEOUT@10@@CLIENT@CLIENTSERVER"; #else @@ -775,12 +780,14 @@ int connect_script(int fd) /* XXX PPPConfiguration */ GlobalSystemStatus * volatile stat; #endif +#if 0 /* Connect scripts are almost the same as in Linux Chat ... */ static char *scripts[] = { "TIMEOUT@5@@\rAT@OK-+++\\c-OK@ATH0@TIMEOUT@90@OK@ATDT%s@CONNECT@", "TIMEOUT@5@@\rAT@OK-+++\\c-OK@ATH0@TIMEOUT@90@OK@ATDT%s@CONNECT@@ppp@@Username:@%s@Password:@%s@" }; +#endif modem_fd = fd; #if 0 /* XXX PPPConfiguration */ @@ -898,6 +905,8 @@ void *arg; +/* XXX currently unused */ +#if 0 static void pr_log __V((void *arg, char *fmt,...)) { @@ -925,6 +934,7 @@ pr_log __V((void *arg, char *fmt,...)) strcpy(linep, buf); linep += n; } +#endif /* * print_string - print a readable representation of a string using -- cgit v1.2.3