/* $Id: main.c,v 1.2 2010/07/25 16:15:23 khorben Exp $ */ /* Copyright (c) 2010 Pierre Pronchery */ /* This file is part of DeforaOS Desktop Keyboard */ /* This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include #include "keyboard.h" /* private */ /* functions */ /* usage */ static int _usage(void) { fputs("Usage: keyboard [-m monitor]\n", stderr); return 1; } /* public */ /* functions */ /* main */ int main(int argc, char * argv[]) { int o; Keyboard * keyboard; KeyboardPrefs prefs; char * p; memset(&prefs, 0, sizeof(prefs)); gtk_init(&argc, &argv); while((o = getopt(argc, argv, "m:")) != -1) switch(o) { case 'm': prefs.monitor = strtol(optarg, &p, 10); if(optarg[0] == '\0' || *p != '\0') return _usage(); break; default: return _usage(); } if(optind != argc) return _usage(); keyboard = keyboard_new(&prefs); gtk_main(); keyboard_delete(keyboard); return 0; }