Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Prevent the test command 'test-th-hook' from segfaulting when TH1 hooks are disabled. Also, add and enhance comments. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
ddd4cb52545c3e8406643e41e2c96061 |
User & Date: | mistachkin 2015-11-24 23:38:17 |
Context
2015-11-24
| ||
23:41 | Fix compiler warnings seen with MSVC. Add comments. ... (check-in: 52e3d9d8 user: mistachkin tags: trunk) | |
23:38 | Prevent the test command 'test-th-hook' from segfaulting when TH1 hooks are disabled. Also, add and enhance comments. ... (check-in: ddd4cb52 user: mistachkin tags: trunk) | |
2015-11-23
| ||
20:53 | fixed typo as suggested on ML ... (check-in: 565d1b0a user: m.ramakers@gmail.com tags: trunk) | |
Changes
Changes to src/th_main.c.
︙ | ︙ | |||
2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 | ** on standard output. ** ** Options: ** ** --cgi Include a CGI response header in the output ** --http Include an HTTP response header in the output ** --open-config Open the configuration database */ void test_th_render(void){ int forceCgi = 0, fullHttpReply = 0; Blob in; Th_InitTraceLog(); forceCgi = find_option("cgi", 0, 0)!=0; fullHttpReply = find_option("http", 0, 0)!=0; | > | 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 | ** on standard output. ** ** Options: ** ** --cgi Include a CGI response header in the output ** --http Include an HTTP response header in the output ** --open-config Open the configuration database ** --th-trace Trace TH1 execution (for debugging purposes) */ void test_th_render(void){ int forceCgi = 0, fullHttpReply = 0; Blob in; Th_InitTraceLog(); forceCgi = find_option("cgi", 0, 0)!=0; fullHttpReply = find_option("http", 0, 0)!=0; |
︙ | ︙ | |||
2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 | ** script, evaluate it, and show the results on standard output. ** ** Options: ** ** --cgi Include a CGI response header in the output ** --http Include an HTTP response header in the output ** --open-config Open the configuration database */ void test_th_eval(void){ int rc; const char *zRc; int forceCgi, fullHttpReply; Th_InitTraceLog(); forceCgi = find_option("cgi", 0, 0)!=0; | > | 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 | ** script, evaluate it, and show the results on standard output. ** ** Options: ** ** --cgi Include a CGI response header in the output ** --http Include an HTTP response header in the output ** --open-config Open the configuration database ** --th-trace Trace TH1 execution (for debugging purposes) */ void test_th_eval(void){ int rc; const char *zRc; int forceCgi, fullHttpReply; Th_InitTraceLog(); forceCgi = find_option("cgi", 0, 0)!=0; |
︙ | ︙ | |||
2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 | Th_PrintTraceLog(); if( forceCgi ) cgi_reply(); } #ifdef FOSSIL_ENABLE_TH1_HOOKS /* ** COMMAND: test-th-hook */ void test_th_hook(void){ int rc = TH_OK; int nResult = 0; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | > | > > | > | 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 | Th_PrintTraceLog(); if( forceCgi ) cgi_reply(); } #ifdef FOSSIL_ENABLE_TH1_HOOKS /* ** COMMAND: test-th-hook ** ** Usage: %fossil test-th-hook TYPE NAME FLAGS ** ** Executes the TH1 script configured for the pre-operation (i.e. a command ** or web page) "hook" or post-operation "notification". The results of the ** script evaluation, if any, will be printed to the standard output channel. ** The NAME argument must be the name of a command or web page; however, it ** does not necessarily have to be a command or web page that is normally ** recognized by Fossil. The FLAGS argument will be used to set the value ** of the "cmd_flags" and/or "web_flags" TH1 variables, if applicable. The ** TYPE argument must be one of the following: ** ** cmdhook Executes the TH1 procedure [command_hook], after ** setting the TH1 variables "cmd_name", "cmd_args", ** and "cmd_flags" to appropriate values. ** ** cmdnotify Executes the TH1 procedure [command_notify], after ** setting the TH1 variables "cmd_name", "cmd_args", ** and "cmd_flags" to appropriate values. ** ** webhook Executes the TH1 procedure [webpage_hook], after ** setting the TH1 variables "web_name", "web_args", ** and "web_flags" to appropriate values. ** ** webnotify Executes the TH1 procedure [webpage_notify], after ** setting the TH1 variables "web_name", "web_args", ** and "web_flags" to appropriate values. ** ** Options: ** ** --cgi Include a CGI response header in the output ** --http Include an HTTP response header in the output ** --th-trace Trace TH1 execution (for debugging purposes) */ void test_th_hook(void){ int rc = TH_OK; int nResult = 0; char *zResult = 0; int forceCgi, fullHttpReply; Th_InitTraceLog(); forceCgi = find_option("cgi", 0, 0)!=0; fullHttpReply = find_option("http", 0, 0)!=0; if( fullHttpReply ) forceCgi = 1; if( forceCgi ) Th_ForceCgi(fullHttpReply); if( g.argc<5 ){ usage("TYPE NAME FLAGS"); } if( fossil_stricmp(g.argv[2], "cmdhook")==0 ){ rc = Th_CommandHook(g.argv[3], (char)atoi(g.argv[4])); }else if( fossil_stricmp(g.argv[2], "cmdnotify")==0 ){ rc = Th_CommandNotify(g.argv[3], (char)atoi(g.argv[4])); }else if( fossil_stricmp(g.argv[2], "webhook")==0 ){ rc = Th_WebpageHook(g.argv[3], (char)atoi(g.argv[4])); }else if( fossil_stricmp(g.argv[2], "webnotify")==0 ){ rc = Th_WebpageNotify(g.argv[3], (char)atoi(g.argv[4])); }else{ fossil_fatal("Unknown TH1 hook %s\n", g.argv[2]); } if( g.interp ){ zResult = (char*)Th_GetResult(g.interp, &nResult); } sendText("RESULT (", -1, 0); sendText(Th_ReturnCodeName(rc, 0), -1, 0); sendText(")", -1, 0); if( zResult && nResult>0 ){ sendText(": ", -1, 0); sendText(zResult, nResult, 0); } sendText("\n", -1, 0); Th_PrintTraceLog(); if( forceCgi ) cgi_reply(); } #endif |