X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=osdc.c;h=f3251d02f7a513c9e52985489ca796cadc3b1be5;hb=3ea5c97c3503076b1100b4fdcf64f6549c3b9e63;hp=27b6c630e386fbcb3174f668ad4bb76174607d1b;hpb=66ea7419541d01ea378523d106e8946b667cbe61;p=osdd.git diff --git a/osdc.c b/osdc.c index 27b6c63..f3251d0 100644 --- a/osdc.c +++ b/osdc.c @@ -11,44 +11,72 @@ #include #include -#include "util.h" -#include "send.h" +#include "osd.h" + +static struct osd_msg *msg; static void NONRET usage(void) { - fprintf(stderr, "Usage: osdc [--= | ]*\n"); + fprintf(stderr, "\ +Usage: osdc [--= | ]*\n\ +\n\ +Either or can be `-' for standard input.\n\ +"); exit(1); } +static void +parse_stdin(char *key) +{ + char line[1024]; + while (fgets(line, sizeof(line), stdin)) + { + char *nl = strchr(line, '\n'); + if (nl) + *nl = 0; + osd_add_line(msg, key, line); + } +} + int main(int argc, char **argv) { - struct osd_msg *m = osd_new_msg(); + msg = osd_new_msg(); int more_opts = 1; for (int i=1; i