summaryrefslogtreecommitdiff
path: root/client/main.cc
diff options
context:
space:
mode:
authorsenator <senator>2008-03-18 12:38:10 +0000
committersenator <senator>2008-03-18 12:38:10 +0000
commitb275f9c20d283c4d45fb08d4c306c8481d54565d (patch)
tree1f440431d637e42659f7f6afc37b38c7f6aa3322 /client/main.cc
parenta6c5f2f2db35be2bc3052c02f75f20729ce4f923 (diff)
set command line behaviour to use macro, cpr and user
Diffstat (limited to 'client/main.cc')
-rw-r--r--client/main.cc64
1 files changed, 63 insertions, 1 deletions
diff --git a/client/main.cc b/client/main.cc
index 025b713..fbedfc2 100644
--- a/client/main.cc
+++ b/client/main.cc
@@ -36,8 +36,70 @@ int main(int argc, char *argv[])
MyEventHandler *eventhandler = new MyEventHandler();
app.installEventFilter( eventhandler );
+
+ char macro[100] = "example";
+ char cpr[11] = "0000000000";
+ char user[20] = "testuser";
+
+ int a;
+ for(a=1; a < argc; a++) {
+ /*
+ if(argv[a][0] != '-') {
+ strcpy(cprfile, argv[a]);
+ continue;
+ }
+ */
+ if(strcmp(argv[a], "-h") == 0 || strcmp(argv[a], "--help") == 0 ||
+ strcmp(argv[a], "-?") == 0) {
+ printf("Usage: pracro -m MACRO -c CPR -U USER\n");
+ printf("Executes the requested Pracro MACRO using supplied CPR "
+ "and USER.\n");
+ printf("\n");
+ printf(" -h, --help Displays this help text.\n");
+ printf(" -m, --macro MACRO Requests macro MACRO from the Pracro "
+ "Server, defaults to \"example\".\n");
+ printf(" -c, --cpr CPR Defines the cpr for use with the "
+ "macro, defaults to \"0000000000\".\n");
+ printf(" -U, --user USER Defines the requesting "
+ "user(not the patient), defaults to \"testuser\"");
+ printf("\n");
+ return 0;
+ }
+ if(strcmp(argv[a], "-m") == 0 || strcmp(argv[a], "--macro") == 0) {
+ if(a+1 == argc || argv[a+1][0] == '-') {
+ printf("Missing argument for macro, exiting...\n");
+ exit(1);
+ }
+ strcpy(macro, argv[a+1]);
+ a++;
+ continue;
+ }
+ if(strcmp(argv[a], "-c") == 0 || strcmp(argv[a], "--cpr") == 0) {
+ if(a+1 == argc || argv[a+1][0] == '-') {
+ printf("Missing argument for cpr, exiting...\n");
+ exit(1);
+ }
+ strcpy(cpr, argv[a+1]);
+ a++;
+ continue;
+ }
+ if(strcmp(argv[a], "-U") == 0 || strcmp(argv[a], "--user") == 0) {
+ if(a+1 == argc || argv[a+1][0] == '-') {
+ printf("Missing argument for user, exiting...\n");
+ exit(1);
+ }
+ strcpy(user, argv[a+1]);
+ a++;
+ continue;
+ }
+ }
+
+
+
+
+
- new_macro("example");
+ new_macro(macro, cpr, user);
return app.exec();
}