ptp4l: correct print global set functions

this patch updates the global set functions to allow the user to set the
proper value instead of only being allowed to enable (or disable) a particular
feature. The new patch allows the function to specify exactly what they want
the value to be.

This patch also clarifies what -q and -v do by removing mention of quiet mode
and verbose mode. It is easy for a user to confuse and assume that -q disables
-v when this is not true.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
master
Jacob Keller 2012-08-20 10:56:08 -07:00 committed by Richard Cochran
parent df5c071599
commit 7c501032b2
4 changed files with 13 additions and 13 deletions

4
pmc.c
View File

@ -347,8 +347,8 @@ int main(int argc, char *argv[])
pollfd[1].fd = fdarray.fd[FD_GENERAL];
pollfd[1].events = POLLIN|POLLPRI;
print_no_syslog();
print_verbose();
print_set_syslog(1);
print_set_verbose(1);
while (1) {
cnt = poll(pollfd, N_FD, -1);

10
print.c
View File

@ -24,13 +24,13 @@
#include "print.h"
static int verbose;
static int verbose = 0;
static int print_level = LOG_INFO;
static int use_syslog = 1;
void print_no_syslog(void)
void print_set_syslog(int value)
{
use_syslog = 0;
use_syslog = value ? 1 : 0;
}
void print_set_level(int level)
@ -38,9 +38,9 @@ void print_set_level(int level)
print_level = level;
}
void print_verbose(void)
void print_set_verbose(int value)
{
verbose = 1;
verbose = value ? 1 : 0;
}
void print(int level, char const *format, ...)

View File

@ -24,9 +24,9 @@
void print(int level, char const *format, ...);
void print_no_syslog(void);
void print_set_syslog(int value);
void print_set_level(int level);
void print_verbose(void);
void print_set_verbose(int value);
#define pr_emerg(x...) print(LOG_EMERG, x)
#define pr_alert(x...) print(LOG_ALERT, x)

View File

@ -63,8 +63,8 @@ static void usage(char *progname)
" (ignored for SOFTWARE/LEGACY HW time stamping)\n"
" -s slave only mode (overrides configuration file)\n"
" -l [num] set the logging level to 'num'\n"
" -q quiet mode, do not use syslog(3)\n"
" -v verbose mode, print messages to stdout\n"
" -q do not print messages to the syslog\n"
" -v print messages to stdout\n"
" -h prints this message and exits\n"
"\n",
progname);
@ -137,10 +137,10 @@ int main(int argc, char *argv[])
print_set_level(atoi(optarg));
break;
case 'q':
print_no_syslog();
print_set_syslog(1);
break;
case 'v':
print_verbose();
print_set_verbose(1);
break;
case 'h':
usage(progname);