Fossil SCM

Fix several merge conflict issues from the previous check-in.

mistachkin 2014-06-08 00:16 th1Hooks
Commit 1f915a6859ac25beab43e7c0945543a879d8f466
3 files changed +2 -2 -1 +10 -9
+2 -2
--- src/db.c
+++ src/db.c
@@ -800,12 +800,12 @@
800800
** connection so that we can join between the various databases. In that
801801
** case, invoke this routine with useAttach as 1.
802802
*/
803803
void db_open_config(int useAttach){
804804
char *zDbName;
805
- const char *zHome;
806
- if( g.configOpen ){
805
+ char *zHome;
806
+ if( g.zConfigDbName ){
807807
if( useAttach==g.useAttach ) return;
808808
if( g.useAttach ){
809809
db_detach("configdb");
810810
g.useAttach = 0;
811811
}else if( g.dbConfig ){
812812
--- src/db.c
+++ src/db.c
@@ -800,12 +800,12 @@
800 ** connection so that we can join between the various databases. In that
801 ** case, invoke this routine with useAttach as 1.
802 */
803 void db_open_config(int useAttach){
804 char *zDbName;
805 const char *zHome;
806 if( g.configOpen ){
807 if( useAttach==g.useAttach ) return;
808 if( g.useAttach ){
809 db_detach("configdb");
810 g.useAttach = 0;
811 }else if( g.dbConfig ){
812
--- src/db.c
+++ src/db.c
@@ -800,12 +800,12 @@
800 ** connection so that we can join between the various databases. In that
801 ** case, invoke this routine with useAttach as 1.
802 */
803 void db_open_config(int useAttach){
804 char *zDbName;
805 char *zHome;
806 if( g.zConfigDbName ){
807 if( useAttach==g.useAttach ) return;
808 if( g.useAttach ){
809 db_detach("configdb");
810 g.useAttach = 0;
811 }else if( g.dbConfig ){
812
-1
--- src/main.c
+++ src/main.c
@@ -622,11 +622,10 @@
622622
g.zSshCmd = 0;
623623
if( g.fSqlTrace ) g.fSqlStats = 1;
624624
g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
625625
g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
626626
g.fNoThHook = find_option("no-th-hook", 0, 0)!=0;
627
- g.zLogin = find_option("user", "U", 1);
628627
g.zHttpAuth = 0;
629628
g.zLogin = find_option("user", "U", 1);
630629
g.zSSLIdentity = find_option("ssl-identity", 0, 1);
631630
g.zErrlog = find_option("errorlog", 0, 1);
632631
if( find_option("utc",0,0) ) g.fTimeFormat = 1;
633632
--- src/main.c
+++ src/main.c
@@ -622,11 +622,10 @@
622 g.zSshCmd = 0;
623 if( g.fSqlTrace ) g.fSqlStats = 1;
624 g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
625 g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
626 g.fNoThHook = find_option("no-th-hook", 0, 0)!=0;
627 g.zLogin = find_option("user", "U", 1);
628 g.zHttpAuth = 0;
629 g.zLogin = find_option("user", "U", 1);
630 g.zSSLIdentity = find_option("ssl-identity", 0, 1);
631 g.zErrlog = find_option("errorlog", 0, 1);
632 if( find_option("utc",0,0) ) g.fTimeFormat = 1;
633
--- src/main.c
+++ src/main.c
@@ -622,11 +622,10 @@
622 g.zSshCmd = 0;
623 if( g.fSqlTrace ) g.fSqlStats = 1;
624 g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
625 g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
626 g.fNoThHook = find_option("no-th-hook", 0, 0)!=0;
 
627 g.zHttpAuth = 0;
628 g.zLogin = find_option("user", "U", 1);
629 g.zSSLIdentity = find_option("ssl-identity", 0, 1);
630 g.zErrlog = find_option("errorlog", 0, 1);
631 if( find_option("utc",0,0) ) g.fTimeFormat = 1;
632
+10 -9
--- src/th_main.c
+++ src/th_main.c
@@ -31,10 +31,11 @@
3131
#define TH_INIT_NEED_CONFIG ((u32)0x00000001) /* Open configuration first? */
3232
#define TH_INIT_FORCE_TCL ((u32)0x00000002) /* Force Tcl to be enabled? */
3333
#define TH_INIT_FORCE_RESET ((u32)0x00000004) /* Force TH commands re-added? */
3434
#define TH_INIT_FORCE_SETUP ((u32)0x00000008) /* Force eval of setup script? */
3535
#define TH_INIT_DEFAULT (TH_INIT_NONE) /* Default flags. */
36
+#define TH_INIT_HOOK (TH_INIT_NEED_CONFIG|TH_INIT_FORCE_SETUP)
3637
#endif
3738
3839
/*
3940
** These are the "well-known" TH1 error messages that occur when no hook is
4041
** registered to be called prior to executing a command or processing a web
@@ -1201,11 +1202,11 @@
12011202
int Th_CommandHook(
12021203
const char *zName,
12031204
char cmdFlags
12041205
){
12051206
int rc = TH_OK;
1206
- Th_FossilInit(1, 1);
1207
+ Th_FossilInit(TH_INIT_HOOK);
12071208
Th_Store("cmd_name", zName);
12081209
Th_StoreInt("cmd_flags", cmdFlags);
12091210
rc = Th_Eval(g.interp, 0, "command_hook", -1);
12101211
if( rc==TH_ERROR ){
12111212
int nResult = 0;
@@ -1225,11 +1226,11 @@
12251226
** (i.e. "command_hook") explicitly forbids this by successfully returning
12261227
** TH_BREAK or TH_CONTINUE.
12271228
*/
12281229
if( g.thTrace ){
12291230
Th_Trace("[command_hook {%h}] => %h<br />\n", zName,
1230
- Th_ReturnCodeName(rc));
1231
+ Th_ReturnCodeName(rc, 0));
12311232
}
12321233
return (rc != TH_ERROR) ? rc : TH_OK;
12331234
}
12341235
12351236
/*
@@ -1242,17 +1243,17 @@
12421243
int Th_CommandNotify(
12431244
const char *zName,
12441245
char cmdFlags
12451246
){
12461247
int rc;
1247
- Th_FossilInit(1, 1);
1248
+ Th_FossilInit(TH_INIT_HOOK);
12481249
Th_Store("cmd_name", zName);
12491250
Th_StoreInt("cmd_flags", cmdFlags);
12501251
rc = Th_Eval(g.interp, 0, "command_notify", -1);
12511252
if( g.thTrace ){
12521253
Th_Trace("[command_notify {%h}] => %h<br />\n", zName,
1253
- Th_ReturnCodeName(rc));
1254
+ Th_ReturnCodeName(rc, 0));
12541255
}
12551256
return rc;
12561257
}
12571258
12581259
/*
@@ -1264,11 +1265,11 @@
12641265
int Th_WebpageHook(
12651266
const char *zName,
12661267
char cmdFlags
12671268
){
12681269
int rc = TH_OK;
1269
- Th_FossilInit(1, 1);
1270
+ Th_FossilInit(TH_INIT_HOOK);
12701271
Th_Store("web_name", zName);
12711272
Th_StoreInt("web_flags", cmdFlags);
12721273
rc = Th_Eval(g.interp, 0, "webpage_hook", -1);
12731274
if( rc==TH_ERROR ){
12741275
int nResult = 0;
@@ -1288,11 +1289,11 @@
12881289
** command (i.e. "webpage_hook") explicitly forbids this by successfully
12891290
** returning TH_BREAK or TH_CONTINUE.
12901291
*/
12911292
if( g.thTrace ){
12921293
Th_Trace("[webpage_hook {%h}] => %h<br />\n", zName,
1293
- Th_ReturnCodeName(rc));
1294
+ Th_ReturnCodeName(rc, 0));
12941295
}
12951296
return (rc != TH_ERROR) ? rc : TH_OK;
12961297
}
12971298
12981299
/*
@@ -1305,17 +1306,17 @@
13051306
int Th_WebpageNotify(
13061307
const char *zName,
13071308
char cmdFlags
13081309
){
13091310
int rc;
1310
- Th_FossilInit(1, 1);
1311
+ Th_FossilInit(TH_INIT_HOOK);
13111312
Th_Store("web_name", zName);
13121313
Th_StoreInt("web_flags", cmdFlags);
13131314
rc = Th_Eval(g.interp, 0, "webpage_notify", -1);
13141315
if( g.thTrace ){
13151316
Th_Trace("[webpage_notify {%h}] => %h<br />\n", zName,
1316
- Th_ReturnCodeName(rc));
1317
+ Th_ReturnCodeName(rc, 0));
13171318
}
13181319
return rc;
13191320
}
13201321
13211322
/*
@@ -1441,10 +1442,10 @@
14411442
}else{
14421443
fossil_fatal("Unknown TH1 hook %s\n", g.argv[2]);
14431444
}
14441445
zResult = (char*)Th_GetResult(g.interp, &nResult);
14451446
sendText("RESULT (", -1, 0);
1446
- sendText(Th_ReturnCodeName(rc), -1, 0);
1447
+ sendText(Th_ReturnCodeName(rc, 0), -1, 0);
14471448
sendText("): ", -1, 0);
14481449
sendText(zResult, nResult, 0);
14491450
sendText("\n", -1, 0);
14501451
}
14511452
--- src/th_main.c
+++ src/th_main.c
@@ -31,10 +31,11 @@
31 #define TH_INIT_NEED_CONFIG ((u32)0x00000001) /* Open configuration first? */
32 #define TH_INIT_FORCE_TCL ((u32)0x00000002) /* Force Tcl to be enabled? */
33 #define TH_INIT_FORCE_RESET ((u32)0x00000004) /* Force TH commands re-added? */
34 #define TH_INIT_FORCE_SETUP ((u32)0x00000008) /* Force eval of setup script? */
35 #define TH_INIT_DEFAULT (TH_INIT_NONE) /* Default flags. */
 
36 #endif
37
38 /*
39 ** These are the "well-known" TH1 error messages that occur when no hook is
40 ** registered to be called prior to executing a command or processing a web
@@ -1201,11 +1202,11 @@
1201 int Th_CommandHook(
1202 const char *zName,
1203 char cmdFlags
1204 ){
1205 int rc = TH_OK;
1206 Th_FossilInit(1, 1);
1207 Th_Store("cmd_name", zName);
1208 Th_StoreInt("cmd_flags", cmdFlags);
1209 rc = Th_Eval(g.interp, 0, "command_hook", -1);
1210 if( rc==TH_ERROR ){
1211 int nResult = 0;
@@ -1225,11 +1226,11 @@
1225 ** (i.e. "command_hook") explicitly forbids this by successfully returning
1226 ** TH_BREAK or TH_CONTINUE.
1227 */
1228 if( g.thTrace ){
1229 Th_Trace("[command_hook {%h}] => %h<br />\n", zName,
1230 Th_ReturnCodeName(rc));
1231 }
1232 return (rc != TH_ERROR) ? rc : TH_OK;
1233 }
1234
1235 /*
@@ -1242,17 +1243,17 @@
1242 int Th_CommandNotify(
1243 const char *zName,
1244 char cmdFlags
1245 ){
1246 int rc;
1247 Th_FossilInit(1, 1);
1248 Th_Store("cmd_name", zName);
1249 Th_StoreInt("cmd_flags", cmdFlags);
1250 rc = Th_Eval(g.interp, 0, "command_notify", -1);
1251 if( g.thTrace ){
1252 Th_Trace("[command_notify {%h}] => %h<br />\n", zName,
1253 Th_ReturnCodeName(rc));
1254 }
1255 return rc;
1256 }
1257
1258 /*
@@ -1264,11 +1265,11 @@
1264 int Th_WebpageHook(
1265 const char *zName,
1266 char cmdFlags
1267 ){
1268 int rc = TH_OK;
1269 Th_FossilInit(1, 1);
1270 Th_Store("web_name", zName);
1271 Th_StoreInt("web_flags", cmdFlags);
1272 rc = Th_Eval(g.interp, 0, "webpage_hook", -1);
1273 if( rc==TH_ERROR ){
1274 int nResult = 0;
@@ -1288,11 +1289,11 @@
1288 ** command (i.e. "webpage_hook") explicitly forbids this by successfully
1289 ** returning TH_BREAK or TH_CONTINUE.
1290 */
1291 if( g.thTrace ){
1292 Th_Trace("[webpage_hook {%h}] => %h<br />\n", zName,
1293 Th_ReturnCodeName(rc));
1294 }
1295 return (rc != TH_ERROR) ? rc : TH_OK;
1296 }
1297
1298 /*
@@ -1305,17 +1306,17 @@
1305 int Th_WebpageNotify(
1306 const char *zName,
1307 char cmdFlags
1308 ){
1309 int rc;
1310 Th_FossilInit(1, 1);
1311 Th_Store("web_name", zName);
1312 Th_StoreInt("web_flags", cmdFlags);
1313 rc = Th_Eval(g.interp, 0, "webpage_notify", -1);
1314 if( g.thTrace ){
1315 Th_Trace("[webpage_notify {%h}] => %h<br />\n", zName,
1316 Th_ReturnCodeName(rc));
1317 }
1318 return rc;
1319 }
1320
1321 /*
@@ -1441,10 +1442,10 @@
1441 }else{
1442 fossil_fatal("Unknown TH1 hook %s\n", g.argv[2]);
1443 }
1444 zResult = (char*)Th_GetResult(g.interp, &nResult);
1445 sendText("RESULT (", -1, 0);
1446 sendText(Th_ReturnCodeName(rc), -1, 0);
1447 sendText("): ", -1, 0);
1448 sendText(zResult, nResult, 0);
1449 sendText("\n", -1, 0);
1450 }
1451
--- src/th_main.c
+++ src/th_main.c
@@ -31,10 +31,11 @@
31 #define TH_INIT_NEED_CONFIG ((u32)0x00000001) /* Open configuration first? */
32 #define TH_INIT_FORCE_TCL ((u32)0x00000002) /* Force Tcl to be enabled? */
33 #define TH_INIT_FORCE_RESET ((u32)0x00000004) /* Force TH commands re-added? */
34 #define TH_INIT_FORCE_SETUP ((u32)0x00000008) /* Force eval of setup script? */
35 #define TH_INIT_DEFAULT (TH_INIT_NONE) /* Default flags. */
36 #define TH_INIT_HOOK (TH_INIT_NEED_CONFIG|TH_INIT_FORCE_SETUP)
37 #endif
38
39 /*
40 ** These are the "well-known" TH1 error messages that occur when no hook is
41 ** registered to be called prior to executing a command or processing a web
@@ -1201,11 +1202,11 @@
1202 int Th_CommandHook(
1203 const char *zName,
1204 char cmdFlags
1205 ){
1206 int rc = TH_OK;
1207 Th_FossilInit(TH_INIT_HOOK);
1208 Th_Store("cmd_name", zName);
1209 Th_StoreInt("cmd_flags", cmdFlags);
1210 rc = Th_Eval(g.interp, 0, "command_hook", -1);
1211 if( rc==TH_ERROR ){
1212 int nResult = 0;
@@ -1225,11 +1226,11 @@
1226 ** (i.e. "command_hook") explicitly forbids this by successfully returning
1227 ** TH_BREAK or TH_CONTINUE.
1228 */
1229 if( g.thTrace ){
1230 Th_Trace("[command_hook {%h}] => %h<br />\n", zName,
1231 Th_ReturnCodeName(rc, 0));
1232 }
1233 return (rc != TH_ERROR) ? rc : TH_OK;
1234 }
1235
1236 /*
@@ -1242,17 +1243,17 @@
1243 int Th_CommandNotify(
1244 const char *zName,
1245 char cmdFlags
1246 ){
1247 int rc;
1248 Th_FossilInit(TH_INIT_HOOK);
1249 Th_Store("cmd_name", zName);
1250 Th_StoreInt("cmd_flags", cmdFlags);
1251 rc = Th_Eval(g.interp, 0, "command_notify", -1);
1252 if( g.thTrace ){
1253 Th_Trace("[command_notify {%h}] => %h<br />\n", zName,
1254 Th_ReturnCodeName(rc, 0));
1255 }
1256 return rc;
1257 }
1258
1259 /*
@@ -1264,11 +1265,11 @@
1265 int Th_WebpageHook(
1266 const char *zName,
1267 char cmdFlags
1268 ){
1269 int rc = TH_OK;
1270 Th_FossilInit(TH_INIT_HOOK);
1271 Th_Store("web_name", zName);
1272 Th_StoreInt("web_flags", cmdFlags);
1273 rc = Th_Eval(g.interp, 0, "webpage_hook", -1);
1274 if( rc==TH_ERROR ){
1275 int nResult = 0;
@@ -1288,11 +1289,11 @@
1289 ** command (i.e. "webpage_hook") explicitly forbids this by successfully
1290 ** returning TH_BREAK or TH_CONTINUE.
1291 */
1292 if( g.thTrace ){
1293 Th_Trace("[webpage_hook {%h}] => %h<br />\n", zName,
1294 Th_ReturnCodeName(rc, 0));
1295 }
1296 return (rc != TH_ERROR) ? rc : TH_OK;
1297 }
1298
1299 /*
@@ -1305,17 +1306,17 @@
1306 int Th_WebpageNotify(
1307 const char *zName,
1308 char cmdFlags
1309 ){
1310 int rc;
1311 Th_FossilInit(TH_INIT_HOOK);
1312 Th_Store("web_name", zName);
1313 Th_StoreInt("web_flags", cmdFlags);
1314 rc = Th_Eval(g.interp, 0, "webpage_notify", -1);
1315 if( g.thTrace ){
1316 Th_Trace("[webpage_notify {%h}] => %h<br />\n", zName,
1317 Th_ReturnCodeName(rc, 0));
1318 }
1319 return rc;
1320 }
1321
1322 /*
@@ -1441,10 +1442,10 @@
1442 }else{
1443 fossil_fatal("Unknown TH1 hook %s\n", g.argv[2]);
1444 }
1445 zResult = (char*)Th_GetResult(g.interp, &nResult);
1446 sendText("RESULT (", -1, 0);
1447 sendText(Th_ReturnCodeName(rc, 0), -1, 0);
1448 sendText("): ", -1, 0);
1449 sendText(zResult, nResult, 0);
1450 sendText("\n", -1, 0);
1451 }
1452

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button