From 0eb707fdcf1b87e71bb3a9eaa8472d0b05799a3d Mon Sep 17 00:00:00 2001 From: Terry Dawson VK2KTJ Date: Wed, 12 Sep 2001 13:18:43 +0000 Subject: updated libtool, uniformly indented source, corrected small ax25mond Makefile bug --- ax25ipd/kiss.c | 92 ++++++++++++++++++++++++++++------------------------------ 1 file changed, 45 insertions(+), 47 deletions(-) (limited to 'ax25ipd/kiss.c') diff --git a/ax25ipd/kiss.c b/ax25ipd/kiss.c index 6042cf0..b43d969 100644 --- a/ax25ipd/kiss.c +++ b/ax25ipd/kiss.c @@ -43,8 +43,7 @@ int param_tbl_top; * Initialize the KISS variables */ -void -kiss_init() +void kiss_init() { ifptr = iframe; ifcount = 0; @@ -60,31 +59,33 @@ kiss_init() * frame has been assembled. */ -void -assemble_kiss(buf, l) +void assemble_kiss(buf, l) unsigned char *buf; int l; { int i; unsigned char c; - for(i=0;i0){ + if (c == FEND) { + if (ifcount > 0) { /* Make sure that the control byte is zero */ - if(*iframe=='\0' || *iframe==0x10) { + if (*iframe == '\0' || *iframe == 0x10) { /* Room for CRC in buffer? */ - if(ifcount < (MAX_FRAME - 2)) { + if (ifcount < (MAX_FRAME - 2)) { stats.kiss_in++; - from_kiss(iframe+1,ifcount-1); + from_kiss(iframe + + 1, ifcount - 1); } else { stats.kiss_toobig++; - LOGL2("assemble_kiss: dumped - frame too large\n"); + LOGL2 + ("assemble_kiss: dumped - frame too large\n"); } } else { stats.kiss_badtype++; - LOGL2("assemble_kiss: dumped - control byte non-zero\n"); + LOGL2 + ("assemble_kiss: dumped - control byte non-zero\n"); } } ifcount = 0; @@ -92,26 +93,27 @@ int l; ifptr = iframe; continue; } - if(c==FESC){ - iescaped=1; + if (c == FESC) { + iescaped = 1; continue; } - if(iescaped){ - if(c==TFEND)c = FEND; - if(c==TFESC)c = FESC; + if (iescaped) { + if (c == TFEND) + c = FEND; + if (c == TFESC) + c = FESC; iescaped = 0; } - if(ifcount < MAX_FRAME){ + if (ifcount < MAX_FRAME) { *ifptr = c; ifptr++; ifcount++; } - } /* for every character in the buffer */ + } /* for every character in the buffer */ } /* convert a standard AX25 frame into a kiss frame */ -void -send_kiss(type, buf, l) +void send_kiss(type, buf, l) unsigned char type; unsigned char *buf; int l; @@ -125,27 +127,27 @@ int l; KISSEMIT(FEND); - if(type==FEND){ + if (type == FEND) { KISSEMIT(FESC); KISSEMIT(TFEND); - }else if (type==FESC){ + } else if (type == FESC) { KISSEMIT(FESC); KISSEMIT(TFESC); - }else { + } else { KISSEMIT(type); } - for(i=0;i= PTABLE_SIZE){ - fprintf(stderr,"param table is full; entry ignored.\n"); + if (param_tbl_top >= PTABLE_SIZE) { + fprintf(stderr, "param table is full; entry ignored.\n"); } - param_tbl[param_tbl_top].parameter = p&0xff; - param_tbl[param_tbl_top].value = v&0xff; + param_tbl[param_tbl_top].parameter = p & 0xff; + param_tbl[param_tbl_top].value = v & 0xff; LOGL4("added param: %d\t%d\n", - param_tbl[param_tbl_top].parameter, - param_tbl[param_tbl_top].value); + param_tbl[param_tbl_top].parameter, + param_tbl[param_tbl_top].value); param_tbl_top++; return; } /* dump the contents of the parameter table */ -void -dump_params() +void dump_params() { int i; - LOGL1("\n%d parameters\n",param_tbl_top); - for(i=0;i