Browse code

- changed the meaning of rpc_scan* functions, they return the number of parameters found, in case of an error they return the number of parameters successfuly converted as negative number

Jan Janak authored on 20/12/2005 11:32:22
Showing 1 changed files
... ...
@@ -88,7 +88,10 @@ static void system_methodHelp(rpc_t* rpc, void* c)
88 88
 	rpc_export_t* ptr;
89 89
 	char* name;
90 90
 
91
-	if (rpc->scan(c, "s", &name) < 0) return;
91
+	if (rpc->scan(c, "s", &name) < 0) {
92
+		rpc->fault(c, 400, "Method Name Expected");
93
+		return;
94
+	}
92 95
 
93 96
 	for(t = modules; t; t = t->next) {
94 97
 		for(ptr = t->exports->rpc_methods; ptr && ptr->name; ptr++) {
... ...
@@ -102,7 +105,6 @@ static void system_methodHelp(rpc_t* rpc, void* c)
102 102
 			}
103 103
 		}
104 104
 	}
105
-	rpc->fault(c, 500, "Method Not Implemented");
106 105
 }
107 106
 
108 107
 
... ...
@@ -111,11 +113,11 @@ static const char* core_prints_doc[] = {
111 111
 	0                                           /* Method signature(s) */
112 112
 };
113 113
 
114
+
114 115
 static void core_prints(rpc_t* rpc, void* c)
115 116
 {
116
-	char* string;
117
-
118
-	if (rpc->scan(c, "s", &string) < 0) return;
117
+	char* string = 0;
118
+	rpc->scan(c, "s", &string);
119 119
 	rpc->add(c, "s", string);
120 120
 }
121 121
 
... ...
@@ -221,27 +223,32 @@ static const char* core_kill_doc[] = {
221 221
 
222 222
 static void core_kill(rpc_t* rpc, void* c)
223 223
 {
224
-	int sig_no;
225
-	if (rpc->scan(c, "d", &sig_no) < 0) return;
224
+	int sig_no = 15;
225
+	rpc->scan(c, "d", &sig_no);
226 226
 	rpc->send(c);
227 227
 	kill(0, sig_no);
228 228
 }
229 229
 
230
+static const char* core_test_doc[] = {
231
+	"Sends the given signal to SER.",  /* Documentation string */
232
+	0                                  /* Method signature(s) */
233
+};
234
+
230 235
 
231 236
 /* 
232 237
  * RPC Methods exported by this module 
233 238
  */
234 239
 rpc_export_t core_rpc_methods[] = {
235 240
 	{"system.listMethods",     system_listMethods,     system_listMethods_doc,     RET_ARRAY},
236
-	{"system.methodSignature", system_methodSignature, system_methodSignature_doc, RET_VALUE},
237
-	{"system.methodHelp",      system_methodHelp,      system_methodHelp_doc,      RET_VALUE},
238
-	{"core.prints",            core_prints,            core_prints_doc,            RET_VALUE},
239
-	{"core.version",           core_version,           core_version_doc,           RET_VALUE},
240
-	{"core.uptime",            core_uptime,            core_uptime_doc,            RET_VALUE},
241
+	{"system.methodSignature", system_methodSignature, system_methodSignature_doc, 0        },
242
+	{"system.methodHelp",      system_methodHelp,      system_methodHelp_doc,      0        },
243
+	{"core.prints",            core_prints,            core_prints_doc,            0        },
244
+	{"core.version",           core_version,           core_version_doc,           0        },
245
+	{"core.uptime",            core_uptime,            core_uptime_doc,            0        },
241 246
 	{"core.ps",                core_ps,                core_ps_doc,                RET_ARRAY},
242
-	{"core.pwd",               core_pwd,               core_pwd_doc,               RET_VALUE},
247
+	{"core.pwd",               core_pwd,               core_pwd_doc,               RET_ARRAY},
243 248
 	{"core.arg",               core_arg,               core_arg_doc,               RET_ARRAY},
244
-	{"core.kill",              core_kill,              core_kill_doc,              RET_VALUE},
249
+	{"core.kill",              core_kill,              core_kill_doc,              0        },
245 250
 	{0, 0, 0, 0}
246 251
 };
247 252