From 528c8b904a1da81934ac8d8d7dcbf97f220a7228 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Tue, 23 Jan 2007 13:40:01 +0000 Subject: Fix warnings about // style comment. And remove some of the most pointless comments. --- ax25/access.c | 19 ++++++-------- ax25/ax25d.c | 10 +++---- ax25/axgetput/axgetput.c | 20 +++++++------- ax25/axgetput/axgetput.h | 6 ++--- ax25/axgetput/proto_bin.c | 66 +++++++++++++++++++++++++++-------------------- ax25/axgetput/util.c | 12 +++++---- ax25/axspawn.c | 31 ++++++++++++++-------- ax25/bpqparms.c | 6 ++--- ax25/rxecho.c | 54 +++++++++++++++++++++----------------- kiss/kissparms.c | 1 - 10 files changed, 124 insertions(+), 101 deletions(-) diff --git a/ax25/access.c b/ax25/access.c index 51e75ce..2929580 100644 --- a/ax25/access.c +++ b/ax25/access.c @@ -122,12 +122,12 @@ void ask_pw_sys(char *prompt, char *pass_want, char *pw) for (i = 0; i < 5; i++) { j = conv_random(pwlen, 0); - // store generated request-numbers - five_digits[i] = j+1; // pos0 refers as 1 - // store expected string in cp->passwd + /* store generated request-numbers */ + five_digits[i] = j+1; /* pos0 refers as 1 */ + /* store expected string in cp->passwd */ pass_want[i] = pw[j]; } - // and terminate the string + /* and terminate the string */ pass_want[i] = 0; sprintf(buffer, "\r%s> %d %d %d %d %d\r", prompt, five_digits[0], five_digits[1], five_digits[2], five_digits[3], five_digits[4]); @@ -142,10 +142,8 @@ void ask_pw_md5(char *prompt, char *pass_want, char *pw) char buffer[2048]; char cipher[16]; char key[256]; -// char *pass; char *challenge; -// pass = pw; pass_want[0]= 0; if (!pw || !*pw) @@ -154,19 +152,18 @@ void ask_pw_md5(char *prompt, char *pass_want, char *pw) if (seed == 1L) conv_randomize(); - // copy password strncpy(key, pw, sizeof(key)); key[sizeof(key)-1] = 0; - // compute random salt + /* compute random salt */ challenge = generate_rand_pw(SALT_LEN); - // ask for proper response to this challenge: + /* ask for proper response to this challenge: */ sprintf(buffer, "\r%s> [%s]\r", prompt, challenge); write_ax25(buffer, strlen(buffer), 1); - // compute md5 challenge + /* compute md5 challenge */ calc_md5_pw(challenge, key, cipher); - // store expected answer + /* store expected answer */ char_to_hex(cipher, pass_want, 16); } diff --git a/ax25/ax25d.c b/ax25/ax25d.c index 8a7cdcb..638a8a9 100644 --- a/ax25/ax25d.c +++ b/ax25/ax25d.c @@ -1,5 +1,5 @@ /* - * $Id: ax25d.c,v 1.4 2006/01/08 18:26:43 dl9sau Exp $ + * $Id: ax25d.c,v 1.5 2007/01/23 13:40:01 ralf Exp $ * * This is my version of axl.c, written for the LBBS code to make it * compatable with the kernel AX25 driver. It appears to work, with @@ -515,9 +515,9 @@ int main(int argc, char *argv[]) goto login; if (raxl->checkVC > 1) { - //setproctitle("ax25d [%d]: rejecting, User); + /* setproctitle("ax25d [%d]: rejecting, User); */ } else { - //setproctitle("ax25d [%d]: %s, User, (VCloginEnable ? "waiting" : "discarding")); + /* setproctitle("ax25d [%d]: %s, User, (VCloginEnable ? "waiting" : "discarding")); */ } /* is a VC user. checkVC > 0? then reject now, or fork and wait for pid=textdata.. */ @@ -587,12 +587,12 @@ int main(int argc, char *argv[]) /* point of no return */ close_link: /* close link */ - //setproctitle("ax25d [%s]: disconnecting", User); + /* setproctitle("ax25d [%s]: disconnecting", User); */ close(new); return 0; } login: - //setproctitle("ax25d [%s]: login", User); + /* setproctitle("ax25d [%s]: login", User); */ SetupOptions(new, raxl); WorkoutArgs(raxl->af_type, raxl->shell, &argc, argv); diff --git a/ax25/axgetput/axgetput.c b/ax25/axgetput/axgetput.c index 1e0a908..6a425ca 100644 --- a/ax25/axgetput/axgetput.c +++ b/ax25/axgetput/axgetput.c @@ -1,4 +1,4 @@ -static const char rcsid[] = "@(#) $Id: axgetput.c,v 1.1 2006/12/10 19:12:59 dl9sau Exp $"; +static const char rcsid[] = "@(#) $Id: axgetput.c,v 1.2 2007/01/23 13:40:01 ralf Exp $"; /* * This is axgetput @@ -70,13 +70,13 @@ static void set_tty_flags() if (fdin_is_pipe) return; - // mesg no + /* mesg no */ if (!fstat(fdin, &statbuf)) { - // save old mode + /* save old mode */ mode_tty = statbuf.st_mode; fchmod(fdin, 0600); } - // make tty 8bit clean + /* make tty 8bit clean */ if (tcgetattr(fdin, &prev_termios) != -1) prev_termios_stored = 1; memset((char *) &termios, 0, sizeof(termios)); @@ -108,12 +108,12 @@ static void restore_tty_flags() static void eol_convention(int state_should) { - // need patched axspawn + /* need patched axspawn */ #define BIN_ON "//BIN ON\r" #define BIN_OFF "//BIN OFF\r" static int state_is = 0; - // already in correct state? + /* already in correct state? */ if ((state_is && state_should) || (!state_is && !state_should)) return; @@ -205,7 +205,7 @@ static void usage(int all) { /*---------------------------------------------------------------------------*/ -// not implemented +/* not implemented */ static int yput(void) { strcpy(err_msg, "yapp: not implementet yet\n"); return 1; } static int yget(void) { strcpy(err_msg, "yapp: not implementet yet\n"); return 1; } static int rget(void) { strcpy(err_msg, "yapp: not implementet yet\n"); return 1; } @@ -230,9 +230,9 @@ int main(int argc, char *argv[]) revision.author, revision.state); - // determine what to so in the way how we are called + /* determine what to so in the way how we are called */ if ((p = strrchr(argv[0], '/'))) - p++; // skip '/' + p++; /* skip '/' */ else p = argv[0]; len = strlen(p); @@ -282,7 +282,7 @@ int main(int argc, char *argv[]) signal(SIGTERM, signal_handler); signal(SIGINT, signal_handler); -// for difference betreen "bput -f file" and "bget file" +/* for difference betreen "bput -f file" and "bget file" */ #define get_filename(f) { \ if (!strcmp(f, "-")) { \ if (mode % 2) \ diff --git a/ax25/axgetput/axgetput.h b/ax25/axgetput/axgetput.h index 410c77d..59f1c74 100644 --- a/ax25/axgetput/axgetput.h +++ b/ax25/axgetput/axgetput.h @@ -1,4 +1,4 @@ -/* @(#) $Id: axgetput.h,v 1.1 2006/12/10 19:12:59 dl9sau Exp $ */ +/* @(#) $Id: axgetput.h,v 1.2 2007/01/23 13:40:01 ralf Exp $ */ /* * (c) 2002 Thomas Osterried DL9SAU @@ -27,7 +27,7 @@ extern int do_crc_only; extern char c_eol; extern char *send_on_signal; -// modes +/* modes */ #define RECV_BIN 1 /* #BIN# protocol: receive */ #define SEND_BIN 2 /* #BIN# protocol: send */ #define RECV_YAPP 3 /* yapp protocol: receive */ @@ -36,7 +36,7 @@ extern char *send_on_signal; #define SEND_DIDADIT 6 /* didadit protocol: send */ -// block sizes +/* block sizes */ extern unsigned int BLOCKSIZ; diff --git a/ax25/axgetput/proto_bin.c b/ax25/axgetput/proto_bin.c index c826ec3..f436933 100644 --- a/ax25/axgetput/proto_bin.c +++ b/ax25/axgetput/proto_bin.c @@ -1,4 +1,4 @@ -/* @(#) $Id: proto_bin.c,v 1.1 2006/12/10 19:12:59 dl9sau Exp $ */ +/* @(#) $Id: proto_bin.c,v 1.2 2007/01/23 13:40:01 ralf Exp $ */ /* * (c) 2002 Thomas Osterried DL9SAU @@ -102,8 +102,10 @@ int bput(void) return 1; } if (buf[len-1] == '\n') { - //p = "warning: received. not 8bit clean?\r"; - //secure_write(fdout, p, strlen(p)); +#if 0 + p = "warning: received. not 8bit clean?\r"; + secure_write(fdout, p, strlen(p)); +#endif sprintf(err_msg, "bad EOL: \n"); return 1; } @@ -119,7 +121,7 @@ int bput(void) return 1; } } - buf[len-1] = 0; // without trailing \r. and: string termination + buf[len-1] = 0; /* without trailing \r. and: string termination */ send_on_signal = bin_send_no_on_sig; @@ -140,14 +142,14 @@ int bput(void) filename_given[sizeof(filename_given)-1] = 0; if (!fdout_is_pipe) { - // normal mode: store in given filename + /* normal mode: store in given filename */ if (!*filename) { p = get_fixed_filename(filename_given, len_read_expected, msg_crc, 1); strncpy(filename, p, sizeof(filename)-1); filename[sizeof(filename)-1] = 0; } if (!stat(filename, &statbuf)) { - // file exist + /* file exist */ if (unlink(filename)) { sprintf(err_msg, "error: cannot unlink %s (%s)\n", filename, strerror(errno)); goto abort; @@ -165,13 +167,13 @@ int bput(void) len_termline = strlen(term_line); } - // say helo + /* say helo */ send_on_signal = bin_send_abort_on_sig; write(fderr, "\r#OK#\r", 6); len_read_left = len_read_expected; - // #bin# chechsum initialization + /* #bin# chechsum initialization */ init_crc(); for (;;) { @@ -199,16 +201,16 @@ int bput(void) if (buf[len-1] == '\r') { if (last_line_had_CR) { if (IS_BIN_ABORT(buf, len)) { - // "\r#ABORT#\r" was sent + /* "\r#ABORT#\r" was sent */ if (!fdout_is_pipe) { close(fddata); - // clean up + /* clean up */ unlink(filename); } return 1; } if (term_line && len == len_termline && !memcmp(buf, term_line, len_termline)) { - // sucessfully read until termination string + /* sucessfully read until termination string */ break; } } @@ -225,7 +227,7 @@ int bput(void) goto abort; } - // nothing left? + /* nothing left? */ if (!term_line && len_read_left == 0L) break; if (is_eof) { @@ -238,7 +240,7 @@ int bput(void) } if (crc != msg_crc) { sprintf(err_msg, "Invalid crc: computed %d, expected %d.\n", crc, msg_crc); - // don't unlink + /* don't unlink */ save_close(fddata); return 1; } @@ -322,7 +324,7 @@ int bget(void) { else file_time = time(0); - // compute crc + /* compute crc */ while ((len = read(fddata, buf, BLOCKSIZ)) > 0) { int i; for (i = 0; i < len; i++) @@ -334,7 +336,7 @@ int bget(void) { close(fddata); return 1; } - // rewind + /* rewind */ if (lseek(fddata, 0L, SEEK_SET) != 0L) { sprintf(err_msg, "error: file io failed on lseek() (%s)\n", strerror(errno)); close(fddata); @@ -363,9 +365,11 @@ int bget(void) { } else { sprintf(buf, "\r#BIN###$%s#%s\r", unix_to_sfbin_date_string(file_time), get_fixed_filename(filename, 0, 0, 1)); } - // hack: check for #ABORT# from fdout (fd 1), because fddata (fd 0) is - // our pipe we read the data from, which we actually tx. - // believe me, it does work. + /* + * hack: check for #ABORT# from fdout (fd 1), because fddata (fd 0) is + * our pipe we read the data from, which we actually tx. + * believe me, it does work. + */ fdin = fdout; } @@ -382,10 +386,12 @@ int bget(void) { return 1; } - // wait for answer + /* wait for answer */ for (;;) { - // . make sure we do not read from a pipe. fdout is also - // | assigned to the tty + /* + * make sure we do not read from a pipe. fdout is also + * assigned to the tty + */ len = my_read(fdout, buf, sizeof(buf), &is_eof, "\r\n"); if (is_eof || len < 1) { sprintf(err_msg, "error: read failed (%s)\n", strerror(errno)); @@ -393,8 +399,10 @@ int bget(void) { return 1; } if (buf[len-1] == '\n') { - //char *p = "warning: received. not 8bit clean?\r"; - //secure_write(fdout, p, strlen(p)); +#if 0 + char *p = "warning: received. not 8bit clean?\r"; + secure_write(fdout, p, strlen(p)); +#endif sprintf(err_msg, "bad EOL: \n"); goto abort; } else if (buf[len-1] != '\r') { @@ -421,7 +429,7 @@ int bget(void) { for (;;) { char *p_buf; - // check for user \r#ABORT#\r on tty stream + /* check for user \r#ABORT#\r on tty stream */ FD_ZERO(&readfds); FD_SET(fdin, &readfds); if (select(fdin+1, &readfds, 0, 0, &timeout) && FD_ISSET(fdin, &readfds)) { @@ -436,7 +444,7 @@ int bget(void) { return 1; } } - // read data + /* read data */ if (!fdin_is_pipe || is_stream) { p_buf = buf; if ((len = my_read(fddata, buf, ((len_remains > BLOCKSIZ || is_stream) ? BLOCKSIZ : len_remains), &is_eof, 0)) < 1) { @@ -452,7 +460,7 @@ int bget(void) { p_buf = stored_file->data; len = stored_file->len; } - // write to client + /* write to client */ if (secure_write(fdout, p_buf, len) == -1) { sprintf(err_msg, "error: write failed (%s)\n", strerror(errno)); save_close(fddata); @@ -471,8 +479,10 @@ int bget(void) { is_eof = 1; break; } - // need this because my_read may returned lenth != 0 (data to be written) - // but also has detected EOF. + /* + * need this because my_read may returned lenth != 0 (data to be written) + * but also has detected EOF. + */ if (is_eof) break; } diff --git a/ax25/axgetput/util.c b/ax25/axgetput/util.c index 160647f..b1d4cd3 100644 --- a/ax25/axgetput/util.c +++ b/ax25/axgetput/util.c @@ -1,4 +1,4 @@ -/* @(#) $Id: util.c,v 1.1 2006/12/10 19:12:59 dl9sau Exp $ */ +/* @(#) $Id: util.c,v 1.2 2007/01/23 13:40:01 ralf Exp $ */ /* * (c) 2002 Thomas Osterried DL9SAU @@ -60,13 +60,15 @@ int my_read(int fd, char *s, int len_max, int *eof, char *p_break) continue; } *eof = 1; - // len = 0: normal eof. if we're looking for a string, return -1 since - // we have'nt found + /* + * len = 0: normal eof. if we're looking for a string, return -1 since + * we have'nt found + */ return (len == 0 && p_break ? -1 : (len_got ? len_got : len)); } len_got += len; - // read once? or char in p_break found? + /* read once? or char in p_break found? */ if (!p_break || strchr(p_break, *s_curr)) break; } @@ -95,7 +97,7 @@ int secure_write(int fd, char *s, int len_write) { return -1; } if (len != len_write_left_curr) { - // queue busy.. + /* queue busy.. */ sleep(10); } s += len; diff --git a/ax25/axspawn.c b/ax25/axspawn.c index 6f3bc94..dbaa3d7 100644 --- a/ax25/axspawn.c +++ b/ax25/axspawn.c @@ -1,6 +1,6 @@ /* * - * $Id: axspawn.c,v 1.10 2006/12/16 10:44:03 dl9sau Exp $ + * $Id: axspawn.c,v 1.11 2007/01/23 13:40:01 ralf Exp $ * * axspawn.c - run a program from ax25d. * @@ -141,7 +141,7 @@ with new login/libc - Terry, vk2ktj. */ -//#define QUEUE_DELAY 400 /* 400 usec */ +/*#define QUEUE_DELAY 400 / * 400 usec */ #define QUEUE_DELAY 100000 /* 10 msec */ #define USERPROFILE ".profile" #define PASSWDFILE "/etc/passwd" @@ -665,7 +665,7 @@ int _write_ax25(const char *s, int len) i = write(1, s, len); fflush(stdout); - return (i > 0 ? i : 0); // on error, -1 is returned + return (i > 0 ? i : 0); /* on error, -1 is returned */ } int read_ax25(unsigned char *s, int size) @@ -766,7 +766,7 @@ void kick_wqueue(int dummy) return; } - // recompute waitqueue + /* recompute waitqueue */ if (wqueue_head->len < bufsize && wqueue_head->next) { int s_len; if (!(s = malloc(bufsize))) { @@ -785,7 +785,7 @@ void kick_wqueue(int dummy) s_len += curr_len; p += curr_len; if (w_buf->len > curr_len) { - // rewrite current buffer, and break + /* rewrite current buffer, and break */ w_buf->len -= curr_len; for (q = w_buf->data, r = w_buf->data+curr_len, i = 0; i < w_buf->len; i++) *q++ = *r++; @@ -812,14 +812,19 @@ void kick_wqueue(int dummy) len = curr_len; } if (!_write_ax25(s, len) && errno == EAGAIN) { - // socket busy? - // don't block, user may want interrupt the jam + /* + * socket busy? + * don't block, user may want interrupt the jam + */ itv.it_value.tv_sec = 1; break; } wqueue_length -= curr_len; if (w_buf->len > curr_len) { - // there's still data to be written - copy restbuffer to left + /* + * there's still data to be written - copy restbuffer + * to left + */ w_buf->len -= curr_len; for (q = w_buf->data, r = w_buf->data+curr_len, i = 0; i < w_buf->len; i++) *q++ = *r++; @@ -834,8 +839,10 @@ void kick_wqueue(int dummy) } } - // if only a few bytes are left, wait a few ms if - // new data is available in order to send "full packets" + /* + * if only a few bytes are left, wait a few ms if + * new data is available in order to send "full packets" + */ if (wqueue_length < paclen) break; } @@ -898,7 +905,9 @@ int write_ax25(char *s, int len, int kick) if (!bin) { p = s; i = 0; j = 0; if (last_ended_with_CR) { - // \r\n was splited. wrote already \r, now ommiting \n + /* + * \r\n was splited. wrote already \r, now ommiting \n + */ if (*s == '\n') { s++, p++; len--; diff --git a/ax25/bpqparms.c b/ax25/bpqparms.c index eb4137e..62eeab8 100644 --- a/ax25/bpqparms.c +++ b/ax25/bpqparms.c @@ -30,14 +30,14 @@ #include #ifdef __GLIBC__ -#include // is this really needed ?? +#include /* is this really needed ?? */ #endif #include /* xlz - dammit, we need this again */ #include -#define RCS_ID "$Id: bpqparms.c,v 1.2 2005/11/28 19:29:16 dl9sau Exp $" +#define RCS_ID "$Id: bpqparms.c,v 1.3 2007/01/23 13:40:01 ralf Exp $" void usage(void) { @@ -47,7 +47,7 @@ void usage(void) exit(1); } -char *Version = "$Revision: 1.2 $"; +char *Version = "$Revision: 1.3 $"; int get_hwaddr(unsigned char *k, char *s) { diff --git a/ax25/rxecho.c b/ax25/rxecho.c index 361454b..eb46810 100644 --- a/ax25/rxecho.c +++ b/ax25/rxecho.c @@ -67,16 +67,18 @@ #include -// dl9sau: -// uncomment this if you have problems with sockaddr_pkt. -// sockaddr_pkt is the right way for type SOCK_PACKET on family AF_INET sockets. -// especially because the "sockaddr" on recvfrom is truncated (internaly -// it's sockaddr_pkt) -- and because we use this sockaddr for retransmitting, -// it's really better to use the sockaddr_spkt. -// default is to use SOCKADDR_SPKT +/* + * dl9sau: + * uncomment this if you have problems with sockaddr_pkt. + * sockaddr_pkt is the right way for type SOCK_PACKET on family AF_INET sockets. + * especially because the "sockaddr" on recvfrom is truncated (internaly + * it's sockaddr_pkt) -- and because we use this sockaddr for retransmitting, + * it's really better to use the sockaddr_spkt. + * default is to use SOCKADDR_SPKT + */ #define USE_SOCKADDR_SPKT 1 -//dl9sau: since linux 2.2.x, SOCK_PACKET is obsolete +/* dl9sau: since linux 2.2.x, SOCK_PACKET is obsolete */ #define USE_SOCKADDR_SLL 1 #ifdef USE_SOCKADDR_SLL @@ -428,7 +430,7 @@ int main(int argc, char **argv) char *p_name = (i ? p->to : p->from); int *p_idx = (i ? &p->to_idx : &p->from_idx); - // already set? + /* already set? */ if (*p_idx >= 0) continue; strncpy(ifr.ifr_name, p_name, sizeof(ifr.ifr_name)-1); @@ -473,9 +475,11 @@ int main(int argc, char **argv) #ifdef USE_SOCKADDR_SLL from_idx = sll.sll_ifindex; #else - // dl9sau: save the names of the iface the frame came from; - // we'll overwrite psa->sa_data it for sendto() and need the - // name again when multiplexing to more than one iface + /* + * dl9sau: save the names of the iface the frame came from; + * we'll overwrite psa->sa_data it for sendto() and need the + * name again when multiplexing to more than one iface + */ strncpy(from_dev_name, psa->sa_data, sizeof(from_dev_name)-1); from_dev_name[sizeof(from_dev_name)-1] = 0; #endif @@ -488,18 +492,20 @@ int main(int argc, char **argv) if ((strcmp(p->from, from_dev_name) == 0) && (check_calls(p, buf, size) == 0)) { strcpy(psa->sa_data, p->to); #endif - // cave: alen (set by recvfrom()) may > salen - // which means it may point beyound of the - // end of the struct. thats why we use the - // correct len (sa_len). this fixes a bug - // where skpt->protocol on sockaddr structs - // pointed behind the struct, leading to - // funny protocol IDs. - // btw, the linux kernel internaly always - // maps to sockaddr to sockaddr_pkt - // on sockets of type SOCK_PACKET on family - // AF_INET. sockaddr_pkt is len 18, sockaddr - // is 16. + /* + * cave: alen (set by recvfrom()) may > salen + * which means it may point beyound of the + * end of the struct. thats why we use the + * correct len (sa_len). this fixes a bug + * where skpt->protocol on sockaddr structs + * pointed behind the struct, leading to + * funny protocol IDs. + * btw, the linux kernel internaly always + * maps to sockaddr to sockaddr_pkt + * on sockets of type SOCK_PACKET on family + * AF_INET. sockaddr_pkt is len 18, sockaddr + * is 16. + */ if (sendto(s, buf, size, 0, psa, sa_len) == -1) { if (logging) { syslog(LOG_ERR, "sendto: %m"); diff --git a/kiss/kissparms.c b/kiss/kissparms.c index fd178ae..cfc57d6 100644 --- a/kiss/kissparms.c +++ b/kiss/kissparms.c @@ -42,7 +42,6 @@ int main(int argc, char *argv[]) { - //unsigned char buffer[2]; unsigned char buffer[256]; struct sockaddr sa; int proto = ETH_P_AX25; -- cgit v1.2.3