]> git.ozlabs.org Git - ppp.git/blobdiff - netbsd-1.1/bsd-comp.c
Add pty, notty and record options.
[ppp.git] / netbsd-1.1 / bsd-comp.c
index 7a66ac5cc9b3c5d99bea9c3ddd89cf6df518d4b6..f4f298455de9244359b25cbe025ac1a49714267e 100644 (file)
@@ -1,4 +1,4 @@
-/*     $Id: bsd-comp.c,v 1.2 1996/01/18 03:13:03 paulus Exp $  */
+/*     $Id: bsd-comp.c,v 1.6 1996/08/28 06:31:58 paulus Exp $  */
 
 /* Because this code is derived from the 4.3BSD compress source:
  *
 
 /*
  * This version is for use with mbufs on BSD-derived systems.
- *
- * $Id: bsd-comp.c,v 1.2 1996/01/18 03:13:03 paulus Exp $
  */
 
 #include <sys/param.h>
 #include <sys/types.h>
+#include <sys/systm.h>
 #include <sys/mbuf.h>
 #include <sys/socket.h>
 #include <net/if.h>
@@ -188,6 +187,12 @@ struct compressor ppp_bsd_compress = {
 #define RATIO_SCALE    (1<<RATIO_SCALE_LOG)
 #define RATIO_MAX      (0x7fffffff>>RATIO_SCALE_LOG)
 
+static void bsd_clear __P((struct bsd_db *));
+static int bsd_check __P((struct bsd_db *));
+static void *bsd_alloc __P((u_char *, int, int));
+static int bsd_init __P((struct bsd_db *, u_char *, int, int, int, int,
+                        int, int));
+
 /*
  * clear the dictionary
  */
@@ -201,7 +206,6 @@ bsd_clear(db)
     db->ratio = 0;
     db->bytes_out = 0;
     db->in_count = 0;
-    db->incomp_count = 0;
     db->checkpoint = CHECK_GAP;
 }
 
@@ -411,7 +415,7 @@ bsd_init(db, options, opt_len, unit, hdrlen, mru, debug, decomp)
        || options[1] != CILEN_BSD_COMPRESS
        || BSD_VERSION(options[2]) != BSD_CURRENT_VERSION
        || BSD_NBITS(options[2]) != db->maxbits
-       || decomp && db->lens == NULL)
+       || (decomp && db->lens == NULL))
        return 0;
 
     if (decomp) {
@@ -481,11 +485,10 @@ bsd_compress(state, mret, mp, slen, maxolen)
     struct bsd_dict *dictp;
     u_char c;
     int hval, disp, ent, ilen;
-    struct mbuf *np;
     u_char *rptr, *wptr;
     u_char *cp_end;
     int olen;
-    struct mbuf *m, **mnp;
+    struct mbuf *m;
 
 #define PUTBYTE(v) {                                   \
     ++olen;                                            \
@@ -710,7 +713,6 @@ bsd_incomp(state, dmsg)
     if (ent < 0x21 || ent > 0xf9)
        return;
 
-    db->incomp_count++;
     db->seqno++;
     ilen = 1;          /* count the protocol as 1 byte */
     rptr += PPP_HDRLEN;
@@ -831,7 +833,6 @@ bsd_decompress(state, cmp, dmpp)
     struct mbuf *m, *dmp, *mret;
     int adrs, ctrl, ilen;
     int space, codelen, extra;
-    struct mbuf *last;
 
     /*
      * Save the address/control from the PPP header
@@ -941,7 +942,7 @@ bsd_decompress(state, cmp, dmpp)
        }
 
        if (incode > max_ent + 2 || incode > db->maxmaxcode
-           || incode > max_ent && oldcode == CLEAR) {
+           || (incode > max_ent && oldcode == CLEAR)) {
            m_freem(mret);
            if (db->debug) {
                printf("bsd_decomp%d: bad code 0x%x oldcode=0x%x ",