comparison Plugins/Samples/Basic/Plugin.c @ 1280:d6a65dc6d0ac

Plugins can access the command-line arguments used to launch Orthanc
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 03 Feb 2015 10:25:56 +0100
parents 40725595aaf0
children 7bccdd221e2b
comparison
equal deleted inserted replaced
1279:7f3a65e84d4b 1280:d6a65dc6d0ac
278 278
279 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c) 279 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c)
280 { 280 {
281 OrthancPluginMemoryBuffer tmp; 281 OrthancPluginMemoryBuffer tmp;
282 char info[1024], *s; 282 char info[1024], *s;
283 int counter; 283 int counter, i;
284 284
285 context = c; 285 context = c;
286 OrthancPluginLogWarning(context, "Sample plugin is initializing"); 286 OrthancPluginLogWarning(context, "Sample plugin is initializing");
287 287
288 /* Check the version of the Orthanc core */ 288 /* Check the version of the Orthanc core */
313 313
314 s = OrthancPluginGetConfigurationPath(context); 314 s = OrthancPluginGetConfigurationPath(context);
315 sprintf(info, " Path to configuration file: %s", s); 315 sprintf(info, " Path to configuration file: %s", s);
316 OrthancPluginLogWarning(context, info); 316 OrthancPluginLogWarning(context, info);
317 OrthancPluginFreeString(context, s); 317 OrthancPluginFreeString(context, s);
318
319 /* Print the command-line arguments of Orthanc */
320 counter = OrthancPluginGetCommandLineArgumentsCount(context);
321 for (i = 0; i < counter; i++)
322 {
323 s = OrthancPluginGetCommandLineArgument(context, i);
324 sprintf(info, " Command-line argument %d: \"%s\"", i, s);
325 OrthancPluginLogWarning(context, info);
326 OrthancPluginFreeString(context, s);
327 }
318 328
319 /* Register the callbacks */ 329 /* Register the callbacks */
320 OrthancPluginRegisterRestCallback(context, "/(plu.*)/hello", Callback1); 330 OrthancPluginRegisterRestCallback(context, "/(plu.*)/hello", Callback1);
321 OrthancPluginRegisterRestCallback(context, "/plu.*/image", Callback2); 331 OrthancPluginRegisterRestCallback(context, "/plu.*/image", Callback2);
322 OrthancPluginRegisterRestCallback(context, "/plugin/instances/([^/]+)/info", Callback3); 332 OrthancPluginRegisterRestCallback(context, "/plugin/instances/([^/]+)/info", Callback3);