--- /dev/null
+/*
+ * Copyright © 2013 Mauro Carvalho Chehab <mchehab@redhat.com>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of Red Hat
+ * not be used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission. Red
+ * Hat makes no representations about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <argp.h>
+#include <string.h>
+
+#define VERSION "0.1.0"
+#define TOOL_NAME "edactool"
+#define TOOL_DESCRIPTION "Ancillary tool to control the Error Detect And Correction - EDAC subsystem."
+#define ARGS_DOC "<options>"
+
+const char *argp_program_version = TOOL_NAME " " VERSION;
+const char *argp_program_bug_address = "Mauro Carvalho Chehab <mchehab@redhat.com>";
+
+struct arguments {
+ int device_mode;
+};
+
+static error_t parse_opt(int k, char *arg, struct argp_state *state)
+{
+ struct arguments *args = state->input;
+
+ switch (k) {
+ case 'd':
+ args->device_mode++;
+ break;
+ default:
+ return ARGP_ERR_UNKNOWN;
+ }
+ return 0;
+}
+
+int main(int argc, char *argv[])
+{
+ struct arguments args;
+ int idx = -1;
+ const struct argp_option options[] = {
+ {"device", 'd', 0, 0, "use alternative device show mode", 0},
+ { 0, 0, 0, 0, 0, 0 }
+ };
+ const struct argp argp = {
+ .options = options,
+ .parser = parse_opt,
+ .doc = TOOL_DESCRIPTION,
+ .args_doc = ARGS_DOC,
+
+ };
+ memset (&args, 0, sizeof(args));
+
+ argp_parse(&argp, argc, argv, 0, &idx, &args);
+
+ if (idx < 0) {
+ argp_help(&argp, stderr, ARGP_HELP_STD_HELP, TOOL_NAME);
+ return -1;
+ }
+
+
+ return 0;
+}