dwm-meillo

view gridsel.c @ 12:a2b399582afe

new stuff
author Anselm R. Garbe <garbeam@wmii.de>
date Tue, 11 Jul 2006 14:53:22 +0200
parents
children
line source
1 /*
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
4 */
6 #include <stdlib.h>
7 #include <stdio.h>
8 #include <string.h>
10 #include <util.h>
12 static char version[] = "gridsel - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n";
14 static void
15 usage()
16 {
17 fprintf(stderr, "%s\n", "usage: gridsel [-v]\n");
18 exit(1);
19 }
21 int
22 main(int argc, char **argv)
23 {
24 unsigned char *data;
25 unsigned long i, offset, len, remain;
27 /* command line args */
28 if(argc > 1) {
29 if(!strncmp(argv[1], "-v", 3)) {
30 fprintf(stdout, "%s", version);
31 exit(0);
32 } else
33 usage();
34 }
35 len = offset = remain = 0;
36 do {
37 data = getselection(offset, &len, &remain);
38 for(i = 0; i < len; i++)
39 putchar(data[i]);
40 offset += len;
41 free(data);
42 }
43 while(remain);
44 if(offset)
45 putchar('\n');
46 return 0;
47 }