From 561fa5359c69c006cf09827d2eb97daa6527b95f Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Tue, 23 Jan 2007 13:40:04 +0000 Subject: Fix warnings about // style comment. And remove some of the most pointless comments. --- ax25ipd/bpqether.c | 44 +++++++++++++++---------- ax25ipd/io.c | 2 +- ax25mond/ax25mond.c | 31 +++++++++--------- listen/ax25dump.c | 4 +-- listen/listen.c | 4 +-- listen/opentracdump.c | 90 ++++++++++++++++++++++++--------------------------- 6 files changed, 90 insertions(+), 85 deletions(-) diff --git a/ax25ipd/bpqether.c b/ax25ipd/bpqether.c index 1ad9618..bfb9acd 100644 --- a/ax25ipd/bpqether.c +++ b/ax25ipd/bpqether.c @@ -1,4 +1,4 @@ -/* @(#) $Id: bpqether.c,v 1.2 2005/10/31 02:54:27 dl9sau Exp $ */ +/* @(#) $Id: bpqether.c,v 1.3 2007/01/23 13:40:04 ralf Exp $ */ extern int ttyfd; /* @@ -91,7 +91,7 @@ p module) */ ethertap_packet.data[1] = (l + 5) / 256; l += 2; - //send_tty(addr + offset, l + sizeof(ethertap_packet.ethernet_header) - offset); + /*send_tty(addr + offset, l + sizeof(ethertap_packet.ethernet_header) - offset);*/ write(ttyfd, addr + offset, l + sizeof(ethertap_packet.ethernet_header) - offset); return l; } @@ -103,13 +103,15 @@ int receive_bpq(unsigned char *buf, int l) if ((l -= ethertap_header_len) <= 0 || (buf[ethertap_header_len-2] & 0xff) != 0x08 || (buf[ethertap_header_len-1] & 0xff) != 0xff) { - // not a bpqether packet. - // drop silently - ethernet.ax25 is not the only protocol spokenon ethernet ;) + /* not a bpqether packet. + * drop silently - ethernet.ax25 is not the only protocol spoken + * on ethernet ;) + */ return -1; } l -= 2; if (l <= 0 && buf[ethertap_header_len] + buf[ethertap_header_len] * 256 - 5 != l) { - // length error in bpqether packet + /* length error in bpqether packet */ return 0; } @@ -149,12 +151,16 @@ static int tun_alloc(char *dev) strcpy(dev, ifr.ifr_name); /* persist mode */ - //if (ioctl(fd, TUNSETPERSIST, 1) < 0) - //perror("TUNSETPERSIST"); +#if 0 + if (ioctl(fd, TUNSETPERSIST, 1) < 0) + perror("TUNSETPERSIST"); +#endif /* don't checksum */ - //if (ioctl(fd, TUNSETNOCSUM, 1) < 0) - //perror("TUNSETNOCSUM"); +#if 0 + if (ioctl(fd, TUNSETNOCSUM, 1) < 0) + perror("TUNSETNOCSUM"); +#endif return fd; } @@ -177,7 +183,7 @@ int open_ethertap(char *ifname) strncpy(devname + 5, ifname, sizeof(devname) - 5 -1); devname[sizeof(devname) -1] = 0; - // tuntap == 0: original ethertap. works on a real character device + /* tuntap == 0: original ethertap. works on a real character device */ if (!stat(devname, &statbuf)) { fd = open(devname, O_RDWR); if (fd < 0) { @@ -265,24 +271,28 @@ int set_bpq_dev_call_and_up(char *ifname) int skfd; int err = -1; - // 1. find correspondent bpqether device in /proc (i.e. bpq0 for tap0) - // 2. set the ax25 call of bpq0 (in this example) - // 3. ifup bpq0 + /* + * 1. find correspondent bpqether device in /proc (i.e. bpq0 for tap0) + * 2. set the ax25 call of bpq0 (in this example) + * 3. ifup bpq0 + */ if (!(fp = fopen("/proc/net/bpqether", "r"))) { perror("/proc/net/bpqether"); return -1; } - // look up bpqether devce in /proc: - // dev ether destination accept from - // bpq0 tap0 FF:FF:FF:FF:FF:FF * + /* + * look up bpqether devce in /proc: + * dev ether destination accept from + * bpq0 tap0 FF:FF:FF:FF:FF:FF * + */ drop = 1; *bpq_name = *dev_name = 0; while (fgets(buf, sizeof(buf), fp)) { if (drop) { - // header line + /* header line */ drop = 0; continue; } diff --git a/ax25ipd/io.c b/ax25ipd/io.c index 2eeb0ea..2e3ec07 100644 --- a/ax25ipd/io.c +++ b/ax25ipd/io.c @@ -366,7 +366,7 @@ void io_start() { if (!ttyfd_bpq) { assemble_kiss(buf, n); } else { - // no crc on bpqether. but a MAC header + /* no crc but MAC header on bpqether */ if (receive_bpq(buf, n) < 0) { goto out_ttyfd; } diff --git a/ax25mond/ax25mond.c b/ax25mond/ax25mond.c index 2d19be0..efcceb0 100644 --- a/ax25mond/ax25mond.c +++ b/ax25mond/ax25mond.c @@ -47,7 +47,7 @@ #include #include -// For older kernels +/* For older kernels */ #ifndef PF_PACKET #define PF_PACKET PF_INET #endif @@ -247,16 +247,16 @@ int main(int argc, char *argv[]) exit(0); } } - // At first, read the configuration file + /* At first, read the configuration file */ if (!(conffile = fopen(CONFFILE, "r"))) { fprintf(stderr, "Unable to open " CONFFILE ".\n"); exit(1); } while (fgets(confline, 100, conffile)) { - if (confline[0] == '#') // Comment + if (confline[0] == '#') /* Comment */ continue; - confline[strlen(confline) - 1] = 0; // Cut the LF + confline[strlen(confline) - 1] = 0; /* Cut the LF */ if (!(sockname = strchr(confline, ' '))) { fprintf(stderr, @@ -283,22 +283,22 @@ int main(int argc, char *argv[]) fprintf(stderr, "FATAL: No usable socket found\n"); exit(1); } - // Fork into background + /* Fork into background */ if (fork()) exit(0); - // Close stdout, stderr and stdin + /* Close stdout, stderr and stdin */ fclose(stdout); fclose(stderr); fclose(stdin); - // Set some signal handlers + /* Set some signal handlers */ signal(SIGPIPE, SIG_IGN); signal(SIGTERM, quit_handler); openlog("ax25mond", LOG_PID, LOG_DAEMON); - // Open AX.25 socket for monitoring RX traffic only + /* Open AX.25 socket for monitoring RX traffic only */ if ((monrx_fd = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_AX25))) < 0) { syslog(LOG_ERR, "Error opening monitor socket: %s\n", @@ -307,7 +307,7 @@ int main(int argc, char *argv[]) } fcntl(monrx_fd, F_SETFL, O_NONBLOCK); - // Open AX.25 socket for monitoring RX and TX traffic + /* Open AX.25 socket for monitoring RX and TX traffic */ if ((monrxtx_fd = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_ALL))) < 0) { syslog(LOG_ERR, "Error opening monitor socket: %s\n", @@ -317,8 +317,7 @@ int main(int argc, char *argv[]) fcntl(monrxtx_fd, F_SETFL, O_NONBLOCK); while (!end) { - - // Look for incoming connects on all open sockets + /* Look for incoming connects on all open sockets */ FD_ZERO(&conn_request); for (i = 0; i < sock_num; i++) FD_SET(sock_list[i], &conn_request); @@ -335,7 +334,7 @@ int main(int argc, char *argv[]) conn_monmode[conn_num] = sock_monmode[i]; conn_num++; } - // Check if there is new data on the RX-only monitor socket + /* Check if there is new data on the RX-only monitor socket */ FD_ZERO(&monavail); FD_SET(monrx_fd, &monavail); tv.tv_sec = 0; @@ -346,7 +345,7 @@ int main(int argc, char *argv[]) size = recvfrom(monrx_fd, buf, sizeof(buf), 0, &monfrom, &monfromlen); - // Send the packet to all connected sockets + /* Send the packet to all connected sockets */ for (i = 0; i < conn_num; i++) { if (conn_monmode[i] == 0) if (send @@ -366,7 +365,7 @@ int main(int argc, char *argv[]) } } } - // Check if there is new data on the RX+TX monitor socket + /* Check if there is new data on the RX+TX monitor socket */ FD_ZERO(&monavail); FD_SET(monrxtx_fd, &monavail); tv.tv_sec = 0; @@ -377,11 +376,11 @@ int main(int argc, char *argv[]) size = recvfrom(monrxtx_fd, buf, sizeof(buf), 0, &monfrom, &monfromlen); - // Check, if we have received a AX.25-packet + /* Check, if we have received a AX.25-packet */ strcpy(ifr.ifr_name, monfrom.sa_data); ioctl(monrxtx_fd, SIOCGIFHWADDR, &ifr); if (ifr.ifr_hwaddr.sa_family == AF_AX25) - // Send the packet to all connected sockets + /* Send the packet to all connected sockets */ for (i = 0; i < conn_num; i++) { if (conn_monmode[i] == 1) if (send diff --git a/listen/ax25dump.c b/listen/ax25dump.c index 0ecb409..93e569d 100644 --- a/listen/ax25dump.c +++ b/listen/ax25dump.c @@ -1,4 +1,4 @@ -/* @(#) $Header: /home/ax25-cvs/ax25-apps/listen/ax25dump.c,v 1.4 2004/02/04 10:48:28 csmall Exp $ */ +/* @(#) $Header: /home/ax25-cvs/ax25-apps/listen/ax25dump.c,v 1.5 2007/01/23 13:40:04 ralf Exp $ */ /* AX25 header tracing * Copyright 1991 Phil Karn, KA9Q @@ -109,7 +109,7 @@ void ax25_dump(unsigned char *data, int length, int hexdump) if ((data[AXLEN + ALEN] & SSSID_SPARE) == SSSID_SPARE) { extseq = 0; -// lprintf(T_PROTOCOL, " "); +/* lprintf(T_PROTOCOL, " "); */ } else { extseq = 1; lprintf(T_PROTOCOL, "EAX25: "); diff --git a/listen/listen.c b/listen/listen.c index e28bb4e..5b70fb9 100644 --- a/listen/listen.c +++ b/listen/listen.c @@ -160,7 +160,7 @@ int main(int argc, char **argv) #else ki_dump(buffer, size, dumpstyle); #endif -// lprintf(T_DATA, "\n"); +/* lprintf(T_DATA, "\n"); */ } } else { display_port(sa.sa_data); @@ -169,7 +169,7 @@ int main(int argc, char **argv) #else ki_dump(buffer, size, dumpstyle); #endif -// lprintf(T_DATA, "\n"); +/* lprintf(T_DATA, "\n"); */ } if (color) refresh(); diff --git a/listen/opentracdump.c b/listen/opentracdump.c index 7a76df2..b4827f1 100644 --- a/listen/opentracdump.c +++ b/listen/opentracdump.c @@ -18,9 +18,9 @@ const char *units[]={"Volts","Amperes","Watts","Kelvins","Meters","Seconds", "Pascal Seconds","Kilograms/Meter^3","Radians/Second^2","Coulombs", "Farads","Siemens","Count"}; -unsigned char origin_call[7]; // Who's talking +unsigned char origin_call[7]; /* Who's talking */ unsigned char origin_ssid; -unsigned char entity_call[7]; // What they're talking about +unsigned char entity_call[7]; /* What they're talking about */ unsigned char entity_ssid; unsigned int entity_serial; unsigned int entity_sequence; @@ -28,7 +28,7 @@ unsigned int entity_sequence; int extract_ssid(unsigned char *call) { - // Strip the SSID from the callsign and return it + /* Strip the SSID from the callsign and return it */ int c, ssid; for (c=ssid=0;c<6;c++) { @@ -42,10 +42,10 @@ int extract_ssid(unsigned char *call) { int decode_units(unsigned int unitnum, unsigned char *element, int element_len); -// Return values: 0 = OK, -1 = Couldn't Decode, -2 = Invalid Data +/* Return values: 0 = OK, -1 = Couldn't Decode, -2 = Invalid Data */ int decode_sequence(unsigned char *element, int element_len) { - // 0x00 Sequence number - 16 bit integer + /* 0x00 Sequence number - 16 bit integer */ if (element_len != 2 && element_len != 0) return -1; if (!element_len) { @@ -61,7 +61,7 @@ int decode_sequence(unsigned char *element, int element_len) { } int decode_origination(unsigned char *element, int element_len) { - // 0x01 Originating Station - Callsign, SSID, and Sequence + /* 0x01 Originating Station - Callsign, SSID, and Sequence */ memcpy(origin_call, element, 6); origin_call[6]=0; origin_ssid = extract_ssid(origin_call); @@ -76,7 +76,7 @@ int decode_origination(unsigned char *element, int element_len) { } int decode_entityid(unsigned char *element, int element_len) { - // 0x02 Entity ID + /* 0x02 Entity ID */ if (element_len > 5) { memcpy(entity_call, element, 6); entity_call[6]=0; @@ -120,8 +120,10 @@ int decode_entityid(unsigned char *element, int element_len) { } int decode_position(unsigned char *element, int element_len) { - // 0x10 Position Report - Lat/Lon/ - // Lat/Lon is WGS84, 180/2^31 degrees, Alt is 1/100 meter + /* + * 0x10 Position Report - Lat/Lon/ + * Lat/Lon is WGS84, 180/2^31 degrees, Alt is 1/100 meter + */ const double semicircles = 11930464.71111111111; double lat, lon; float alt = 0; @@ -142,7 +144,7 @@ int decode_position(unsigned char *element, int element_len) { } int decode_timestamp(unsigned char *element, int element_len) { - // 0x11 Timestamp - Unix format time (unsigned) + /* 0x11 Timestamp - Unix format time (unsigned) */ long rawtime = 0; rawtime = get32(element); @@ -151,7 +153,7 @@ int decode_timestamp(unsigned char *element, int element_len) { } int decode_comment(unsigned char *element, int element_len) { - // 0x12 Freeform Comment - ASCII text + /* 0x12 Freeform Comment - ASCII text */ char comment[127]; strncpy(comment, element, element_len); @@ -162,14 +164,14 @@ int decode_comment(unsigned char *element, int element_len) { } int decode_courseandspeed(unsigned char *element, int element_len) { - // 0x13 Course and Speed - Course in degrees, speed in 1/50 m/s + /* 0x13 Course and Speed - Course in degrees, speed in 1/50 m/s */ unsigned int course; unsigned int rawspeed; float speed; course = (*element<<1) | ((*(element+1)&0x80) >> 7); rawspeed = get16(element+1) & 0x7fff; - speed = (float)rawspeed*0.072; // kph + speed = (float)rawspeed*0.072; /* km/h */ if (course >= 360) return -2; lprintf(T_OPENTRAC, "Course: %d Speed: %f kph\r\n", course, speed); @@ -177,7 +179,7 @@ int decode_courseandspeed(unsigned char *element, int element_len) { } int decode_ambiguity(unsigned char *element, int element_len) { - // 0x14 Positional Ambiguity - 16 bits, in meters + /* 0x14 Positional Ambiguity - 16 bits, in meters */ int ambiguity; ambiguity = get16(element); @@ -186,7 +188,7 @@ int decode_ambiguity(unsigned char *element, int element_len) { } int decode_country(unsigned char *element, int element_len) { - // 0x15 Country Code - ISO 3166-1 and optionally -2 + /* 0x15 Country Code - ISO 3166-1 and optionally -2 */ char country[3]; char subdivision[4]; @@ -204,8 +206,7 @@ int decode_country(unsigned char *element, int element_len) { } int decode_displayname(unsigned char *element, int element_len) { -// 0x16 - Display Name (UTF-8 text) - char displayname[31]; + char displayname[31]; /* 0x16 - Display Name (UTF-8 text) */ strncpy(displayname, element, element_len); displayname[element_len] = 0; @@ -215,8 +216,7 @@ int decode_displayname(unsigned char *element, int element_len) { } int decode_waypoint(unsigned char *element, int element_len) { -// 0x17 - Waypoint Name (up to 6 chars, uppercase) - char waypoint[7]; + char waypoint[7]; /* 0x17 - Waypoint Name (up to 6 chars, uppercase) */ strncpy(waypoint, element, element_len); waypoint[element_len] = 0; @@ -226,8 +226,7 @@ int decode_waypoint(unsigned char *element, int element_len) { } int decode_symbol(unsigned char *element, int element_len) { - // 0x18 Map Symbol - Packed 4-bit integers - int c; + int c; /* 0x18 Map Symbol - Packed 4-bit integers */ lprintf(T_OPENTRAC, "Symbol: "); for (c=0;c MAX_UNIT_INDEX) return -2; // Invalid unit name + if (unitnum > MAX_UNIT_INDEX) return -2; /* Invalid unit name */ mval = (void *)element; switch (element_len) { case 1: @@ -376,19 +372,19 @@ int decode_units(unsigned int unitnum, unsigned char *element, int element_len) } int flag_emergency(unsigned char *element, int element_len) { - // 0x0100 - Emergency / Distress Call + /* 0x0100 - Emergency / Distress Call */ lprintf(T_ERROR, "* * * EMERGENCY * * *\r\n"); return 0; } int flag_attention(unsigned char *element, int element_len) { - // 0x0101 - Attention / Ident + /* 0x0101 - Attention / Ident */ lprintf(T_PROTOCOL, " - ATTENTION - \r\n"); return 0; } int decode_hazmat(unsigned char *element, int element_len) { -// 0x0300 - HAZMAT (UN ID in lower 14 bits) + /* 0x0300 - HAZMAT (UN ID in lower 14 bits) */ int un_id; if (element_len < 2) { @@ -402,7 +398,7 @@ int decode_hazmat(unsigned char *element, int element_len) { } int decode_maidenhead(unsigned char *element, int element_len) { -// 0x32 - Maidenhead Locator (4 or 6 chars) + /* 0x32 - Maidenhead Locator (4 or 6 chars) */ char maidenhead[7]; if (element_len > 6 || !element_len) return -1; @@ -453,22 +449,22 @@ void opentrac_dump(unsigned char *data, int length, int hexdump) int decoded = 0; lprintf(T_PROTOCOL, "OpenTRAC decode (%d bytes):\r\n", length); - strcpy(origin_call, "SENDER"); // Listen doesn't tell us the sender + strcpy(origin_call, "SENDER"); /* Listen doesn't tell us the sender */ origin_ssid = 0; entity_serial = 0; entity_sequence = 0; while (decoded < length) { elen = (int)*data; decoded += (elen & 0x7f)+1; - if (elen & 0x80) { // See if it's got a 16-bit ID - elen = (elen & 0x7f) - 2; // Strip the extid flag + if (elen & 0x80) { /* See if it's got a 16-bit ID */ + elen = (elen & 0x7f) - 2; /* Strip the extid flag */ etype = get16(++data); } else { - elen--; // Don't count the type byte + elen--; /* Don't count the type byte */ etype = (int)*(data+1); } - data+=2; // Skip to the body + data+=2; /* Skip to the body */ lprintf(T_OPENTRAC, "EID 0x%0x len %d: ", etype, elen); for (element_decode_ptr = element_decode; element_decode_ptr->pDecode != NULL; element_decode_ptr++) { if (etype == element_decode_ptr->element_id) { -- cgit v1.2.3