summaryrefslogtreecommitdiff
path: root/daemons
diff options
context:
space:
mode:
authorBrant Thomsen <brant.thomsen@harman.com>2017-05-04 09:52:16 -0600
committerBrant Thomsen <brant.thomsen@harman.com>2017-05-04 11:34:33 -0600
commit57e5cd36317e847fdc9d696edf4093136cac0625 (patch)
tree0454537263888e520b6817a736349778faecc219 /daemons
parent80c85b10ab9c5d957c7832f74a451e802cec2581 (diff)
downloadOpen-AVB-57e5cd36317e847fdc9d696edf4093136cac0625.tar.gz
Added prompt to tell the user to type "help" for commands
Diffstat (limited to 'daemons')
-rw-r--r--daemons/maap/common/maap_parse.c2
-rw-r--r--daemons/maap/linux/src/maap_daemon.c19
2 files changed, 18 insertions, 3 deletions
diff --git a/daemons/maap/common/maap_parse.c b/daemons/maap/common/maap_parse.c
index 01140cbb..c27bd0cd 100644
--- a/daemons/maap/common/maap_parse.c
+++ b/daemons/maap/common/maap_parse.c
@@ -182,8 +182,6 @@ void parse_usage(print_notify_callback_t print_callback, void *callback_data)
{
char szOutput[100];
print_callback(callback_data, MAAP_LOG_LEVEL_INFO,
- "Invalid command type");
- print_callback(callback_data, MAAP_LOG_LEVEL_INFO,
"Input usage:");
print_callback(callback_data, MAAP_LOG_LEVEL_INFO,
" init [<range_base> <range_size>] - Initialize the MAAP daemon to recognize");
diff --git a/daemons/maap/linux/src/maap_daemon.c b/daemons/maap/linux/src/maap_daemon.c
index ebfd409d..4748f6f5 100644
--- a/daemons/maap/linux/src/maap_daemon.c
+++ b/daemons/maap/linux/src/maap_daemon.c
@@ -332,6 +332,10 @@ static int act_as_server(const char *listenport, char *iface, int daemonize)
*/
MAAP_LOG_STATUS("Server started");
+ if (!daemonize) {
+ puts("Enter \"help\" for a list of valid commands.");
+ }
+
while (!exit_received)
{
/* Send any queued packets. */
@@ -507,6 +511,9 @@ static int act_as_server(const char *listenport, char *iface, int daemonize)
else if (result < 0)
{
/* Invalid command. Tell the user what valid commands are. */
+ if (strncmp(recvbuffer, "help", 4) != 0) {
+ puts("Invalid command type");
+ }
parse_usage(display_print_notify_result, NULL);
}
}
@@ -549,6 +556,9 @@ static int act_as_server(const char *listenport, char *iface, int daemonize)
else if (result < 0)
{
/* Invalid command. Tell the user what valid commands are. */
+ if (strncmp(recvbuffer, "help", 4) != 0) {
+ send_print_notify_result((void *) &(clientfd[i]), MAAP_LOG_LEVEL_INFO, "Invalid command type");
+ }
parse_usage(send_print_notify_result, (void *) &(clientfd[i]));
}
}
@@ -769,7 +779,9 @@ static int act_as_client(const char *listenport)
* Main event loop
*/
- printf("Client started\n");
+ puts("Client started");
+ puts("Enter \"help\" for a list of valid commands.");
+
while (!exit_received)
{
/* Wait for something to happen. */
@@ -841,6 +853,9 @@ static int act_as_client(const char *listenport)
memset(&recvcmd, 0, sizeof(Maap_Cmd));
rv = parse_text_cmd(recvbuffer, &recvcmd);
if (!rv) {
+ if (strncmp(recvbuffer, "help", 4) != 0) {
+ puts("Invalid command type");
+ }
parse_usage(display_print_notify_result, NULL);
}
break;
@@ -963,6 +978,7 @@ static void format_print_notify_result(int logLevel, const char *notifyText, cha
/* Print the remainder of the string. */
strcpy(pszOut, notifyText);
pszOut += strlen(pszOut);
+ *pszOut++ = '\r'; // Useful for Telnet interaction
*pszOut++ = '\n';
break;
}
@@ -971,6 +987,7 @@ static void format_print_notify_result(int logLevel, const char *notifyText, cha
for (i = 0; i < nLastSpace; ++i) {
*pszOut++ = *notifyText++;
}
+ *pszOut++ = '\r'; // Useful for Telnet interaction
*pszOut++ = '\n';
/* Go to the start of the next word in the string. */