fookb-perso/opts.c

64 lines
1.3 KiB
C

/*
* File: opts.c
*
* (c) 1998-2004 Alexey Vyskubov <alexey@mawhrin.net>
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <X11/Xlib.h> /* X Window standard header */
#include <X11/Xresource.h> /* X resource manager stuff */
#include "fookb.h"
#include "opts.h"
static int tblentr = 6; /* There are 6 recognized
options */
static XrmOptionDescRec tbl[] = {
{"-bg", ".bg",
XrmoptionSepArg,
(XPointer) NULL},
{"-display", ".display",
XrmoptionSepArg,
(XPointer) NULL}
};
void ParseOptions(int *argc, register char *argv[])
{
XrmValue value;
char *str_type[20];
mydispname[0] = '\0';
XrmParseCommand(&cmdlineDB, tbl, tblentr, "fookb", argc, argv);
#ifdef DEBUG
puts("Hereiam");
#endif
if (1 != *argc) {
puts("Fookb v 3.1 - CUSTOM CASTA");
puts("\tUsage: fookb [options]");
puts("Possible options:");
puts("-bg color\tHTML color bg code");
puts("-display X_display\tX display to use (normally not needed)");
puts("");
puts("Command line paramaters takes precedence over X resources!");
exit(0);
}
/* We should get display now -- we need it for access to other
databases */
if (XrmGetResource(cmdlineDB, "fookb.display", "Fookb.Display",
str_type, &value) == True) {
(void) strncpy(mydispname, value.addr, (size_t)value.size);
#ifdef DEBUG
puts(mydispname);
#endif
}
}