From: Tomek Mrugalski Date: Sat, 25 Jul 2015 16:08:16 +0000 (+0200) Subject: Changed "char * progname;" variable to be "char const * progname;", so now it is... X-Git-Tag: NTP_4_3_65~7^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88309ae0366f4f85a99f4a9437d9d0e893449617;p=thirdparty%2Fntp.git Changed "char * progname;" variable to be "char const * progname;", so now it is consistent Many files: changed a variable to be const autogenerated bk: 55b3b470JN_mBREj_DI4u0fSmOyJag --- diff --git a/adjtimed/adjtimed.c b/adjtimed/adjtimed.c index f38e66dd0..fd28dfb1b 100644 --- a/adjtimed/adjtimed.c +++ b/adjtimed/adjtimed.c @@ -58,7 +58,7 @@ void Exit (int); /* emacs cc-mode goes nuts if we split the next line... */ #define tvtod(tv) ((double)tv.tv_sec + ((double)tv.tv_usec / (double)MILLION)) -char *progname = NULL; +char const *progname = NULL; int verbose = 0; int sysdebug = 0; static int mqid; diff --git a/clockstuff/chutest.c b/clockstuff/chutest.c index 488a0d16e..78f6c5fe9 100644 --- a/clockstuff/chutest.c +++ b/clockstuff/chutest.c @@ -56,7 +56,7 @@ struct chucode { #define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0) -char *progname; +char const *progname; int dofilter = 0; /* set to 1 when we should run filter algorithm */ int showtimes = 0; /* set to 1 when we should show char arrival times */ diff --git a/clockstuff/propdelay.c b/clockstuff/propdelay.c index 52c20320c..a3b9fc0b2 100644 --- a/clockstuff/propdelay.c +++ b/clockstuff/propdelay.c @@ -117,7 +117,7 @@ int Cflag = 0; int Gflag = 0; int height; -char *progname; +char const *progname; static void doit (double, double, double, double, double, char *); static double latlong (char *, int); diff --git a/libntp/msyslog.c b/libntp/msyslog.c index 4e0aee5db..a2068255b 100644 --- a/libntp/msyslog.c +++ b/libntp/msyslog.c @@ -38,7 +38,7 @@ char * syslog_abs_fname; #define INIT_NTP_SYSLOGMASK ~(u_int32)0 u_int32 ntp_syslogmask = INIT_NTP_SYSLOGMASK; -extern char * progname; +extern char const * progname; /* Declare the local functions */ void addto_syslog (int, const char *); @@ -145,8 +145,8 @@ addto_syslog( const char * msg ) { - static char * prevcall_progname; - static char * prog; + static char const * prevcall_progname; + static char const * prog; const char nl[] = "\n"; const char empty[] = ""; FILE * term_file; diff --git a/libntp/ntp_lineedit.c b/libntp/ntp_lineedit.c index e3bc0022a..a2b2d2934 100644 --- a/libntp/ntp_lineedit.c +++ b/libntp/ntp_lineedit.c @@ -36,7 +36,7 @@ * external references */ -extern char * progname; +extern char const * progname; /* * globals, private prototypes diff --git a/ntpdate/ntpdate.c b/ntpdate/ntpdate.c index 08edc8be4..9831929c4 100644 --- a/ntpdate/ntpdate.c +++ b/ntpdate/ntpdate.c @@ -149,7 +149,7 @@ int unpriv_port = 0; /* * Program name. */ -char *progname; +char const *progname; /* * Systemwide parameters and flags diff --git a/ntpdc/ntpdc.c b/ntpdc/ntpdc.c index 8c07dac97..ab177885b 100644 --- a/ntpdc/ntpdc.c +++ b/ntpdc/ntpdc.c @@ -240,7 +240,7 @@ static FILE *current_output; */ extern struct xcmd opcmds[]; -char *progname; +char const *progname; #ifdef NO_MAIN_ALLOWED CALL(ntpdc,"ntpdc",ntpdcmain); diff --git a/ntpq/ntpq.c b/ntpq/ntpq.c index fa7d59339..ee853f985 100644 --- a/ntpq/ntpq.c +++ b/ntpq/ntpq.c @@ -405,7 +405,7 @@ FILE *current_output; */ extern struct xcmd opcmds[]; -char *progname; +char const *progname; #ifdef NO_MAIN_ALLOWED #ifndef BUILD_AS_LIB diff --git a/sntp/log.c b/sntp/log.c index d70349515..d27e885e2 100644 --- a/sntp/log.c +++ b/sntp/log.c @@ -2,7 +2,7 @@ #include "log.h" -char *progname; /* for msyslog use too */ +char const *progname; /* for msyslog use too */ static void cleanup_log(void); diff --git a/sntp/log.h b/sntp/log.h index fdb2ba21b..2d047babc 100644 --- a/sntp/log.h +++ b/sntp/log.h @@ -22,6 +22,6 @@ void sntp_init_logging(const char *program); void open_logfile(const char *logfile); -extern char *progname; /* for msyslog use too */ +extern char const *progname; /* for msyslog use too */ #endif diff --git a/sntp/tests/run-crypto.c b/sntp/tests/run-crypto.c index d4f811f0e..8b2a73528 100644 --- a/sntp/tests/run-crypto.c +++ b/sntp/tests/run-crypto.c @@ -46,7 +46,7 @@ void resetTest(void) setUp(); } -char *progname; +char const *progname; //=======MAIN===== diff --git a/sntp/tests/run-keyFile.c b/sntp/tests/run-keyFile.c index f55c03520..862910903 100644 --- a/sntp/tests/run-keyFile.c +++ b/sntp/tests/run-keyFile.c @@ -46,7 +46,7 @@ void resetTest(void) setUp(); } -char *progname; +char const *progname; //=======MAIN===== diff --git a/sntp/tests/run-kodDatabase.c b/sntp/tests/run-kodDatabase.c index 6de7bacd0..e5bf3d728 100644 --- a/sntp/tests/run-kodDatabase.c +++ b/sntp/tests/run-kodDatabase.c @@ -48,7 +48,7 @@ void resetTest(void) setUp(); } -char *progname; +char const *progname; //=======MAIN===== diff --git a/sntp/tests/run-kodFile.c b/sntp/tests/run-kodFile.c index 3c2553c26..394355039 100644 --- a/sntp/tests/run-kodFile.c +++ b/sntp/tests/run-kodFile.c @@ -47,7 +47,7 @@ void resetTest(void) setUp(); } -char *progname; +char const *progname; //=======MAIN===== diff --git a/sntp/tests/run-networking.c b/sntp/tests/run-networking.c index ae21349af..70caaa034 100644 --- a/sntp/tests/run-networking.c +++ b/sntp/tests/run-networking.c @@ -39,7 +39,7 @@ void resetTest(void) setUp(); } -char *progname; +char const *progname; //=======MAIN===== diff --git a/sntp/tests/run-packetHandling.c b/sntp/tests/run-packetHandling.c index 3a34590b6..bc20d7f48 100644 --- a/sntp/tests/run-packetHandling.c +++ b/sntp/tests/run-packetHandling.c @@ -55,7 +55,7 @@ void resetTest(void) setUp(); } -char *progname; +char const *progname; //=======MAIN===== diff --git a/sntp/tests/run-packetProcessing.c b/sntp/tests/run-packetProcessing.c index b987d4a26..bf3a63eb1 100644 --- a/sntp/tests/run-packetProcessing.c +++ b/sntp/tests/run-packetProcessing.c @@ -58,7 +58,7 @@ void resetTest(void) setUp(); } -char *progname; +char const *progname; //=======MAIN===== diff --git a/sntp/tests/run-utilities.c b/sntp/tests/run-utilities.c index 0eb0ba90b..7c2237bbe 100644 --- a/sntp/tests/run-utilities.c +++ b/sntp/tests/run-utilities.c @@ -49,7 +49,7 @@ void resetTest(void) setUp(); } -char *progname; +char const *progname; //=======MAIN===== diff --git a/tests/ntpd/run-ntp_restrict.c b/tests/ntpd/run-ntp_restrict.c index 89fd45734..0d945eb33 100644 --- a/tests/ntpd/run-ntp_restrict.c +++ b/tests/ntpd/run-ntp_restrict.c @@ -47,7 +47,7 @@ void resetTest(void) setUp(); } -char const * progname; +char const *progname; //=======MAIN===== diff --git a/tests/sandbox/run-modetoa.c b/tests/sandbox/run-modetoa.c index 776dda485..143bd756c 100644 --- a/tests/sandbox/run-modetoa.c +++ b/tests/sandbox/run-modetoa.c @@ -31,18 +31,21 @@ extern void test_UnknownMode(void); //=======Test Reset Option===== -void resetTest() +void resetTest(void); +void resetTest(void) { tearDown(); setUp(); } +char const *progname; + //=======MAIN===== -int main(void) +int main(int argc, char *argv[]) { - Unity.TestFile = "modetoa.c"; - UnityBegin(""); + progname = argv[0]; + UnityBegin("modetoa.c"); RUN_TEST(test_KnownMode, 8); RUN_TEST(test_UnknownMode, 15); diff --git a/tests/sandbox/run-uglydate.c b/tests/sandbox/run-uglydate.c index dd909adb0..e65cd0109 100644 --- a/tests/sandbox/run-uglydate.c +++ b/tests/sandbox/run-uglydate.c @@ -22,6 +22,8 @@ #include "unity.h" #include #include +#include "config.h" +#include "ntp_fp.h" //=======External Functions This Runner Calls===== extern void setUp(void); @@ -30,18 +32,21 @@ extern void test_ConstantDateTime(void); //=======Test Reset Option===== -void resetTest() +void resetTest(void); +void resetTest(void) { tearDown(); setUp(); } +char const *progname; + //=======MAIN===== -int main(void) +int main(int argc, char *argv[]) { - Unity.TestFile = "uglydate.c"; - UnityBegin(""); + progname = argv[0]; + UnityBegin("uglydate.c"); RUN_TEST(test_ConstantDateTime, 9); return (UnityEnd()); diff --git a/tests/sandbox/run-ut-2803.c b/tests/sandbox/run-ut-2803.c index d6ca2ee7d..b948c4a38 100644 --- a/tests/sandbox/run-ut-2803.c +++ b/tests/sandbox/run-ut-2803.c @@ -35,18 +35,21 @@ extern void test_ignored(void); //=======Test Reset Option===== -void resetTest() +void resetTest(void); +void resetTest(void) { tearDown(); setUp(); } +char const *progname; + //=======MAIN===== -int main(void) +int main(int argc, char *argv[]) { - Unity.TestFile = "ut-2803.c"; - UnityBegin(""); + progname = argv[0]; + UnityBegin("ut-2803.c"); RUN_TEST(test_main, 30); RUN_TEST(test_XPASS, 37); RUN_TEST(test_XFAIL, 49); diff --git a/util/ntp-keygen.c b/util/ntp-keygen.c index 86d040dde..9568adc8d 100644 --- a/util/ntp-keygen.c +++ b/util/ntp-keygen.c @@ -154,7 +154,7 @@ u_long asn2ntp (ASN1_TIME *); * Program variables */ extern char *optarg; /* command line argument */ -char *progname; +char const *progname; u_int lifetime = DAYSPERYEAR; /* certificate lifetime (days) */ int nkeys; /* MV keys */ time_t epoch; /* Unix epoch (seconds) since 1970 */ diff --git a/util/ntptime.c b/util/ntptime.c index 4b45f2457..c47e356dd 100644 --- a/util/ntptime.c +++ b/util/ntptime.c @@ -73,7 +73,7 @@ static sigjmp_buf env; /* environment var. for pll_trap() */ static volatile int pll_control; /* (0) daemon, (1) kernel loop */ static volatile int status; /* most recent status bits */ static volatile int flash; /* most recent ntp_adjtime() bits */ -char* progname; +char const * progname; static char optargs[] = "MNT:cde:f:hm:o:rs:t:"; int