about summary refs log tree commit diff stats
path: root/gridsel.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@wmii.de>2006-07-11 13:21:57 +0200
committerAnselm R. Garbe <garbeam@wmii.de>2006-07-11 13:21:57 +0200
commit26e134b8a7dae21a699822009674b3131de6e250 (patch)
treece783ecc7317440d3947eff29c42075620e98858 /gridsel.c
parent005362043d8b0bbf856f301c231d4f10c519b8c4 (diff)
downloaddwm-26e134b8a7dae21a699822009674b3131de6e250.tar.gz
added gridsel to gridwm
Diffstat (limited to 'gridsel.c')
-rw-r--r--gridsel.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/gridsel.c b/gridsel.c
new file mode 100644
index 0000000..c76105e
--- /dev/null
+++ b/gridsel.c
@@ -0,0 +1,47 @@
+/*
+ * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
+ * See LICENSE file for license details.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <util.h>
+
+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;
+}
ref='#n183'>183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239