|
|
@@ -37,7 +37,8 @@
|
|
|
#define PIUMSG "piumsg"
|
|
|
|
|
|
#define PIUMSG_VERSION "0.1.0"
|
|
|
-#define PIUMSG_HOST "localhost"
|
|
|
+#define PIUMSG_HOST "127.0.0.1"
|
|
|
+#define PIUMSG_PATH "ws"
|
|
|
|
|
|
//#define PIUMSG_HOST "ws://192.168.0.26"
|
|
|
#define PIUMSG_PORT 8001
|
|
|
@@ -45,6 +46,7 @@
|
|
|
#define _BUFLEN 1024
|
|
|
|
|
|
char *g_host = NULL;
|
|
|
+char *g_path= NULL;
|
|
|
int g_port = PIUMSG_PORT;
|
|
|
char *g_msg = NULL;
|
|
|
|
|
|
@@ -120,6 +122,7 @@ void show_help(FILE *fp) {
|
|
|
fprintf(fp, "\n");
|
|
|
fprintf(fp, " msg push message\n");
|
|
|
fprintf(fp, " [-H host] host (default %s)\n", PIUMSG_HOST);
|
|
|
+ fprintf(fp, " [-P path] path on host (default %s)\n", PIUMSG_PATH);
|
|
|
fprintf(fp, " [-p port] port (default %i)\n", PIUMSG_PORT);
|
|
|
fprintf(fp, " [-V] verbose\n");
|
|
|
fprintf(fp, " [-h] help (this screen)\n");
|
|
|
@@ -143,6 +146,9 @@ int main(int argc, char **argv) {
|
|
|
case 'H':
|
|
|
g_host = strdup(optarg);
|
|
|
break;
|
|
|
+ case 'P':
|
|
|
+ g_path = strdup(optarg);
|
|
|
+ break;
|
|
|
case 'p':
|
|
|
g_port = atoi(optarg);
|
|
|
break;
|
|
|
@@ -174,7 +180,11 @@ int main(int argc, char **argv) {
|
|
|
g_host = strdup(PIUMSG_HOST);
|
|
|
}
|
|
|
|
|
|
- snprintf(s_url, _BUFLEN-1, "ws://%s:%i", g_host, g_port);
|
|
|
+ if (!g_path) {
|
|
|
+ g_path = strdup(PIUMSG_PATH);
|
|
|
+ }
|
|
|
+
|
|
|
+ snprintf(s_url, _BUFLEN-1, "ws://%s:%i/%s", g_host, g_port, g_path);
|
|
|
s_url[_BUFLEN-1]=0;
|
|
|
|
|
|
mg_mgr_init(&mgr);
|
|
|
@@ -187,5 +197,6 @@ int main(int argc, char **argv) {
|
|
|
mg_mgr_free(&mgr);
|
|
|
free(g_msg);
|
|
|
free(g_host);
|
|
|
+ free(g_path);
|
|
|
return 0;
|
|
|
}
|