Fossil SCM

s/userName/name/, for consistency.

stephan 2011-10-02 18:18 UTC json-multitag-test
Commit 94689bbf29c1ab6d2a6b16e24724c3b63c50df56
1 file changed +14 -4
+14 -4
--- src/json.c
+++ src/json.c
@@ -945,22 +945,29 @@
945945
part = cson_value_new_string(arg,strlen(arg));
946946
cson_array_append(g.json.cmd.a, part);
947947
}
948948
}
949949
950
- while(!g.isHTTP){ /* simulate JSON POST data via input file. */
950
+ while(!g.isHTTP){
951
+ /* Simulate JSON POST data via input file. Pedantic reminder:
952
+ error handling does not honor user-supplied g.json.outOpt
953
+ because outOpt cannot (generically) be configured until after
954
+ POST-reading is finished.
955
+ */
951956
FILE * inFile = NULL;
952957
char const * jfile = find_option("json-input",NULL,1);
953958
if(!jfile || !*jfile){
954959
break;
955960
}
956961
inFile = (0==strcmp("-",jfile))
957962
? stdin
958963
: fopen(jfile,"rb");
959964
if(!inFile){
960
- json_err(FSL_JSON_E_UNKNOWN,"Could not open JSON file.",1);
961
- fossil_exit(1);
965
+ g.json.resultCode = FSL_JSON_E_UNKNOWN;
966
+ fossil_fatal("Could not open JSON file [%s].",jfile)
967
+ /* Does not return. */
968
+ ;
962969
}
963970
cgi_parse_POST_JSON(inFile, 0);
964971
if( stdin != inFile ){
965972
fclose(inFile);
966973
}
@@ -1055,10 +1062,13 @@
10551062
** In server/CGI modes the path is taken from PATH_INFO.
10561063
**
10571064
** The returned bytes are owned by g.json.cmd.v and _may_ be
10581065
** invalidated if that object is modified (depending on how it is
10591066
** modified).
1067
+**
1068
+** Note that CLI options are not included in the command path. Use
1069
+** find_option() to get those.
10601070
**
10611071
*/
10621072
char const * json_command_arg(unsigned char ndx){
10631073
cson_array * ar = g.json.cmd.a;
10641074
assert((NULL!=ar) && "Internal error. Was json_mode_bootstrap() called?");
@@ -1450,11 +1460,11 @@
14501460
/* reminder: we don't use g.zLogin because it's 0 for the guest
14511461
user and the HTML UI appears to currently allow the name to be
14521462
changed (but doing so would break other code). */
14531463
char const * str = (char const *)sqlite3_column_text(q.pStmt,0);
14541464
if( str ){
1455
- cson_object_set( obj, "userName",
1465
+ cson_object_set( obj, "name",
14561466
cson_value_new_string(str,strlen(str)) );
14571467
}
14581468
str = (char const *)sqlite3_column_text(q.pStmt,1);
14591469
if( str ){
14601470
cson_object_set( obj, "capabilities",
14611471
--- src/json.c
+++ src/json.c
@@ -945,22 +945,29 @@
945 part = cson_value_new_string(arg,strlen(arg));
946 cson_array_append(g.json.cmd.a, part);
947 }
948 }
949
950 while(!g.isHTTP){ /* simulate JSON POST data via input file. */
 
 
 
 
 
951 FILE * inFile = NULL;
952 char const * jfile = find_option("json-input",NULL,1);
953 if(!jfile || !*jfile){
954 break;
955 }
956 inFile = (0==strcmp("-",jfile))
957 ? stdin
958 : fopen(jfile,"rb");
959 if(!inFile){
960 json_err(FSL_JSON_E_UNKNOWN,"Could not open JSON file.",1);
961 fossil_exit(1);
 
 
962 }
963 cgi_parse_POST_JSON(inFile, 0);
964 if( stdin != inFile ){
965 fclose(inFile);
966 }
@@ -1055,10 +1062,13 @@
1055 ** In server/CGI modes the path is taken from PATH_INFO.
1056 **
1057 ** The returned bytes are owned by g.json.cmd.v and _may_ be
1058 ** invalidated if that object is modified (depending on how it is
1059 ** modified).
 
 
 
1060 **
1061 */
1062 char const * json_command_arg(unsigned char ndx){
1063 cson_array * ar = g.json.cmd.a;
1064 assert((NULL!=ar) && "Internal error. Was json_mode_bootstrap() called?");
@@ -1450,11 +1460,11 @@
1450 /* reminder: we don't use g.zLogin because it's 0 for the guest
1451 user and the HTML UI appears to currently allow the name to be
1452 changed (but doing so would break other code). */
1453 char const * str = (char const *)sqlite3_column_text(q.pStmt,0);
1454 if( str ){
1455 cson_object_set( obj, "userName",
1456 cson_value_new_string(str,strlen(str)) );
1457 }
1458 str = (char const *)sqlite3_column_text(q.pStmt,1);
1459 if( str ){
1460 cson_object_set( obj, "capabilities",
1461
--- src/json.c
+++ src/json.c
@@ -945,22 +945,29 @@
945 part = cson_value_new_string(arg,strlen(arg));
946 cson_array_append(g.json.cmd.a, part);
947 }
948 }
949
950 while(!g.isHTTP){
951 /* Simulate JSON POST data via input file. Pedantic reminder:
952 error handling does not honor user-supplied g.json.outOpt
953 because outOpt cannot (generically) be configured until after
954 POST-reading is finished.
955 */
956 FILE * inFile = NULL;
957 char const * jfile = find_option("json-input",NULL,1);
958 if(!jfile || !*jfile){
959 break;
960 }
961 inFile = (0==strcmp("-",jfile))
962 ? stdin
963 : fopen(jfile,"rb");
964 if(!inFile){
965 g.json.resultCode = FSL_JSON_E_UNKNOWN;
966 fossil_fatal("Could not open JSON file [%s].",jfile)
967 /* Does not return. */
968 ;
969 }
970 cgi_parse_POST_JSON(inFile, 0);
971 if( stdin != inFile ){
972 fclose(inFile);
973 }
@@ -1055,10 +1062,13 @@
1062 ** In server/CGI modes the path is taken from PATH_INFO.
1063 **
1064 ** The returned bytes are owned by g.json.cmd.v and _may_ be
1065 ** invalidated if that object is modified (depending on how it is
1066 ** modified).
1067 **
1068 ** Note that CLI options are not included in the command path. Use
1069 ** find_option() to get those.
1070 **
1071 */
1072 char const * json_command_arg(unsigned char ndx){
1073 cson_array * ar = g.json.cmd.a;
1074 assert((NULL!=ar) && "Internal error. Was json_mode_bootstrap() called?");
@@ -1450,11 +1460,11 @@
1460 /* reminder: we don't use g.zLogin because it's 0 for the guest
1461 user and the HTML UI appears to currently allow the name to be
1462 changed (but doing so would break other code). */
1463 char const * str = (char const *)sqlite3_column_text(q.pStmt,0);
1464 if( str ){
1465 cson_object_set( obj, "name",
1466 cson_value_new_string(str,strlen(str)) );
1467 }
1468 str = (char const *)sqlite3_column_text(q.pStmt,1);
1469 if( str ){
1470 cson_object_set( obj, "capabilities",
1471

Keyboard Shortcuts

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