diff 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
line wrap: on
line diff
--- a/Plugins/Samples/Basic/Plugin.c	Mon Feb 02 16:14:29 2015 +0100
+++ b/Plugins/Samples/Basic/Plugin.c	Tue Feb 03 10:25:56 2015 +0100
@@ -280,7 +280,7 @@
 {
   OrthancPluginMemoryBuffer tmp;
   char info[1024], *s;
-  int counter;
+  int counter, i;
 
   context = c;
   OrthancPluginLogWarning(context, "Sample plugin is initializing");
@@ -316,6 +316,16 @@
   OrthancPluginLogWarning(context, info);
   OrthancPluginFreeString(context, s);
 
+  /* Print the command-line arguments of Orthanc */
+  counter = OrthancPluginGetCommandLineArgumentsCount(context);
+  for (i = 0; i < counter; i++)
+  {
+    s = OrthancPluginGetCommandLineArgument(context, i);
+    sprintf(info, "  Command-line argument %d: \"%s\"", i, s);
+    OrthancPluginLogWarning(context, info);
+    OrthancPluginFreeString(context, s);    
+  }
+
   /* Register the callbacks */
   OrthancPluginRegisterRestCallback(context, "/(plu.*)/hello", Callback1);
   OrthancPluginRegisterRestCallback(context, "/plu.*/image", Callback2);