[ntp:hackers] Exit command to stop processing include files.

Brian Utterback brian.utterback at sun.com
Mon Jul 25 12:34:25 PDT 2005


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

-- 
blu

Remember when SOX compliant meant they were both the same color?
----------------------------------------------------------------------
Brian Utterback - OP/N1 RPE, Sun Microsystems, Inc.
Ph:877-259-7345, Em:brian.utterback-at-ess-you-enn-dot-kom



More information about the hackers mailing list