Ethereal-dev: [Ethereal-dev] Add some missing static declarations (editcap, text2pcap)

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Sun, 30 Jun 2002 16:52:00 +0200
see subject/changelog

  Ciao
       Jörg
--
Joerg Mayer                                          <jmayer@xxxxxxxxx>
I found out that "pro" means "instead of" (as in proconsul). Now I know
what proactive means.
Changelog: <jmayer@xxxxxxxxx>
	editcap.c, text2pcap.c: Add some missing static declarations.

Index: ethereal/editcap.c
===================================================================
RCS file: /cvsroot/ethereal/editcap.c,v
retrieving revision 1.23
diff -u -r1.23 editcap.c
--- editcap.c	2002/06/23 10:32:13	1.23
+++ editcap.c	2002/06/30 14:48:17
@@ -53,8 +53,8 @@
   int is_negative;
 };
 
-struct select_item selectfrm[100];
-int max_selected = -1;
+static struct select_item selectfrm[100];
+static int max_selected = -1;
 static int count = 1;
 static int keep_em = 0;
 static int out_file_type = WTAP_FILE_PCAP;   /* default to "libpcap"   */
@@ -65,7 +65,7 @@
 
 /* Add a selection item, a simple parser for now */
 
-void add_selection(char *sel) 
+static void add_selection(char *sel) 
 {
   char *locn;
   char *next;
@@ -105,7 +105,7 @@
 
 /* Was the record selected? */
 
-int selected(int recno)
+static int selected(int recno)
 {
   int i = 0;
 
@@ -272,7 +272,7 @@
   time_adj.tv.tv_usec = val;
 }
 
-void usage()
+static void usage()
 {
   int i;
   const char *string;
Index: ethereal/text2pcap.c
===================================================================
RCS file: /cvsroot/ethereal/text2pcap.c,v
retrieving revision 1.17
diff -u -r1.17 text2pcap.c
--- text2pcap.c	2002/06/23 10:32:18	1.17
+++ text2pcap.c	2002/06/30 14:48:18
@@ -128,45 +128,45 @@
 /*--- Options --------------------------------------------------------------------*/
 
 /* Debug level */
-int debug = 0; 
+static int debug = 0; 
 /* Be quiet */
-int quiet = FALSE;
+static int quiet = FALSE;
 
 /* Dummy Ethernet header */
-int hdr_ethernet = FALSE;
-unsigned long hdr_ethernet_proto = 0;
+static int hdr_ethernet = FALSE;
+static unsigned long hdr_ethernet_proto = 0;
 
 /* Dummy IP header */
-int hdr_ip = FALSE;
-unsigned long hdr_ip_proto = 0;
+static int hdr_ip = FALSE;
+static unsigned long hdr_ip_proto = 0;
 
 /* Dummy UDP header */
-int hdr_udp = FALSE;
-unsigned long hdr_udp_dest = 0;
-unsigned long hdr_udp_src = 0;
+static int hdr_udp = FALSE;
+static unsigned long hdr_udp_dest = 0;
+static unsigned long hdr_udp_src = 0;
 
 /* Dummy SCTP header */
-int hdr_sctp = FALSE;
-unsigned long hdr_sctp_src  = 0;
-unsigned long hdr_sctp_dest = 0;
-unsigned long hdr_sctp_tag  = 0;
+static int hdr_sctp = FALSE;
+static unsigned long hdr_sctp_src  = 0;
+static unsigned long hdr_sctp_dest = 0;
+static unsigned long hdr_sctp_tag  = 0;
 
 /* Dummy DATA chunk header */
-int hdr_data_chunk = FALSE;
-unsigned char  hdr_data_chunk_type = 0;
-unsigned char  hdr_data_chunk_bits = 3;
-unsigned long  hdr_data_chunk_tsn  = 0;
-unsigned short hdr_data_chunk_sid  = 0;
-unsigned short hdr_data_chunk_ssn  = 0;
-unsigned long  hdr_data_chunk_ppid = 0;
+static int hdr_data_chunk = FALSE;
+static unsigned char  hdr_data_chunk_type = 0;
+static unsigned char  hdr_data_chunk_bits = 3;
+static unsigned long  hdr_data_chunk_tsn  = 0;
+static unsigned short hdr_data_chunk_sid  = 0;
+static unsigned short hdr_data_chunk_ssn  = 0;
+static unsigned long  hdr_data_chunk_ppid = 0;
 
 
 /*--- Local date -----------------------------------------------------------------*/
 
 /* This is where we store the packet currently being built */
 #define MAX_PACKET 64000
-unsigned char packet_buf[MAX_PACKET];
-unsigned long curr_offset = 0;
+static unsigned char packet_buf[MAX_PACKET];
+static unsigned long curr_offset = 0;
 
 /* This buffer contains strings present before the packet offset 0 */
 #define PACKET_PREAMBLE_MAX_LEN	2048
@@ -174,8 +174,8 @@
 static int packet_preamble_len = 0;
 
 /* Number of packets read and written */
-unsigned long num_packets_read = 0;
-unsigned long num_packets_written = 0;
+static unsigned long num_packets_read = 0;
+static unsigned long num_packets_written = 0;
 
 /* Time code of packet, derived from packet_preamble */
 static unsigned long ts_sec  = 0;
@@ -183,16 +183,16 @@
 static char *ts_fmt = NULL;
 
 /* Input file */
-char *input_filename;
-FILE *input_file = NULL;
+static char *input_filename;
+static FILE *input_file = NULL;
 /* Output file */
-char *output_filename;
-FILE *output_file = NULL;
+static char *output_filename;
+static FILE *output_file = NULL;
 
 /* Offset base to parse */
-unsigned long offset_base = 16;
+static unsigned long offset_base = 16;
 
-FILE *yyin;
+static FILE *yyin;
 
 /* ----- State machine -----------------------------------------------------------*/
 
@@ -204,16 +204,16 @@
     READ_BYTE,        /* Just read a byte */
     READ_TEXT,        /* Just read text - ignore until EOL */
 } parser_state_t;
-parser_state_t state = INIT;
+static parser_state_t state = INIT;
 
-const char *state_str[] = {"Init", 
+static const char *state_str[] = {"Init", 
                            "Start-of-line", 
                            "Offset",
                            "Byte",
                            "Text"
 };
 
-const char *token_str[] = {"",
+static const char *token_str[] = {"",
                            "Byte", 
                            "Offset",
                            "Directive",
@@ -229,7 +229,7 @@
     unsigned short l3pid;
 } hdr_ethernet_t;
 
-hdr_ethernet_t HDR_ETHERNET = {
+static hdr_ethernet_t HDR_ETHERNET = {
     {0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, 
     {0x02, 0x02, 0x02, 0x02, 0x02, 0x02},
     0};
@@ -248,7 +248,7 @@
     unsigned long dest_addr;
 } hdr_ip_t;
 
-hdr_ip_t HDR_IP = {0x45, 0, 0, 0x3412, 0, 0, 0xff, 0, 0, 0x01010101, 0x02020202};
+static hdr_ip_t HDR_IP = {0x45, 0, 0, 0x3412, 0, 0, 0xff, 0, 0, 0x01010101, 0x02020202};
 
 typedef struct {
     unsigned short source_port;
@@ -257,7 +257,7 @@
     unsigned short checksum;
 } hdr_udp_t;
 
-hdr_udp_t HDR_UDP = {0, 0, 0, 0};
+static hdr_udp_t HDR_UDP = {0, 0, 0, 0};
 
 typedef struct {
     unsigned short src_port;
@@ -266,7 +266,7 @@
     unsigned long  checksum;
 } hdr_sctp_t;
 
-hdr_sctp_t HDR_SCTP = {0, 0, 0, 0};
+static hdr_sctp_t HDR_SCTP = {0, 0, 0, 0};
 
 typedef struct {
     unsigned char  type;
@@ -278,9 +278,9 @@
     unsigned long  ppid;
 } hdr_data_chunk_t;
 
-hdr_data_chunk_t HDR_DATA_CHUNK = {0, 0, 0, 0, 0, 0, 0};
+static hdr_data_chunk_t HDR_DATA_CHUNK = {0, 0, 0, 0, 0, 0, 0};
 
-char tempbuf[64];
+static char tempbuf[64];
 
 /*----------------------------------------------------------------------
  * Stuff for writing a PCap file
@@ -307,7 +307,7 @@
 };
 
 /* Link-layer type; see net/bpf.h for details */
-unsigned long pcap_link_type = 1;   /* Default is DLT-EN10MB */
+static unsigned long pcap_link_type = 1;   /* Default is DLT-EN10MB */
 
 /*----------------------------------------------------------------------
  * Parse a single hex number