coar        97/04/15 03:27:15

  Modified:    src/modules/example  mod_example.c
  Log:
        Comment out prototype declarations, since the lack of instantiation
        causes some compilers to [reasonably] complain.  Also add some
        more information here and there, primarily from Dean's comments.
  
  Submitted by: Dean Gaudet, Roy Fielding
  
  Revision  Changes    Path
  1.5       +76 -41    apache/src/modules/example/mod_example.c
  
  Index: mod_example.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/modules/example/mod_example.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -C3 -r1.4 -r1.5
  *** mod_example.c     1997/04/15 05:23:20     1.4
  --- mod_example.c     1997/04/15 10:27:14     1.5
  ***************
  *** 89,95 ****
                        /* server, or combination).                         */
    #define CONFIG_MODE_SERVER 1
    #define CONFIG_MODE_DIRECTORY 2
  ! #define CONFIG_MODE_COMBO 3
        int         local;      /* Boolean: was "Example" directive declared 
here?  */
        int         congenital; /* Boolean: did we inherit an "Example"?        
    */
        char    *trace; /* Pointer to trace string.                         */
  --- 89,95 ----
                        /* server, or combination).                         */
    #define CONFIG_MODE_SERVER 1
    #define CONFIG_MODE_DIRECTORY 2
  ! #define CONFIG_MODE_COMBO 3  /* Shouldn't ever happen.                      
    */
        int         local;      /* Boolean: was "Example" directive declared 
here?  */
        int         congenital; /* Boolean: did we inherit an "Example"?        
    */
        char    *trace; /* Pointer to trace string.                         */
  ***************
  *** 122,199 ****
    
    /*
     * Command handler for a NO_ARGS directive.
  !  */
  ! static const char *handle_NO_ARGS
  !     (cmd_parms *cmd, void *mconfig);
  ! 
    /*
     * Command handler for a RAW_ARGS directive.  The "args" argument is the 
text
     * of the commandline following the directive itself.
     */
  - static const char *handle_RAW_ARGS
  -     (cmd_parms *cmd, void *mconfig, const char *args);
    
    /*
     * Command handler for a TAKE1 directive.  The single parameter is passed in
     * "word1".
     */
  - static const char *handle_TAKE1
  -     (cmd_parms *cmd, void *mconfig, char *word1);
    
    /*
     * Command handler for a TAKE2 directive.  TAKE2 commands must always have
     * exactly two arguments.
     */
  - static const char *handle_TAKE2
  -     (cmd_parms *cmd, void *mconfig, char *word1, char *word2);
    
    /*
     * Command handler for a TAKE3 directive.  Like TAKE2, these must have 
exactly
     * three arguments, or the parser complains and doesn't bother calling us.
     */
  - static const char *handle_TAKE3
  -     (cmd_parms *cmd, void *mconfig, char *word1, char *word2, char *word3);
    
    /*
     * Command handler for a TAKE12 directive.  These can take either one or two
     * arguments.
     * - word2 is a NULL pointer if no second argument was specified.
     */
  - static const char *handle_TAKE12
  -     (cmd_parms *cmd, void *mconfig, char *word1, char *word2);
    
    /*
     * Command handler for a TAKE123 directive.  A TAKE123 directive can be 
given,
     * as might be expected, one, two, or three arguments.
     * - word2 is a NULL pointer if no second argument was specified.
     * - word3 is a NULL pointer if no third argument was specified.
     */
  - static const char *handle_TAKE123
  -     (cmd_parms *cmd, void *mconfig, char *word1, char *word2, char *word3);
    
    /*
     * Command handler for a TAKE13 directive.  Either one or three arguments 
are
     * permitted - no two-parameters-only syntax is allowed.
     * - word2 and word3 are NULL pointers if only one argument was specified.
     */
  - static const char *handle_TAKE13
  -     (cmd_parms *cmd, void *mconfig, char *word1, char *word2, char *word3);
    
    /*
     * Command handler for a TAKE23 directive.  At least two and as many as 
three
     * arguments must be specified.
     * - word3 is a NULL pointer if no third argument was specified.
     */
  - static const char *handle_TAKE23
  -     (cmd_parms *cmd, void *mconfig, char *word1, char *word2, char *word3);
    
    /*
     * Command handler for a ITERATE directive.
     * - Handler is called once for each of n arguments given to the directive.
     * - word1 points to each argument in turn.
     */
  - static const char *handle_ITERATE
  -     (cmd_parms *cmd, void *mconfig, char *word1);
    
    /*
     * Command handler for a ITERATE2 directive.
  --- 122,209 ----
    
    /*
     * Command handler for a NO_ARGS directive.
  !  *
  !  * static const char *handle_NO_ARGS
  !  *  (cmd_parms *cmd, void *mconfig);
  !  *
  !  
    /*
     * Command handler for a RAW_ARGS directive.  The "args" argument is the 
text
     * of the commandline following the directive itself.
  +  *
  +  * static const char *handle_RAW_ARGS
  +  *  (cmd_parms *cmd, void *mconfig, const char *args);
     */
    
    /*
     * Command handler for a TAKE1 directive.  The single parameter is passed in
     * "word1".
  +  *
  +  * static const char *handle_TAKE1
  +  *  (cmd_parms *cmd, void *mconfig, char *word1);
     */
    
    /*
     * Command handler for a TAKE2 directive.  TAKE2 commands must always have
     * exactly two arguments.
  +  *
  +  * static const char *handle_TAKE2
  +  *  (cmd_parms *cmd, void *mconfig, char *word1, char *word2);
     */
    
    /*
     * Command handler for a TAKE3 directive.  Like TAKE2, these must have 
exactly
     * three arguments, or the parser complains and doesn't bother calling us.
  +  *
  +  * static const char *handle_TAKE3
  +  *  (cmd_parms *cmd, void *mconfig, char *word1, char *word2, char *word3);
     */
    
    /*
     * Command handler for a TAKE12 directive.  These can take either one or two
     * arguments.
     * - word2 is a NULL pointer if no second argument was specified.
  +  *
  +  * static const char *handle_TAKE12
  +  *  (cmd_parms *cmd, void *mconfig, char *word1, char *word2);
     */
    
    /*
     * Command handler for a TAKE123 directive.  A TAKE123 directive can be 
given,
     * as might be expected, one, two, or three arguments.
     * - word2 is a NULL pointer if no second argument was specified.
     * - word3 is a NULL pointer if no third argument was specified.
  +  *
  +  * static const char *handle_TAKE123
  +  *  (cmd_parms *cmd, void *mconfig, char *word1, char *word2, char *word3);
     */
    
    /*
     * Command handler for a TAKE13 directive.  Either one or three arguments 
are
     * permitted - no two-parameters-only syntax is allowed.
     * - word2 and word3 are NULL pointers if only one argument was specified.
  +  *
  +  * static const char *handle_TAKE13
  +  *  (cmd_parms *cmd, void *mconfig, char *word1, char *word2, char *word3);
     */
    
    /*
     * Command handler for a TAKE23 directive.  At least two and as many as 
three
     * arguments must be specified.
     * - word3 is a NULL pointer if no third argument was specified.
  +  *
  +  * static const char *handle_TAKE23
  +  *  (cmd_parms *cmd, void *mconfig, char *word1, char *word2, char *word3);
     */
    
    /*
     * Command handler for a ITERATE directive.
     * - Handler is called once for each of n arguments given to the directive.
     * - word1 points to each argument in turn.
  +  *
  +  * static const char *handle_ITERATE
  +  *  (cmd_parms *cmd, void *mconfig, char *word1);
     */
    
    /*
     * Command handler for a ITERATE2 directive.
  ***************
  *** 202,210 ****
     * - word1 is the same for each call for a particular directive instance 
(the
     *   first argument).
     * - word2 points to each of the second and subsequent arguments in turn.
     */
  - static const char *handle_ITERATE2
  -     (cmd_parms *cmd, void *mconfig, char *word1, char *word2);
    
    
/*--------------------------------------------------------------------------*/
    /*                                                                      */
  --- 212,221 ----
     * - word1 is the same for each call for a particular directive instance 
(the
     *   first argument).
     * - word2 points to each of the second and subsequent arguments in turn.
  +  *
  +  * static const char *handle_ITERATE2
  +  *  (cmd_parms *cmd, void *mconfig, char *word1, char *word2);
     */
    
    
/*--------------------------------------------------------------------------*/
    /*                                                                      */
  ***************
  *** 215,223 ****
    
/*--------------------------------------------------------------------------*/
    
    /*
  !  * Locate our configuration record for the current request.
     */
  ! static example_config *our_config
        (request_rec *r) {
    
        return (example_config *) get_module_config
  --- 226,234 ----
    
/*--------------------------------------------------------------------------*/
    
    /*
  !  * Locate our directory configuration record for the current request.
     */
  ! static example_config *our_dconfig
        (request_rec *r) {
    
        return (example_config *) get_module_config
  ***************
  *** 228,233 ****
  --- 239,257 ----
    }
    
    /*
  +  * Locate our server configuration record for the specified server.
  +  */
  + static example_config *our_sconfig
  +     (server_rec *s) {
  + 
  +     return (example_config *) get_module_config
  +                             (
  +                                 s->module_config,
  +                                 &example_module
  +                             );
  + }
  + 
  + /*
     * This routine is used to add a trace of a callback to the list.  We're
     * passed the server record (if available), an allocation pool, a pointer to
     * our private configuration record (if available) for the environment to
  ***************
  *** 324,330 ****
    /* mod_info and mod_status examples, for more details.)                     
    */
    /*                                                                      */
    /* Since content handlers are dumping data directly into the connexion      
    */
  ! /* without intervention by other parts of the server, they need to make     
    */
    /* sure any accumulated HTTP headers are sent first.  This is done by       
    */
    /* calling send_http_header().  Otherwise, no header will be sent at all,   
*/
    /* and the output sent to the client will actually be HTTP-uncompliant.     
    */
  --- 348,355 ----
    /* mod_info and mod_status examples, for more details.)                     
    */
    /*                                                                      */
    /* Since content handlers are dumping data directly into the connexion      
    */
  ! /* (using the r*() routines, such as rputs() and rprintf()) without     */
  ! /* intervention by other parts of the server, they need to make             
    */
    /* sure any accumulated HTTP headers are sent first.  This is done by       
    */
    /* calling send_http_header().  Otherwise, no header will be sent at all,   
*/
    /* and the output sent to the client will actually be HTTP-uncompliant.     
    */
  ***************
  *** 345,351 ****
        example_config
            *cfg;
    
  !     cfg = our_config (r);
        trace_add (r->server, r->pool, cfg, "example_handler()");
        /*
         * We're about to start sending content, so we need to force the HTTP
  --- 370,376 ----
        example_config
            *cfg;
    
  !     cfg = our_dconfig (r);
        trace_add (r->server, r->pool, cfg, "example_handler()");
        /*
         * We're about to start sending content, so we need to force the HTTP
  ***************
  *** 542,547 ****
  --- 567,574 ----
     * routine, the record for the closest ancestor location (that has one) is
     * used exclusively.
     *
  +  * The routine MUST NOT modify any of its arguments!
  +  *
     * The return value is a pointer to the created module-specific structure
     * containing the merged values.
     */
  ***************
  *** 633,638 ****
  --- 660,667 ----
     * appropriately.  If the module doesn't declare a merge routine, the more
     * specific existing record is used exclusively.
     *
  +  * The routine MUST NOT modify any of its arguments!
  +  *
     * The return value is a pointer to the created module-specific structure
     * containing the merged values.
     */
  ***************
  *** 688,694 ****
        example_config
            *cfg;
    
  !     cfg = our_config (r);
        /*
         * We don't actually *do* anything here, except note the fact that we 
were
         * called.
  --- 717,723 ----
        example_config
            *cfg;
    
  !     cfg = our_dconfig (r);
        /*
         * We don't actually *do* anything here, except note the fact that we 
were
         * called.
  ***************
  *** 712,718 ****
        example_config
            *cfg;
    
  !     cfg = our_config (r);
        /*
         * Don't do anything except log the call.
         */
  --- 741,747 ----
        example_config
            *cfg;
    
  !     cfg = our_dconfig (r);
        /*
         * Don't do anything except log the call.
         */
  ***************
  *** 736,742 ****
        example_config
            *cfg;
    
  !     cfg = our_config (r);
        /*
         * Log the call and return OK, or access will be denied (even though we
         * didn't actually do anything).
  --- 765,771 ----
        example_config
            *cfg;
    
  !     cfg = our_dconfig (r);
        /*
         * Log the call and return OK, or access will be denied (even though we
         * didn't actually do anything).
  ***************
  *** 760,766 ****
        example_config
            *cfg;
    
  !     cfg = our_config (r);
        trace_add (r->server, r->pool, cfg, "example_ckaccess()");
        return OK;
    }
  --- 789,795 ----
        example_config
            *cfg;
    
  !     cfg = our_dconfig (r);
        trace_add (r->server, r->pool, cfg, "example_ckaccess()");
        return OK;
    }
  ***************
  *** 779,785 ****
        example_config
            *cfg;
    
  !     cfg = our_config (r);
        /*
         * Log the call, but don't do anything else - and report truthfully that
         * we didn't do anything.
  --- 808,814 ----
        example_config
            *cfg;
    
  !     cfg = our_dconfig (r);
        /*
         * Log the call, but don't do anything else - and report truthfully that
         * we didn't do anything.
  ***************
  *** 802,808 ****
        example_config
            *cfg;
    
  !     cfg = our_config (r);
        /*
         * Log the call and exit.
         */
  --- 831,837 ----
        example_config
            *cfg;
    
  !     cfg = our_dconfig (r);
        /*
         * Log the call and exit.
         */
  ***************
  *** 823,829 ****
        example_config
            *cfg;
    
  !     cfg = our_config (r);
        trace_add (r->server, r->pool, cfg, "example_logger()");
        return DECLINED;
    }
  --- 852,858 ----
        example_config
            *cfg;
    
  !     cfg = our_dconfig (r);
        trace_add (r->server, r->pool, cfg, "example_logger()");
        return DECLINED;
    }
  ***************
  *** 842,848 ****
        example_config
            *cfg;
    
  !     cfg = our_config (r);
        trace_add (r->server, r->pool, cfg, "example_hparser()");
        return DECLINED;
    }
  --- 871,877 ----
        example_config
            *cfg;
    
  !     cfg = our_dconfig (r);
        trace_add (r->server, r->pool, cfg, "example_hparser()");
        return DECLINED;
    }
  ***************
  *** 878,887 ****
    /*                                                                      */
    
/*--------------------------------------------------------------------------*/
    /* 
  !  * List of handlers our module supplies.  Each handler is defined by two
  !  * parts: a name by which it can be referenced (such as by 
{Add,Set}Handler),
  !  * and the actual routine name.  The list is terminated by a NULL block, 
since
  !  * it can be of variable length.
     */
    handler_rec example_handlers[] = {
        { "example-handler", example_handler },
  --- 907,922 ----
    /*                                                                      */
    
/*--------------------------------------------------------------------------*/
    /* 
  !  * List of content handlers our module supplies.  Each handler is defined by
  !  * two parts: a name by which it can be referenced (such as by
  !  * {Add,Set}Handler), and the actual routine name.  The list is terminated 
by
  !  * a NULL block, since it can be of variable length.
  !  *
  !  * Note that content-handlers are invoked on a most-specific to 
least-specific
  !  * basis; that is, an handler that is declared for "text/plain" will be
  !  * invoked before one that was declared for "text/*".  Note also that
  !  * if a content-handler returns anything except DECLINED, no other
  !  * content-handlers will be called.
     */
    handler_rec example_handlers[] = {
        { "example-handler", example_handler },
  
  
  

Reply via email to