aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/akcom-udpechod.c
diff options
context:
space:
mode:
authorDavid M. Syzdek <david.syzdek@acsalaska.com>2020-02-10 12:51:29 -0900
committerDavid M. Syzdek <david.syzdek@acsalaska.com>2020-02-10 12:51:29 -0900
commit70231679b1c10d79895199ea89474e9023ca65fb (patch)
tree7afcfb6f70c03de4515d46e18bb408518058ae17 /src/akcom-udpechod.c
parent8d9fe26f2fcdd70e2ec2f6ab74da3f8633b82873 (diff)
downloadakcom-udpecho-70231679b1c10d79895199ea89474e9023ca65fb.tar.gz
akcom-udpecho-70231679b1c10d79895199ea89474e9023ca65fb.tar.bz2
akcom-udpecho-70231679b1c10d79895199ea89474e9023ca65fb.tar.xz
akcom-udpecho-70231679b1c10d79895199ea89474e9023ca65fb.zip
akcom-udpechod: replacing verbose struct member with static variable
Diffstat (limited to '')
-rw-r--r--src/akcom-udpechod.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/akcom-udpechod.c b/src/akcom-udpechod.c
index 8424efb..46532b8 100644
--- a/src/akcom-udpechod.c
+++ b/src/akcom-udpechod.c
@@ -148,7 +148,6 @@ static int should_stop = 0;
148 148
149struct app_config 149struct app_config
150{ 150{
151 int32_t verbose; // runtime verbosity
152 int facility; // syslog facility 151 int facility; // syslog facility
153 int dont_fork; 152 int dont_fork;
154 const char * listen; // IP address to listen for requests 153 const char * listen; // IP address to listen for requests
@@ -157,7 +156,6 @@ struct app_config
157}; 156};
158static struct app_config cnf = 157static struct app_config cnf =
159{ 158{
160 .verbose = 0,
161 .facility = LOG_DAEMON, 159 .facility = LOG_DAEMON,
162 .dont_fork = 0, 160 .dont_fork = 0,
163 .listen = NULL, 161 .listen = NULL,
@@ -170,6 +168,7 @@ static uint16_t cnf_port = 30006;
170static int cnf_echoplus = 0; 168static int cnf_echoplus = 0;
171static int cnf_drop_perct = 0; 169static int cnf_drop_perct = 0;
172static useconds_t cnf_delay = 0; // Delay range in microseconds 170static useconds_t cnf_delay = 0; // Delay range in microseconds
171static int32_t cnf_verbose = 0; // runtime verbosity
173 172
174 173
175////////////////// 174//////////////////
@@ -358,7 +357,7 @@ int main(int argc, char * argv[])
358 break; 357 break;
359 358
360 case 'v': 359 case 'v':
361 cnf.verbose++; 360 cnf_verbose++;
362 break; 361 break;
363 362
364 case 'V': 363 case 'V':
@@ -694,7 +693,7 @@ void my_debug(const char * fmt, ...)
694{ 693{
695 va_list args; 694 va_list args;
696 695
697 if (!(cnf.verbose)) 696 if (!(cnf_verbose))
698 return; 697 return;
699 698
700 printf("%s: ", prog_name); 699 printf("%s: ", prog_name);
@@ -822,7 +821,7 @@ int my_loop(int s, size_t * connp)
822 fds[0].fd = s; 821 fds[0].fd = s;
823 fds[0].events = POLLIN; 822 fds[0].events = POLLIN;
824 fds[0].revents = 0; 823 fds[0].revents = 0;
825 if (cnf.verbose > 1) 824 if (cnf_verbose > 1)
826 syslog(LOG_DEBUG, "waiting for echo request"); 825 syslog(LOG_DEBUG, "waiting for echo request");
827 if ((poll(fds, 1, 5000)) < 1) 826 if ((poll(fds, 1, 5000)) < 1)
828 return(0); 827 return(0);