fielding    96/11/11 21:22:10

  Modified:    src       Configure http_config.h http_config.c http_core.c
                        http_main.c  mod_info.c
  Log:
  Removed the module_names[] and preloaded_module_names[] arrays.
  All functions now get the name from the module structure and either
  search the preloaded_modules list (for static info) or the actual
  linked list of modules (for active modules).
  
  Docs note: The "httpd -h" and "httpd -l" options print info about all
  compiled modules, not just the active (prelinked) ones.  mod_info only
  prints the prelinked module information [I would have changed that, but
  the code in mod_info uses an, ummmm, unusual style].  The <IfModule>
  and AddModule directives' use the file name of the module (what you now see
  with "httpd -l") as the argument.
  
  Revision  Changes    Path
  1.35      +1 -13     apache/src/Configure
  
  Index: Configure
  ===================================================================
  RCS file: /export/home/cvs/apache/src/Configure,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -C3 -r1.34 -r1.35
  *** Configure 1996/11/04 00:55:16     1.34
  --- Configure 1996/11/12 05:22:02     1.35
  ***************
  *** 1,5 ****
    #!/bin/sh
  ! # $Id: Configure,v 1.34 1996/11/04 00:55:16 brian Exp $
    trap 'rm -f $tmpfile; exit' 0 1 2 3 15
    
    # Apache configuration script, first cut --- rst.
  --- 1,5 ----
    #!/bin/sh
  ! # $Id: Configure,v 1.35 1996/11/12 05:22:02 fielding Exp $
    trap 'rm -f $tmpfile; exit' 0 1 2 3 15
    
    # Apache configuration script, first cut --- rst.
  ***************
  *** 74,96 ****
             } \
         print "  NULL"; \
             print "};"; \
  -          print "char *module_names[] = {"; \
  -          for (i = 0; i < n; ++i) { \
  -              printf "  \"%s\",\n", modules[i]; \
  -          } \
  -          print "  NULL"; \
  -          print "};"; \
             print "module *preloaded_modules[] = {"; \
             for (i = 0; i < pn; ++i) { \
                 printf "  &%s_module,\n", pmodules[i]; \
             } \
         print "  NULL"; \
  -          print "};"; \
  -          print "char *preloaded_module_names[] = {"; \
  -          for (i = 0; i < pn; ++i) { \
  -              printf "  \"%s\",\n", pmodules[i]; \
  -          } \
  -          print "  NULL"; \
             print "};"; \
       }'
    
  --- 74,84 ----
  
  
  
  1.21      +4 -2      apache/src/http_config.h
  
  Index: http_config.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_config.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -C3 -r1.20 -r1.21
  *** http_config.h     1996/11/04 00:55:17     1.20
  --- http_config.h     1996/11/12 05:22:03     1.21
  ***************
  *** 249,257 ****
    /* Finally, the hook for dynamically loading modules in... */
    
    void add_module (module *m);
  ! int add_named_module (char *name);
    void clear_module_list ();
  ! char *find_module_name (module *m);
    
    #ifdef CORE_PRIVATE
    
  --- 249,258 ----
    /* Finally, the hook for dynamically loading modules in... */
    
    void add_module (module *m);
  ! int add_named_module (const char *name);
    void clear_module_list ();
  ! const char *find_module_name (module *m);
  ! module *find_linked_module (const char *name);
    
    #ifdef CORE_PRIVATE
    
  ***************
  *** 260,265 ****
  --- 261,267 ----
    server_rec *read_config (pool *conf_pool, pool *temp_pool, char 
*config_name);
    void setup_prelinked_modules();
    void show_directives();
  + void show_modules();
    
    /* For http_request.c... */
    
  
  
  
  1.33      +36 -23    apache/src/http_config.c
  
  Index: http_config.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_config.c,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -C3 -r1.32 -r1.33
  *** http_config.c     1996/11/04 18:09:55     1.32
  --- http_config.c     1996/11/12 05:22:04     1.33
  ***************
  *** 399,425 ****
        }
    }
    
  ! char *find_module_name (module *m)
    {
  !     extern char *preloaded_module_names[];
    
  !     if (m->module_index >= 0 && m->module_index < total_modules)
  !       return preloaded_module_names[m->module_index];
        return NULL;
    }
    
    /* Add a named module.  Returns 1 if module found, 0 otherwise.  */
  ! int add_named_module (char *name)
    {
        extern module *preloaded_modules[];
  !     extern char *preloaded_module_names[];
  !     int i;
    
  !     for (i = 0; preloaded_module_names[i]; ++i) {
  !         if (strcmp (preloaded_module_names[i], name) == 0) {
            /* Only add modules that are not already enabled.  */
  !         if (preloaded_modules[i]->next == NULL) {
  !             add_module (preloaded_modules[i]);
            }
            return 1;
        }
  --- 399,432 ----
        }
    }
    
  ! const char *find_module_name (module *m)
    {
  !     return m->name;
  ! }
  ! 
  ! module *find_linked_module (const char *name)
  ! {
  !     module *modp;
    
  !     for (modp = top_module; modp; modp = modp->next) {
  !         if (strcmp(modp->name, name) == 0)
  !             return modp;
  !     }
        return NULL;
    }
    
    /* Add a named module.  Returns 1 if module found, 0 otherwise.  */
  ! int add_named_module (const char *name)
    {
        extern module *preloaded_modules[];
  !     module *modp;
  !     int i = 0;
    
  !     for (modp = preloaded_modules[i]; modp; modp = preloaded_modules[++i]) {
  !         if (strcmp(modp->name, name) == 0) {
            /* Only add modules that are not already enabled.  */
  !         if (modp->next == NULL) {
  !             add_module(modp);
            }
            return 1;
        }
  ***************
  *** 428,435 ****
        return 0;
    }
    
  ! /* Clear the internal list of modules, in preparation for starting
  !    over.  */
    void clear_module_list ()
    {
        module **m = &top_module;
  --- 435,441 ----
        return 0;
    }
    
  ! /* Clear the internal list of modules, in preparation for starting over. */
    void clear_module_list ()
    {
        module **m = &top_module;
  ***************
  *** 1120,1146 ****
        printf("\n");
    }
    
  ! /* Show the prelinked configuration directives, the help string explaining
     * the directive arguments, in what module they are handled, and in
     * what parts of the configuration they are allowed.  Used for httpd -h.
     */
    void show_directives()
    {
  !     extern module *prelinked_modules[];
  !     extern char *module_names[];
        command_rec *pc;
        int n;
  -     int t;
        
  !     for(t=0 ; prelinked_modules[t] ; ++t)
  !         ;
  !     for(n=0 ; prelinked_modules[n] ; ++n)
  !         for(pc=prelinked_modules[n]->cmds ; pc && pc->name ; ++pc) {
                printf("%s\n", pc->name);
                if (pc->errmsg)
                    printf("\t%s\n", pc->errmsg);
  !             printf("\t%s\n", module_names[t-n-1]);
  !             show_overrides(pc, prelinked_modules[n]);
            }
    }
    
  --- 1126,1159 ----
        printf("\n");
    }
    
  ! /* Show the preloaded configuration directives, the help string explaining
     * the directive arguments, in what module they are handled, and in
     * what parts of the configuration they are allowed.  Used for httpd -h.
     */
    void show_directives()
    {
  !     extern module *preloaded_modules[];
        command_rec *pc;
        int n;
        
  !     for (n = 0; preloaded_modules[n]; ++n)
  !         for (pc = preloaded_modules[n]->cmds; pc && pc->name; ++pc) {
                printf("%s\n", pc->name);
                if (pc->errmsg)
                    printf("\t%s\n", pc->errmsg);
  !             printf("\t%s\n", preloaded_modules[n]->name);
  !             show_overrides(pc, preloaded_modules[n]);
            }
  + }
  + 
  + /* Show the preloaded module names.  Used for httpd -l. */
  + void show_modules()
  + {
  +     extern module *preloaded_modules[];
  +     int n;
  +  
  +     printf ("Compiled-in modules:\n");
  +     for (n = 0; preloaded_modules[n]; ++n)
  +         printf ("  %s\n", preloaded_modules[n]->name);
    }
    
  
  
  
  1.45      +3 -7      apache/src/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_core.c,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -C3 -r1.44 -r1.45
  *** http_core.c       1996/11/04 18:09:58     1.44
  --- http_core.c       1996/11/12 05:22:04     1.45
  ***************
  *** 63,70 ****
    #include "util_md5.h"
    #include "scoreboard.h"
    
  - extern char *module_names[];
  - 
    /* Server core module... This module provides support for really basic
     * server operations, including options and commands which control the
     * operation of other modules.  Consider this the bureaucracy module.
  --- 63,68 ----
  ***************
  *** 706,721 ****
    {
        char *endp = strrchr (arg, '>');
        char l[MAX_STRING_LEN];
  !     int i, not = (arg[0] == '!');
  !     int found = 0;
        int nest = 1;
    
        if (endp) *endp = '\0';
        if (not) arg++;
    
  !     for (i=0; module_names[i]; i++)
  !       if (!strcasecmp(arg, module_names[i]))
  !     found++;
    
        if ((!not && found) || (not && !found))
          return NULL;
  --- 704,717 ----
    {
        char *endp = strrchr (arg, '>');
        char l[MAX_STRING_LEN];
  !     int not = (arg[0] == '!');
  !     module *found;
        int nest = 1;
    
        if (endp) *endp = '\0';
        if (not) arg++;
    
  !     found = find_linked_module(arg);
    
        if ((!not && found) || (not && !found))
          return NULL;
  
  
  
  1.87      +0 -10     apache/src/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_main.c,v
  retrieving revision 1.86
  retrieving revision 1.87
  diff -C3 -r1.86 -r1.87
  *** http_main.c       1996/11/08 13:50:47     1.86
  --- http_main.c       1996/11/12 05:22:05     1.87
  ***************
  *** 1889,1904 ****
    
    } /* standalone_main */
    
  - void show_modules()
  - {
  -     extern char *preloaded_module_names[];
  -     int t;
  - 
  -     printf ("Compiled-in modules:\n");
  -     for (t = 0; preloaded_module_names[t]; ++t)
  -       printf ("  %s\n", preloaded_module_names[t]);
  - }
  - 
    extern char *optarg;
    extern int optind;
    
  --- 1889,1894 ----
  
  
  
  1.6       +4 -8      apache/src/mod_info.c
  
  Index: mod_info.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_info.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -C3 -r1.5 -r1.6
  *** mod_info.c        1996/11/04 00:55:20     1.5
  --- mod_info.c        1996/11/12 05:22:06     1.6
  ***************
  *** 235,241 ****
    int display_info(request_rec *r) {
        module *modp = NULL;
        char buf[256];
  -     char *name;
        command_rec *cmd=NULL;
        handler_rec *hand=NULL;
        server_rec *serv = r->server;
  --- 235,240 ----
  ***************
  *** 277,284 ****
                if(!r->args) {
                        rputs("<tt><a href=\"#server\">Server Settings</a>, 
",r);
                        for(modp = top_module; modp; modp = modp->next) {
  !                             name=find_module_name (modp);
  !                             sprintf(buf,"<a href=\"#%s\">%s</a>",name,name);
                                rputs(buf, r);
                                if(modp->next) rputs(", ",r);
                        }
  --- 276,282 ----
                if(!r->args) {
                        rputs("<tt><a href=\"#server\">Server Settings</a>, 
",r);
                        for(modp = top_module; modp; modp = modp->next) {
  !                             sprintf(buf,"<a 
href=\"#%s\">%s</a>",modp->name,modp->name);
                                rputs(buf, r);
                                if(modp->next) rputs(", ",r);
                        }
  ***************
  *** 313,321 ****
                }
                rputs("<hr><dl>",r);
                for(modp = top_module; modp; modp = modp->next) {
  !                     name=find_module_name (modp);
  !                     if(!r->args || !strcasecmp(name,r->args)) {     
  !                             sprintf(buf,"<dt><a name=\"%s\"><strong>Module 
Name:</strong> <font size=+1><tt>%s</tt></a></font>\n",name,name);
                                rputs(buf,r);
                                rputs("<dt><strong>Content-types 
affected:</strong>",r);        
                                hand = modp->handlers;
  --- 311,318 ----
                }
                rputs("<hr><dl>",r);
                for(modp = top_module; modp; modp = modp->next) {
  !                     if(!r->args || !strcasecmp(modp->name,r->args)) {       
  !                             sprintf(buf,"<dt><a name=\"%s\"><strong>Module 
Name:</strong> <font size=+1><tt>%s</tt></a></font>\n",modp->name,modp->name);
                                rputs(buf,r);
                                rputs("<dt><strong>Content-types 
affected:</strong>",r);        
                                hand = modp->handlers;
  ***************
  *** 394,401 ****
                if(!modp && r->args && strcasecmp(r->args,"server")) 
rputs("<b>No such module</b>\n",r);
        } else {
                for(modp = top_module; modp; modp = modp->next) {
  !                     name=find_module_name (modp);
  !                     rputs(name,r);
                        if(modp->next) rputs("<br>",r);
                }       
        }       
  --- 391,397 ----
                if(!modp && r->args && strcasecmp(r->args,"server")) 
rputs("<b>No such module</b>\n",r);
        } else {
                for(modp = top_module; modp; modp = modp->next) {
  !                     rputs(modp->name,r);
                        if(modp->next) rputs("<br>",r);
                }       
        }       
  
  
  

Reply via email to