Kouhei Sutou
null+****@clear*****
Wed Dec 26 12:06:50 JST 2012
Kouhei Sutou 2012-12-26 12:06:50 +0900 (Wed, 26 Dec 2012) New Revision: 81e7745ce52049d67675ef6ddd5628cb84a2a56d https://github.com/groonga/groonga/commit/81e7745ce52049d67675ef6ddd5628cb84a2a56d Log: Support continuous line in command list Modified files: src/groonga.c Modified: src/groonga.c (+21 -2) =================================================================== --- src/groonga.c 2012-12-26 16:12:08 +0900 (a9dd9ef) +++ src/groonga.c 2012-12-26 12:06:50 +0900 (1a26095) @@ -195,11 +195,10 @@ line_editor_fgets(grn_ctx *ctx, grn_obj *buf) #endif /* WITH_LIBEDIT */ inline static grn_rc -prompt(grn_ctx *ctx, grn_obj *buf) +read_next_line(grn_ctx *ctx, grn_obj *buf) { static int the_first_read = GRN_TRUE; grn_rc rc = GRN_SUCCESS; - GRN_BULK_REWIND(buf); if (!batchmode) { #ifdef WITH_LIBEDIT rc = line_editor_fgets(ctx, buf); @@ -239,6 +238,26 @@ prompt(grn_ctx *ctx, grn_obj *buf) return rc; } +inline static grn_rc +prompt(grn_ctx *ctx, grn_obj *buf) +{ + grn_rc rc = GRN_SUCCESS; + grn_bool need_next_line = GRN_TRUE; + GRN_BULK_REWIND(buf); + while (need_next_line) { + rc = read_next_line(ctx, buf); + if (rc == GRN_SUCCESS && + GRN_TEXT_LEN(buf) > 0 && + GRN_TEXT_VALUE(buf)[GRN_TEXT_LEN(buf) - 1] == '\\') { + grn_bulk_truncate(ctx, buf, GRN_TEXT_LEN(buf) - 1); + need_next_line = GRN_TRUE; + } else { + need_next_line = GRN_FALSE; + } + } + return rc; +} + typedef enum { grn_http_request_type_none = 0, grn_http_request_type_get, -------------- next part -------------- HTML����������������������������... Descargar