Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 3676 invoked from network); 5 Sep 2004 02:11:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 5 Sep 2004 02:11:23 -0000 Received: (qmail 1528 invoked by uid 500); 5 Sep 2004 02:11:23 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 1330 invoked by uid 500); 5 Sep 2004 02:11:21 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 1317 invoked by uid 500); 5 Sep 2004 02:11:21 -0000 Delivered-To: apmail-httpd-2.0-cvs@apache.org Received: (qmail 1314 invoked by uid 99); 5 Sep 2004 02:11:21 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Sat, 04 Sep 2004 19:11:17 -0700 Received: (qmail 3644 invoked by uid 1888); 5 Sep 2004 02:11:16 -0000 Date: 5 Sep 2004 02:11:16 -0000 Message-ID: <20040905021116.3643.qmail@minotaur.apache.org> From: pquerna@apache.org To: httpd-2.0-cvs@apache.org Subject: cvs commit: httpd-2.0/modules/generators mod_info.c X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N pquerna 2004/09/04 19:11:16 Modified: modules/generators mod_info.c Log: Remove the use of sprintf. Cleanup the history parts at the top of mod_info.c Revision Changes Path 1.59 +23 -27 httpd-2.0/modules/generators/mod_info.c Index: mod_info.c =================================================================== RCS file: /home/cvs/httpd-2.0/modules/generators/mod_info.c,v retrieving revision 1.58 retrieving revision 1.59 diff -u -r1.58 -r1.59 --- mod_info.c 5 Sep 2004 01:43:03 -0000 1.58 +++ mod_info.c 5 Sep 2004 02:11:16 -0000 1.59 @@ -27,25 +27,15 @@ * GET /server-info?list - Returns quick list of included modules * GET /server-info?config - Returns full configuration * - * Rasmus Lerdorf , May 1996 + * Original Author: + * Rasmus Lerdorf , May 1996 * - * 05.01.96 Initial Version + * Modified By: + * Lou Langholtz , July 1997 * - * Lou Langholtz , July 1997 - * - * 07.11.97 Addition of the AddModuleInfo directive - * - * Ryan Morgan + * Apache 2.0 Port: + * Ryan Morgan , August 2000 * - * 8.11.00 Port to Apache 2.0. Read configuation from the configuration - * tree rather than reparse the entire configuation file. - * - * Rici Lake - * - * 2004-08-28 Rewrote config tree walk using recursion the way God intended. - * Added ?config option. Added printout of config filename and line numbers. - * Fixed indentation. - * */ #define CORE_PRIVATE @@ -98,13 +88,22 @@ return new; } -static void mod_info_indent(request_rec *r, int nest, const char *thisfn, - int linenum) +static void put_int_flush_right(request_rec *r, int i, int field) +{ + if (field > 1 || i > 9) + put_int_flush_right(r, i / 10, field - 1); + if (i) + ap_rputc('0' + i % 10, r); + else + ap_rputs(" ", r); +} + +static void mod_info_indent(request_rec *r, int nest, + const char *thisfn, int linenum) { int i; const char *prevfn = ap_get_module_config(r->request_config, &info_module); - char buf[32]; if (thisfn == NULL) thisfn = "*UNKNOWN*"; if (prevfn == NULL || 0 != strcmp(prevfn, thisfn)) { @@ -113,17 +112,14 @@ thisfn); ap_set_module_config(r->request_config, &info_module, thisfn); } + ap_rputs("
", r); - if (linenum > 0) - sprintf(buf, "%d", linenum); - else - buf[0] = '\0'; - for (i = strlen(buf); i < 4; ++i) - ap_rputs(" ", r); - ap_rputs(buf, r); + put_int_flush_right(r, linenum > 0 ? linenum : 0, 4); ap_rputs(": ", r); - for (i = 1; i <= nest; ++i) + + for (i = 1; i <= nest; ++i) { ap_rputs("  ", r); + } } static void mod_info_show_cmd(request_rec *r, const ap_directive_t * dir,