summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--capture_opts.c42
-rw-r--r--capture_sync.c32
-rw-r--r--dftest.c4
-rw-r--r--editcap.c56
-rw-r--r--rawshark.c8
-rw-r--r--tap-iostat.c8
-rw-r--r--tap-wspstat.c6
-rw-r--r--tshark.c10
8 files changed, 83 insertions, 83 deletions
diff --git a/capture_opts.c b/capture_opts.c
index 177ffe3701..243b6919ce 100644
--- a/capture_opts.c
+++ b/capture_opts.c
@@ -370,7 +370,7 @@ get_auth_arguments(capture_options *capture_opts, const char *arg)
#endif
static int
-capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg)
+capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg_str_p)
{
long adapter_index;
char *p;
@@ -388,7 +388,7 @@ capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg)
* names that begin with digits. It can be useful on Windows, where
* more than one interface can have the same name.
*/
- adapter_index = strtol(optarg, &p, 10);
+ adapter_index = strtol(optarg_str_p, &p, 10);
if (p != NULL && *p == '\0') {
if (adapter_index < 0) {
cmdarg_err("The specified adapter index is a negative number");
@@ -430,47 +430,47 @@ capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg)
*/
free_interface_list(if_list);
} else {
- capture_opts->iface = g_strdup(optarg);
+ capture_opts->iface = g_strdup(optarg_str_p);
}
return 0;
}
int
-capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg, gboolean *start_capture)
+capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg_str_p, gboolean *start_capture)
{
int status;
switch(opt) {
case 'a': /* autostop criteria */
- if (set_autostop_criterion(capture_opts, optarg) == FALSE) {
- cmdarg_err("Invalid or unknown -a flag \"%s\"", optarg);
+ if (set_autostop_criterion(capture_opts, optarg_str_p) == FALSE) {
+ cmdarg_err("Invalid or unknown -a flag \"%s\"", optarg_str_p);
return 1;
}
break;
#ifdef HAVE_PCAP_REMOTE
case 'A':
- if (get_auth_arguments(capture_opts, optarg) == FALSE) {
- cmdarg_err("Invalid or unknown -A arg \"%s\"", optarg);
+ if (get_auth_arguments(capture_opts, optarg_str_p) == FALSE) {
+ cmdarg_err("Invalid or unknown -A arg \"%s\"", optarg_str_p);
return 1;
}
break;
#endif
case 'b': /* Ringbuffer option */
capture_opts->multi_files_on = TRUE;
- if (get_ring_arguments(capture_opts, optarg) == FALSE) {
- cmdarg_err("Invalid or unknown -b arg \"%s\"", optarg);
+ if (get_ring_arguments(capture_opts, optarg_str_p) == FALSE) {
+ cmdarg_err("Invalid or unknown -b arg \"%s\"", optarg_str_p);
return 1;
}
break;
#ifdef _WIN32
case 'B': /* Buffer size */
- capture_opts->buffer_size = get_positive_int(optarg, "buffer size");
+ capture_opts->buffer_size = get_positive_int(optarg_str_p, "buffer size");
break;
#endif
case 'c': /* Capture n packets */
capture_opts->has_autostop_packets = TRUE;
- capture_opts->autostop_packets = get_positive_int(optarg, "packet count");
+ capture_opts->autostop_packets = get_positive_int(optarg_str_p, "packet count");
break;
case 'f': /* capture filter */
if (capture_opts->has_cfilter) {
@@ -479,13 +479,13 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg,
}
capture_opts->has_cfilter = TRUE;
g_free(capture_opts->cfilter);
- capture_opts->cfilter = g_strdup(optarg);
+ capture_opts->cfilter = g_strdup(optarg_str_p);
break;
case 'H': /* Hide capture info dialog box */
capture_opts->show_info = FALSE;
break;
case 'i': /* Use interface x */
- status = capture_opts_add_iface_opt(capture_opts, optarg);
+ status = capture_opts_add_iface_opt(capture_opts, optarg_str_p);
if(status != 0) {
return status;
}
@@ -496,8 +496,8 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg,
/*case 'l':*/ /* Automatic scrolling in live capture mode */
#ifdef HAVE_PCAP_SETSAMPLING
case 'm':
- if (get_sampling_arguments(capture_opts, optarg) == FALSE) {
- cmdarg_err("Invalid or unknown -m arg \"%s\"", optarg);
+ if (get_sampling_arguments(capture_opts, optarg_str_p) == FALSE) {
+ cmdarg_err("Invalid or unknown -m arg \"%s\"", optarg_str_p);
return 1;
}
break;
@@ -519,7 +519,7 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg,
#endif
case 's': /* Set the snapshot (capture) length */
capture_opts->has_snaplen = TRUE;
- capture_opts->snaplen = get_natural_int(optarg, "snapshot length");
+ capture_opts->snaplen = get_natural_int(optarg_str_p, "snapshot length");
/*
* Make a snapshot length of 0 equivalent to the maximum packet
* length, mirroring what tcpdump does.
@@ -540,17 +540,17 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg,
g_free(capture_opts->save_file);
#if defined _WIN32 && GLIB_CHECK_VERSION(2,6,0)
/* since GLib 2.6, we need to convert filenames to utf8 for Win32 */
- capture_opts->save_file = g_locale_to_utf8(optarg, -1, NULL, NULL, NULL);
+ capture_opts->save_file = g_locale_to_utf8(optarg_str_p, -1, NULL, NULL, NULL);
#else
- capture_opts->save_file = g_strdup(optarg);
+ capture_opts->save_file = g_strdup(optarg_str_p);
#endif
status = capture_opts_output_to_pipe(capture_opts->save_file, &capture_opts->output_to_pipe);
return status;
case 'y': /* Set the pcap data link type */
- capture_opts->linktype = linktype_name_to_val(optarg);
+ capture_opts->linktype = linktype_name_to_val(optarg_str_p);
if (capture_opts->linktype == -1) {
cmdarg_err("The specified data link type \"%s\" isn't valid",
- optarg);
+ optarg_str_p);
return 1;
}
break;
diff --git a/capture_sync.c b/capture_sync.c
index 2d072fe88c..bcfeba534a 100644
--- a/capture_sync.c
+++ b/capture_sync.c
@@ -992,22 +992,22 @@ _U_
/* read a number of bytes from a pipe */
/* (blocks until enough bytes read or an error occurs) */
static int
-pipe_read_bytes(int pipe, char *bytes, int required) {
+pipe_read_bytes(int pipe_fd, char *bytes, int required) {
int newly;
int offset = 0;
while(required) {
- newly = read(pipe, &bytes[offset], required);
+ newly = read(pipe_fd, &bytes[offset], required);
if (newly == 0) {
/* EOF */
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
- "read from pipe %d: EOF (capture closed?)", pipe);
+ "read from pipe %d: EOF (capture closed?)", pipe_fd);
return offset;
}
if (newly < 0) {
/* error */
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
- "read from pipe %d: error(%u): %s", pipe, errno, strerror(errno));
+ "read from pipe %d: error(%u): %s", pipe_fd, errno, strerror(errno));
return newly;
}
@@ -1018,9 +1018,9 @@ pipe_read_bytes(int pipe, char *bytes, int required) {
return offset;
}
-static gboolean pipe_data_available(int pipe) {
+static gboolean pipe_data_available(int pipe_fd) {
#ifdef _WIN32 /* PeekNamedPipe */
- HANDLE hPipe = (HANDLE) _get_osfhandle(pipe);
+ HANDLE hPipe = (HANDLE) _get_osfhandle(pipe_fd);
DWORD bytes_avail;
if (hPipe == INVALID_HANDLE_VALUE)
@@ -1037,11 +1037,11 @@ static gboolean pipe_data_available(int pipe) {
struct timeval timeout;
FD_ZERO(&rfds);
- FD_SET(pipe, &rfds);
+ FD_SET(pipe_fd, &rfds);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
- if (select(pipe+1, &rfds, NULL, NULL, &timeout) > 0)
+ if (select(pipe_fd+1, &rfds, NULL, NULL, &timeout) > 0)
return TRUE;
return FALSE;
@@ -1094,17 +1094,17 @@ pipe_convert_header(const guchar *header, int header_len, char *indicator, int *
(1-byte message indicator, 3-byte message length (excluding length
and indicator field), and the rest is the message) */
static int
-pipe_read_block(int pipe, char *indicator, int len, char *msg) {
+pipe_read_block(int pipe_fd, char *indicator, int len, char *msg) {
int required;
int newly;
guchar header[4];
/* read header (indicator and 3-byte length) */
- newly = pipe_read_bytes(pipe, header, 4);
+ newly = pipe_read_bytes(pipe_fd, header, 4);
if(newly != 4) {
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
- "read %d failed to read header: %u", pipe, newly);
+ "read %d failed to read header: %u", pipe_fd, newly);
return -1;
}
@@ -1114,7 +1114,7 @@ pipe_read_block(int pipe, char *indicator, int len, char *msg) {
/* only indicator with no value? */
if(required == 0) {
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
- "read %d indicator: %c empty value", pipe, *indicator);
+ "read %d indicator: %c empty value", pipe_fd, *indicator);
return 4;
}
@@ -1122,18 +1122,18 @@ pipe_read_block(int pipe, char *indicator, int len, char *msg) {
if(required > len) {
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
"read %d length error, required %d > len %d, indicator: %u",
- pipe, required, len, *indicator);
+ pipe_fd, required, len, *indicator);
/* we have a problem here, try to read some more bytes from the pipe to debug where the problem really is */
memcpy(msg, header, sizeof(header));
- newly = read(pipe, &msg[sizeof(header)], len-sizeof(header));
+ newly = read(pipe_fd, &msg[sizeof(header)], len-sizeof(header));
g_warning("Unknown message from dumpcap, try to show it as a string: %s", msg);
return -1;
}
len = required;
/* read the actual block data */
- newly = pipe_read_bytes(pipe, msg, required);
+ newly = pipe_read_bytes(pipe_fd, msg, required);
if(newly != required) {
g_warning("Unknown message from dumpcap, try to show it as a string: %s", msg);
return -1;
@@ -1141,7 +1141,7 @@ pipe_read_block(int pipe, char *indicator, int len, char *msg) {
/* XXX If message is "2part", the msg probably won't be sent to debug log correctly */
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG,
- "read %d ok indicator: %c len: %u msg: %s", pipe, *indicator,
+ "read %d ok indicator: %c len: %u msg: %s", pipe_fd, *indicator,
len, msg);
return newly + 4;
}
diff --git a/dftest.c b/dftest.c
index 2aae57cc09..2f3ced581a 100644
--- a/dftest.c
+++ b/dftest.c
@@ -62,7 +62,7 @@ main(int argc, char **argv)
char *gpf_path, *pf_path;
int gpf_open_errno, gpf_read_errno;
int pf_open_errno, pf_read_errno;
- e_prefs *prefs;
+ e_prefs *prefs_p;
dfilter_t *df;
/*
@@ -97,7 +97,7 @@ main(int argc, char **argv)
/* set the c-language locale to the native environment. */
setlocale(LC_ALL, "");
- prefs = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
+ prefs_p = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
&pf_open_errno, &pf_read_errno, &pf_path);
if (gpf_path != NULL) {
if (gpf_open_errno != 0) {
diff --git a/editcap.c b/editcap.c
index 8ca10e79e6..724f7abdd9 100644
--- a/editcap.c
+++ b/editcap.c
@@ -166,14 +166,14 @@ abs_time_to_str_with_sec_resolution(const struct wtap_nstime *abs_time)
}
static gchar*
-fileset_get_filename_by_pattern(guint idx, const struct wtap_nstime *time,
+fileset_get_filename_by_pattern(guint idx, const struct wtap_nstime *time_val,
gchar *fprefix, gchar *fsuffix)
{
gchar filenum[5+1];
gchar *timestr;
gchar *abs_str;
- timestr = abs_time_to_str_with_sec_resolution(time);
+ timestr = abs_time_to_str_with_sec_resolution(time_val);
g_snprintf(filenum, sizeof(filenum), "%05u", idx);
abs_str = g_strconcat(fprefix, "_", filenum, "_", timestr, fsuffix, NULL);
g_free(timestr);
@@ -294,40 +294,40 @@ check_timestamp(wtap *wth)
}
static void
-set_time_adjustment(char *optarg)
+set_time_adjustment(char *optarg_str_p)
{
char *frac, *end;
long val;
size_t frac_digits;
- if (!optarg)
+ if (!optarg_str_p)
return;
/* skip leading whitespace */
- while (*optarg == ' ' || *optarg == '\t') {
- optarg++;
+ while (*optarg_str_p == ' ' || *optarg_str_p == '\t') {
+ optarg_str_p++;
}
/* check for a negative adjustment */
- if (*optarg == '-') {
+ if (*optarg_str_p == '-') {
time_adj.is_negative = 1;
- optarg++;
+ optarg_str_p++;
}
/* collect whole number of seconds, if any */
- if (*optarg == '.') { /* only fractional (i.e., .5 is ok) */
+ if (*optarg_str_p == '.') { /* only fractional (i.e., .5 is ok) */
val = 0;
- frac = optarg;
+ frac = optarg_str_p;
} else {
- val = strtol(optarg, &frac, 10);
- if (frac == NULL || frac == optarg || val == LONG_MIN || val == LONG_MAX) {
+ val = strtol(optarg_str_p, &frac, 10);
+ if (frac == NULL || frac == optarg_str_p || val == LONG_MIN || val == LONG_MAX) {
fprintf(stderr, "editcap: \"%s\" isn't a valid time adjustment\n",
- optarg);
+ optarg_str_p);
exit(1);
}
if (val < 0) { /* implies '--' since we caught '-' above */
fprintf(stderr, "editcap: \"%s\" isn't a valid time adjustment\n",
- optarg);
+ optarg_str_p);
exit(1);
}
}
@@ -344,7 +344,7 @@ set_time_adjustment(char *optarg)
if (*frac != '.' || end == NULL || end == frac
|| val < 0 || val > ONE_MILLION || val == LONG_MIN || val == LONG_MAX) {
fprintf(stderr, "editcap: \"%s\" isn't a valid time adjustment\n",
- optarg);
+ optarg_str_p);
exit(1);
}
}
@@ -365,39 +365,39 @@ set_time_adjustment(char *optarg)
}
static void
-set_rel_time(char *optarg)
+set_rel_time(char *optarg_str_p)
{
char *frac, *end;
long val;
size_t frac_digits;
- if (!optarg)
+ if (!optarg_str_p)
return;
/* skip leading whitespace */
- while (*optarg == ' ' || *optarg == '\t') {
- optarg++;
+ while (*optarg_str_p == ' ' || *optarg_str_p == '\t') {
+ optarg_str_p++;
}
/* ignore negative adjustment */
- if (*optarg == '-') {
- optarg++;
+ if (*optarg_str_p == '-') {
+ optarg_str_p++;
}
/* collect whole number of seconds, if any */
- if (*optarg == '.') { /* only fractional (i.e., .5 is ok) */
+ if (*optarg_str_p == '.') { /* only fractional (i.e., .5 is ok) */
val = 0;
- frac = optarg;
+ frac = optarg_str_p;
} else {
- val = strtol(optarg, &frac, 10);
- if (frac == NULL || frac == optarg || val == LONG_MIN || val == LONG_MAX) {
+ val = strtol(optarg_str_p, &frac, 10);
+ if (frac == NULL || frac == optarg_str_p || val == LONG_MIN || val == LONG_MAX) {
fprintf(stderr, "1: editcap: \"%s\" isn't a valid rel time value\n",
- optarg);
+ optarg_str_p);
exit(1);
}
if (val < 0) { /* implies '--' since we caught '-' above */
fprintf(stderr, "2: editcap: \"%s\" isn't a valid rel time value\n",
- optarg);
+ optarg_str_p);
exit(1);
}
}
@@ -414,7 +414,7 @@ set_rel_time(char *optarg)
if (*frac != '.' || end == NULL || end == frac
|| val < 0 || val > ONE_BILLION || val == LONG_MIN || val == LONG_MAX) {
fprintf(stderr, "3: editcap: \"%s\" isn't a valid rel time value\n",
- optarg);
+ optarg_str_p);
exit(1);
}
}
diff --git a/rawshark.c b/rawshark.c
index 9b99b3a92b..6aa911cf9d 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -445,7 +445,7 @@ main(int argc, char *argv[])
int err;
gchar *pipe_name = NULL;
gchar *rfilters[64];
- e_prefs *prefs;
+ e_prefs *prefs_p;
char badopt;
GLogLevelFlags log_flags;
GPtrArray *disp_fields = g_ptr_array_new();
@@ -520,7 +520,7 @@ main(int argc, char *argv[])
/* Set the C-language locale to the native environment. */
setlocale(LC_ALL, "");
- prefs = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
+ prefs_p = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
&pf_open_errno, &pf_read_errno, &pf_path);
if (gpf_path != NULL) {
if (gpf_open_errno != 0) {
@@ -546,7 +546,7 @@ main(int argc, char *argv[])
}
/* Set the name resolution code's flags from the preferences. */
- g_resolv_flags = prefs->name_resolve;
+ g_resolv_flags = prefs_p->name_resolve;
/* Read the disabled protocols file. */
read_disabled_protos_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
@@ -777,7 +777,7 @@ main(int argc, char *argv[])
}
/* Build the column format array */
- build_column_format_array(&cfile.cinfo, prefs->num_cols, TRUE);
+ build_column_format_array(&cfile.cinfo, prefs_p->num_cols, TRUE);
if (n_rfilters != 0) {
for (i = 0; i < n_rfilters; i++) {
diff --git a/tap-iostat.c b/tap-iostat.c
index 1a9f69f254..a460d03ab0 100644
--- a/tap-iostat.c
+++ b/tap-iostat.c
@@ -614,13 +614,13 @@ iostat_init(const char *optarg, void* userdata _U_)
{
float interval_float;
gint32 interval;
- int pos=0;
+ int idx=0;
io_stat_t *io;
const char *filter=NULL;
- if(sscanf(optarg,"io,stat,%f,%n",&interval_float,&pos)==1){
- if(pos){
- filter=optarg+pos;
+ if(sscanf(optarg,"io,stat,%f,%n",&interval_float,&idx)==1){
+ if(idx){
+ filter=optarg+idx;
} else {
filter=NULL;
}
diff --git a/tap-wspstat.c b/tap-wspstat.c
index 1f9eae0b8b..b5c285443c 100644
--- a/tap-wspstat.c
+++ b/tap-wspstat.c
@@ -134,7 +134,7 @@ wspstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const
{
wspstat_t *sp=psp;
const wsp_info_value_t *value=pri;
- gint index = pdut2index(value->pdut);
+ gint idx = pdut2index(value->pdut);
int retour=0;
if (value->status_code != 0) {
@@ -160,8 +160,8 @@ wspstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const
- if (index!=0) {
- sp->pdu_stats[ index ].packets++;
+ if (idx!=0) {
+ sp->pdu_stats[ idx ].packets++;
retour = 1;
}
return retour;
diff --git a/tshark.c b/tshark.c
index b925efcab1..a7dc8b2e0e 100644
--- a/tshark.c
+++ b/tshark.c
@@ -762,7 +762,7 @@ main(int argc, char *argv[])
struct bpf_program fcode;
#endif
dfilter_t *rfcode = NULL;
- e_prefs *prefs;
+ e_prefs *prefs_p;
char badopt;
GLogLevelFlags log_flags;
int optind_initial;
@@ -926,7 +926,7 @@ main(int argc, char *argv[])
/* Set the C-language locale to the native environment. */
setlocale(LC_ALL, "");
- prefs = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
+ prefs_p = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
&pf_open_errno, &pf_read_errno, &pf_path);
if (gpf_path != NULL) {
if (gpf_open_errno != 0) {
@@ -952,7 +952,7 @@ main(int argc, char *argv[])
}
/* Set the name resolution code's flags from the preferences. */
- g_resolv_flags = prefs->name_resolve;
+ g_resolv_flags = prefs_p->name_resolve;
/* Read the disabled protocols file. */
read_disabled_protos_list(&gdp_path, &gdp_open_errno, &gdp_read_errno,
@@ -1445,7 +1445,7 @@ main(int argc, char *argv[])
}
/* Build the column format array */
- build_column_format_array(&cfile.cinfo, prefs->num_cols, TRUE);
+ build_column_format_array(&cfile.cinfo, prefs_p->num_cols, TRUE);
#ifdef HAVE_LIBPCAP
capture_opts_trim_snaplen(&global_capture_opts, MIN_PACKET_SIZE);
@@ -1581,7 +1581,7 @@ main(int argc, char *argv[])
/* trim the interface name and exit if that failed */
if (!capture_opts_trim_iface(&global_capture_opts,
- (prefs->capture_device) ? get_if_name(prefs->capture_device) : NULL)) {
+ (prefs_p->capture_device) ? get_if_name(prefs_p->capture_device) : NULL)) {
exit(2);
}