null+****@clear*****
null+****@clear*****
2010年 9月 7日 (火) 02:57:34 JST
Daijiro MORI 2010-09-06 17:57:34 +0000 (Mon, 06 Sep 2010) New Revision: b1ed43aff59dd25b05a6716f091a7f6efc4d34b8 Log: Renamed the name of an option of groonga command from admin-html-path to document-root. Modified files: doc/ja/source/execfile.txt lib/proc.c lib/proc.h src/Makefile.am src/groonga.c Modified: doc/ja/source/execfile.txt (+3 -3) =================================================================== --- doc/ja/source/execfile.txt 2010-09-06 07:28:46 +0000 (4e018e9) +++ doc/ja/source/execfile.txt 2010-09-06 17:57:34 +0000 (0110d9e) @@ -65,11 +65,11 @@ groongaのデータベースは、groonga実行ファイルかCライブラリ ヘルプメッセージを出力します。 -.. cmdoption:: --admin-html-path <path> +.. cmdoption:: --document-root <path> httpサーバとしてgroongaを使用する場合に静的ページを格納するディレクトリを指定します。 - デフォルトでは、データベースを管理するための汎用的なページに対応するファイルが/usr/share/groonga/admin_html以下にインストールされます。このディレクトリをadmin-html-pathオプションの値に指定して起動した場合、ウェブブラウザでhttp://hostname:port/index.htmlにアクセスすると、ウェブベースのデータベース管理ツールを使用できます。 + デフォルトでは、データベースを管理するための汎用的なページに対応するファイルが/usr/share/groonga/admin_html以下にインストールされます。このディレクトリをdocument-rootオプションの値に指定して起動した場合、ウェブブラウザでhttp://hostname:port/index.htmlにアクセスすると、ウェブベースのデータベース管理ツールを使用できます。 .. cmdoption:: --protocol <protocol> @@ -216,7 +216,7 @@ groonga実行ファイルを通してデータベースを操作する命令を httpサーバとして起動します。:: - % groonga -d -p 80 --protocol http --admin-html-path /usr/share/groonga/admin_html /tmp/hoge.db + % groonga -d -p 80 --protocol http --document-root /usr/share/groonga/admin_html /tmp/hoge.db % サーバに接続し、テーブル一覧を表示します。:: Modified: lib/proc.c (+14 -14) =================================================================== --- lib/proc.c 2010-09-06 07:28:46 +0000 (53073cc) +++ lib/proc.c 2010-09-06 17:57:34 +0000 (da69890) @@ -34,7 +34,7 @@ #endif /**** globals for procs ****/ -const char *grn_admin_html_path = NULL; +const char *grn_document_root = NULL; #define VAR GRN_PROC_GET_VAR_BY_OFFSET @@ -1010,33 +1010,33 @@ proc_missing(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data) { uint32_t plen; grn_obj *outbuf = ctx->impl->outbuf; - static int grn_admin_html_path_len = -1; - if (!grn_admin_html_path) { return NULL; } - if (grn_admin_html_path_len < 0) { + static int grn_document_root_len = -1; + if (!grn_document_root) { return NULL; } + if (grn_document_root_len < 0) { size_t l; - if ((l = strlen(grn_admin_html_path)) > PATH_MAX) { + if ((l = strlen(grn_document_root)) > PATH_MAX) { return NULL; } - grn_admin_html_path_len = (int)l; - if (l > 0 && grn_admin_html_path[l - 1] == PATH_SEPARATOR[0]) { grn_admin_html_path_len--; } + grn_document_root_len = (int)l; + if (l > 0 && grn_document_root[l - 1] == PATH_SEPARATOR[0]) { grn_document_root_len--; } } - if ((plen = GRN_TEXT_LEN(VAR(0))) + grn_admin_html_path_len < PATH_MAX) { + if ((plen = GRN_TEXT_LEN(VAR(0))) + grn_document_root_len < PATH_MAX) { char path[PATH_MAX]; - memcpy(path, grn_admin_html_path, grn_admin_html_path_len); - path[grn_admin_html_path_len] = PATH_SEPARATOR[0]; + memcpy(path, grn_document_root, grn_document_root_len); + path[grn_document_root_len] = PATH_SEPARATOR[0]; grn_str_url_path_normalize(ctx, GRN_TEXT_VALUE(VAR(0)), GRN_TEXT_LEN(VAR(0)), - path + grn_admin_html_path_len + 1, - PATH_MAX - grn_admin_html_path_len - 1); + path + grn_document_root_len + 1, + PATH_MAX - grn_document_root_len - 1); grn_bulk_put_from_file(ctx, outbuf, path); } else { uint32_t abbrlen = 32; ERR(GRN_INVALID_ARGUMENT, "too long path name: <%s%c%.*s...> %u(%u)", - grn_admin_html_path, PATH_SEPARATOR[0], + grn_document_root, PATH_SEPARATOR[0], abbrlen < plen ? abbrlen : plen, GRN_TEXT_VALUE(VAR(0)), - plen + grn_admin_html_path_len, PATH_MAX); + plen + grn_document_root_len, PATH_MAX); } return NULL; } Modified: lib/proc.h (+1 -1) =================================================================== --- lib/proc.h 2010-09-06 07:28:46 +0000 (a0a54fe) +++ lib/proc.h 2010-09-06 17:57:34 +0000 (1c4c57b) @@ -25,7 +25,7 @@ extern "C" { #endif -GRN_API extern const char *grn_admin_html_path; +GRN_API extern const char *grn_document_root; void grn_db_init_builtin_query(grn_ctx *ctx); #ifdef __cplusplus Modified: src/Makefile.am (+1 -1) =================================================================== --- src/Makefile.am 2010-09-06 07:28:46 +0000 (3408402) +++ src/Makefile.am 2010-09-06 17:57:34 +0000 (20af7a5) @@ -2,7 +2,7 @@ bin_PROGRAMS = groonga grntest noinst_PROGRAMS = grnslap AM_CFLAGS = -fno-strict-aliasing $(COVERAGE_CFLAGS) \ - -DDEFAULT_ADMIN_HTML_PATH=\"$(pkgdatadir)/admin_html\" + -DDEFAULT_DOCUMENT_ROOT=\"$(pkgdatadir)/admin_html\" DEFAULT_INCLUDES = -I$(top_builddir) -I$(srcdir) -I$(top_srcdir) $(GROONGA_INCLUDEDIR) Modified: src/groonga.c (+12 -6) =================================================================== --- src/groonga.c 2010-09-06 07:28:46 +0000 (855b6c0) +++ src/groonga.c 2010-09-06 17:57:34 +0000 (ec0f7b9) @@ -97,7 +97,7 @@ usage(FILE *output) " -i, --server-id <ip/hostname>: server ID address (default: %s)\n" " -t, --max-threads <max threads>: max number of free threads (default: %d)\n" " -h, --help: show usage\n" - " --admin-html-path <path>: specify admin html path\n" + " --document-root <path>: document root path\n" " --protocol <protocol>: server protocol to listen (default: gqtp)\n" " --version: show groonga version\n" " --log-path <path>: specify log path\n" @@ -2063,7 +2063,7 @@ main(int argc, char **argv) const char *portstr = NULL, *encstr = NULL, *max_nfthreadsstr = NULL, *loglevel = NULL, *listen_addressstr = NULL, *hostnamestr = NULL, *protocol = NULL, - *cache_limitstr = NULL; + *cache_limitstr = NULL, *admin_html_path = NULL; const char *config_path = NULL; const char *input_path = NULL; int r, i, mode = mode_alone; @@ -2080,7 +2080,7 @@ main(int argc, char **argv) {'i', "server", NULL, 0, getopt_op_none}, {'q', NULL, NULL, MODE_USE_QL, getopt_op_on}, {'n', NULL, NULL, MODE_NEW_DB, getopt_op_on}, - {'\0', "admin-html-path", NULL, 0, getopt_op_none}, + {'\0', "admin-html-path", NULL, 0, getopt_op_none}, /* deprecated */ {'\0', "protocol", NULL, 0, getopt_op_none}, {'\0', "version", NULL, mode_version, getopt_op_update}, {'\0', "log-path", NULL, 0, getopt_op_none}, @@ -2090,6 +2090,7 @@ main(int argc, char **argv) {'\0', "show-config", NULL, mode_config, getopt_op_update}, {'\0', "cache-limit", NULL, 0, getopt_op_none}, {'\0', "file", NULL, 0, getopt_op_none}, + {'\0', "document-root", NULL, 0, getopt_op_none}, {'\0', NULL, NULL, 0, 0} }; opts[0].arg = &portstr; @@ -2098,7 +2099,7 @@ main(int argc, char **argv) opts[4].arg = &listen_addressstr; opts[8].arg = &loglevel; opts[9].arg = &hostnamestr; - opts[12].arg = &grn_admin_html_path; + opts[12].arg = &admin_html_path; /* deprecated */ opts[13].arg = &protocol; opts[15].arg = &grn_log_path; opts[16].arg = &grn_qlog_path; @@ -2106,6 +2107,7 @@ main(int argc, char **argv) opts[18].arg = &config_path; opts[20].arg = &cache_limitstr; opts[21].arg = &input_path; + opts[22].arg = &grn_document_root; if (!(default_max_nfthreads = get_core_number())) { default_max_nfthreads = DEFAULT_MAX_NFTHREADS; } @@ -2181,8 +2183,12 @@ main(int argc, char **argv) break; } } - if (!grn_admin_html_path) { - grn_admin_html_path = DEFAULT_ADMIN_HTML_PATH; + if (!grn_document_root) { + if (admin_html_path) { + grn_document_root = admin_html_path; + } else { + grn_document_root = DEFAULT_DOCUMENT_ROOT; + } } if (protocol) { switch (*protocol) {