X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=osdc.c;fp=osdc.c;h=0f01ae745fc561624c771b6c449c10a1cebf794c;hb=45ae33902e54e10b6950cadb4a1e3d96e59a0341;hp=27b6c630e386fbcb3174f668ad4bb76174607d1b;hpb=b205aed8e1d020b99a3e275348b31879e78bbd7e;p=osdd.git diff --git a/osdc.c b/osdc.c index 27b6c63..0f01ae7 100644 --- a/osdc.c +++ b/osdc.c @@ -14,41 +14,70 @@ #include "util.h" #include "send.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