diff options
| author | David M. Syzdek <david.syzdek@acsalaska.com> | 2020-02-10 12:51:29 -0900 |
|---|---|---|
| committer | David M. Syzdek <david.syzdek@acsalaska.com> | 2020-02-10 12:51:29 -0900 |
| commit | 70231679b1c10d79895199ea89474e9023ca65fb (patch) | |
| tree | 7afcfb6f70c03de4515d46e18bb408518058ae17 /src | |
| parent | 8d9fe26f2fcdd70e2ec2f6ab74da3f8633b82873 (diff) | |
| download | akcom-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 'src')
| -rw-r--r-- | src/akcom-udpechod.c | 9 |
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 | ||
| 149 | struct app_config | 149 | struct 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 | }; |
| 158 | static struct app_config cnf = | 157 | static 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; | |||
| 170 | static int cnf_echoplus = 0; | 168 | static int cnf_echoplus = 0; |
| 171 | static int cnf_drop_perct = 0; | 169 | static int cnf_drop_perct = 0; |
| 172 | static useconds_t cnf_delay = 0; // Delay range in microseconds | 170 | static useconds_t cnf_delay = 0; // Delay range in microseconds |
| 171 | static 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); |
