Help message.
authorviric@llimona
Fri, 14 Sep 2007 21:25:51 +0200
changeset 6 4fe857c0b12a
parent 5 5ed1654fe407
child 7 af8d59476914
Help message.
main.c
usocket.c
--- a/main.c	Fri Sep 14 21:19:46 2007 +0200
+++ b/main.c	Fri Sep 14 21:25:51 2007 +0200
@@ -204,10 +204,22 @@
     return 0;
 }
 
+static int showhelp(const char *pname)
+{
+    printf("sdtdin-mix - Copyright 2007 LluĂ­s Batlle i Rossell\n");
+    printf("usage: %s [appcommand] [param1] [param2] ...\n", pname);
+    printf(" If you give _appcommand_, it starts the application and\n");
+    printf(" a stdin server on $SM_SOCKET or /tmp/socket-sm.UID.\n");
+    printf(" If not given, it starts a stdin client for the same socket.\n");
+    return 0;
+}
+
 int main(int argn, char **argv)
 {
     int res;
-    if (argn > 1)
+    if (argn > 1 && strcmp(argv[1], "-h") == 0)
+        res = showhelp(argv[0]);
+    else if (argn > 1)
         res = server(argn, argv);
     else
         res = client();
--- a/usocket.c	Fri Sep 14 21:19:46 2007 +0200
+++ b/usocket.c	Fri Sep 14 21:25:51 2007 +0200
@@ -5,13 +5,13 @@
 #include "main.h"
 
 static char socket_path[256];
-static char default_path_prefix[] = "/tmp/socket-stdin.";
+static char default_path_prefix[] = "/tmp/socket-sm.";
 
 static void get_path()
 {
     char *new;
     
-    new = getenv("STDIN_SOCKET");
+    new = getenv("SM_SOCKET");
     if (new == 0)
     {
         char num[20];