summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2017-03-08 21:41:23 +0000
committerFreeArtMan <dos21h@gmail.com>2017-03-08 21:41:23 +0000
commitc69d3961efcf26caca9c9c6a0e0fa37a77f72b90 (patch)
treef35de4ea0ed9fe8e53aa5935d9d831d05d848535
parentfc16bb9a991b7ba1e60aa3f9282323deaf80c077 (diff)
downloadagni-c69d3961efcf26caca9c9c6a0e0fa37a77f72b90.tar.gz
agni-c69d3961efcf26caca9c9c6a0e0fa37a77f72b90.zip
Update mq_queue tool with flag descriptions
-rw-r--r--tool/mqtool.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/tool/mqtool.c b/tool/mqtool.c
index 76bf660..e6ce706 100644
--- a/tool/mqtool.c
+++ b/tool/mqtool.c
@@ -51,9 +51,11 @@ int main(int argc, char **argv)
//argument value that to send into queue
int flagSendStr = 0;
char *sStrSend = NULL; //mq string that should be push'ed in queue
+ //print help
+ int flagHelp = 0;
//get arguments
- while ((c = getopt(argc, argv, "elp:c:s:q:")) != -1)
+ while ((c = getopt(argc, argv, "elp:c:s:q:h")) != -1)
switch(c)
{
//list all mqueue's
@@ -83,6 +85,9 @@ int main(int argc, char **argv)
case 'e':
flagExtra = 1;
break;
+ case 'h':
+ flagHelp = 1;
+ break;
default:
break;
}
@@ -103,7 +108,7 @@ int main(int argc, char **argv)
{
if(sscanf(entryPath->d_name, "agni-%d", &id) == 1)
{
- printf("%s\n",entryPath->d_name);
+ printf("/%s\n",entryPath->d_name);
}
}
//should free entryPath? maybe
@@ -166,6 +171,7 @@ int main(int argc, char **argv)
cBuf = malloc(mqAttr.mq_msgsize);
if (cBuf == NULL)
{
+ perror("cant alloc memory");
exit(1);
}
@@ -229,4 +235,18 @@ int main(int argc, char **argv)
exit(0);
}
+ if (flagHelp)
+ {
+ printf("""Help: ./mqtool\n\
+-l - list all avaliable mq's\n\
+-p [MQ_NAME] - show params of mq\n\
+-c [MQ_NAME] - clear mq, and print all messages\n\
+-s [MQ_NAME] - mq name, \"/mq-name\"\n\
+-q [STR] - string to send, combined with -s \n\
+-e - print extra info if there is\n\
+-h - print this help\n\
+""");
+ exit(0);
+ }
+
} \ No newline at end of file