summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/Makefile.am9
-rw-r--r--src/util/libgsmd-tool.c64
2 files changed, 73 insertions, 0 deletions
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
new file mode 100644
index 0000000..bb257f5
--- /dev/null
+++ b/src/util/Makefile.am
@@ -0,0 +1,9 @@
+INCLUDES = $(all_includes) -I$(top_srcdir)/include
+AM_CFLAGS = -std=gnu99
+
+bin_PROGRAMS = libgsmd-tool
+
+libgsmd_tool_SOURCES = libgsmd-tool.c
+libgsmd_tool_LDADD = ../libgsmd/libgsmd.la
+libgsmd_tool_LDFLAGS = -dynamic
+
diff --git a/src/util/libgsmd-tool.c b/src/util/libgsmd-tool.c
new file mode 100644
index 0000000..a3da490
--- /dev/null
+++ b/src/util/libgsmd-tool.c
@@ -0,0 +1,64 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#define _GNU_SOURCE
+#include <getopt.h>
+
+#include <libgsmd/libgsmd.h>
+
+static struct lgsm_handle *lgsmh;
+static int verbose = 0;
+
+static struct option opts[] = {
+ { "help", 0, 0, 'h' },
+ { "version", 0, 0, 'V' },
+ { "verbose", 0, 0, 'v' },
+ { 0, 0, 0, 0 }
+};
+
+static void help(void)
+{
+ printf("Usage:\n"
+ "\t-h\t--help\tPrint this Help message\n"
+ "\t-V\t--version\tPrint version number\n"
+ "\t-v\t--verbose\tBe more verbose\n");
+}
+
+int main(int argc, char **argv)
+{
+ int rc, i;
+
+ printf("libgsm-tool - (C) 2006 by Harald Welte\n"
+ "This program is Free Software and has ABSOLUTELY NO WARRANTY\n\n");
+
+ while (1) {
+ int c, option_index = 0;
+ c = getopt_long(argc, argv, "hVv", opts, &option_index);
+ if (c == -1)
+ break;
+
+ switch (c) {
+ case 'v':
+ verbose = 1;
+ break;
+ case 'V':
+ /* FIXME */
+ break;
+ case 'h':
+ help();
+ exit(0);
+ break;
+ }
+ }
+
+ lgsmh = lgsm_init(LGSMD_DEVICE_GSMD);
+ if (!lgsmh) {
+ fprintf(stderr, "Can't connect to gsmd\n");
+ exit(1);
+ }
+
+
+ exit(0);
+}
personal git repositories of Harald Welte. Your mileage may vary