From 26e134b8a7dae21a699822009674b3131de6e250 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Tue, 11 Jul 2006 13:21:57 +0200 Subject: added gridsel to gridwm --- gridsel.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 gridsel.c (limited to 'gridsel.c') diff --git a/gridsel.c b/gridsel.c new file mode 100644 index 00000000..c76105e6 --- /dev/null +++ b/gridsel.c @@ -0,0 +1,47 @@ +/* + * (C)opyright MMVI Anselm R. Garbe + * See LICENSE file for license details. + */ + +#include +#include +#include + +#include + +static char version[] = "gridsel - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n"; + +static void +usage() +{ + fprintf(stderr, "%s\n", "usage: gridsel [-v]\n"); + exit(1); +} + +int +main(int argc, char **argv) +{ + unsigned char *data; + unsigned long i, offset, len, remain; + + /* command line args */ + if(argc > 1) { + if(!strncmp(argv[1], "-v", 3)) { + fprintf(stdout, "%s", version); + exit(0); + } else + usage(); + } + len = offset = remain = 0; + do { + data = getselection(offset, &len, &remain); + for(i = 0; i < len; i++) + putchar(data[i]); + offset += len; + free(data); + } + while(remain); + if(offset) + putchar('\n'); + return 0; +} -- cgit v1.2.3