[ntp:hackers] Exit command to stop processing include files.
Dean Gibson (NTP Administrator)
ntp at ultimeth.com
Mon Jul 25 12:45:19 PDT 2005
Might I suggest that "QUIT" or "END" be used in place of "EXIT"?? I
have noticed what seems to be a convention, that shells are exited with
"exit", and other program that take text input terminate their input
with "quit" or "bye" or something else. Of course, this case is a bit
different, in that the program is not exiting/quitting. Perhaps "END"?
Just a suggestion; not a big issue.
-- Dean
On 2005-07-25 12:34, Brian Utterback wrote:
> Here is a patch to cut short the processing of configuration files and
> the includefiles. This is handy if you do not want to actually go back
> to the file that was doing the include.
>
> firefly{blu}249:; diff -u -c -C 4
> ../../ntp-dev-4.2.0a-20050723/ntpd/ntp_config.c ntp_config.c
> *** ../../ntp-dev-4.2.0a-20050723/ntpd/ntp_config.c Mon Jul 4
> 04:01:24 2005
> --- ntp_config.c Fri Jul 22 08:05:33 2005
> ***************
> *** 72,79 ****
> --- 72,80 ----
> { "controlkey", CONFIG_CONTROLKEY },
> { "disable", CONFIG_DISABLE },
> { "driftfile", CONFIG_DRIFTFILE },
> { "enable", CONFIG_ENABLE },
> + { "exit", CONFIG_EXIT },
> { "filegen", CONFIG_FILEGEN },
> { "fudge", CONFIG_FUDGE },
> { "includefile", CONFIG_INCLUDEFILE },
> { "keys", CONFIG_KEYS },
> ***************
> *** 581,588 ****
> --- 582,591 ----
> #endif /* not SYS_WINNT */
> }
>
> for (;;) {
> + if (tok == CONFIG_EXIT)
> + break;
> if (fp[includelevel])
> tok = gettokens(fp[includelevel], line,
> tokens, &ntokens);
> #ifdef HAVE_NETINFO
> else
> ***************
> *** 860,867 ****
> --- 863,876 ----
> else
> stats_config(STATS_PID_FILE, (char *)0);
> break;
>
> + case CONFIG_EXIT:
> + for ( i = 0; i <= includelevel; i++ ) {
> + fclose(fp[i]);
> + }
> + break;
> +
> case CONFIG_INCLUDEFILE:
> if (ntokens < 2) {
> msyslog(LOG_ERR, "includefile needs one
> argument");
> break;
> *** ../../ntp-dev-4.2.0a-20050723/include/ntp_config.h Thu Apr 21
> 04:01:22 2005
> --- ntp_config.h Fri Jul 22 07:45:33 2005
> ***************
> *** 55,64 ****
> #define CONFIG_TOS 34
> #define CONFIG_TTL 35
> #define CONFIG_INCLUDEFILE 36
> #define CONFIG_KEYSDIR 37
> #ifdef OPENSSL
> ! #define CONFIG_CRYPTO 38
> #endif /* OPENSSL */
>
> /*
> * "peer", "server", "broadcast" modifier keywords
> --- 55,65 ----
> #define CONFIG_TOS 34
> #define CONFIG_TTL 35
> #define CONFIG_INCLUDEFILE 36
> #define CONFIG_KEYSDIR 37
> + #define CONFIG_EXIT 38
> #ifdef OPENSSL
> ! #define CONFIG_CRYPTO 39
> #endif /* OPENSSL */
>
> /*
> * "peer", "server", "broadcast" modifier keywords
>
More information about the hackers
mailing list