Welcome to little lamb

Code » ssp » commit 8ff1ef0

First commit

author Olivier Brunel
2023-04-09 14:05:57 UTC
committer Olivier Brunel
2023-04-09 14:05:57 UTC
parent bf29f5b9201c3958c8e99ec3f4e123ff4406e1d6

First commit

.gitignore +2 -0
meta/deps/limb/configure +1 -0
meta/deps/limb/files +0 -0
meta/deps/limb/git +1 -0
meta/deps/limb/incdir +1 -0
meta/deps/limb/version +1 -0
meta/deps/skalibs/after/limb +0 -0
meta/deps/skalibs/configure +1 -0
meta/deps/skalibs/get_version +2 -0
meta/deps/skalibs/git +1 -0
meta/deps/skalibs/incdir +1 -0
meta/deps/skalibs/include +0 -0
meta/deps/skalibs/libdir +1 -0
meta/deps/skalibs/library +1 -0
meta/deps/skalibs/version +1 -0
project.mk +1 -7
src/doc/ssp.1.md +44 -0
src/ssp/+limb +0 -0
src/ssp/+skalibs +0 -0
src/ssp/ssp.c +76 -0

diff --git a/.gitignore b/.gitignore
index 37a172c..07124e2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,5 @@
 /config.mk
 /src/include/config.h
 /build
+/limb
+/ssp
diff --git a/meta/deps/limb/configure b/meta/deps/limb/configure
new file mode 100644
index 0000000..4928a4a
--- /dev/null
+++ b/meta/deps/limb/configure
@@ -0,0 +1 @@
+--no-shared
diff --git a/meta/deps/limb/files b/meta/deps/limb/files
new file mode 100644
index 0000000..e69de29
diff --git a/meta/deps/limb/git b/meta/deps/limb/git
new file mode 100644
index 0000000..109fd23
--- /dev/null
+++ b/meta/deps/limb/git
@@ -0,0 +1 @@
+git://lila.oss/limb.git
diff --git a/meta/deps/limb/incdir b/meta/deps/limb/incdir
new file mode 100644
index 0000000..30b990f
--- /dev/null
+++ b/meta/deps/limb/incdir
@@ -0,0 +1 @@
+src/liblimb/include
diff --git a/meta/deps/limb/version b/meta/deps/limb/version
new file mode 100644
index 0000000..8acdd82
--- /dev/null
+++ b/meta/deps/limb/version
@@ -0,0 +1 @@
+0.0.1
diff --git a/meta/deps/skalibs/after/limb b/meta/deps/skalibs/after/limb
new file mode 100644
index 0000000..e69de29
diff --git a/meta/deps/skalibs/configure b/meta/deps/skalibs/configure
new file mode 100644
index 0000000..5d55893
--- /dev/null
+++ b/meta/deps/skalibs/configure
@@ -0,0 +1 @@
+--disable-shared
diff --git a/meta/deps/skalibs/get_version b/meta/deps/skalibs/get_version
new file mode 100755
index 0000000..55041f5
--- /dev/null
+++ b/meta/deps/skalibs/get_version
@@ -0,0 +1,2 @@
+#!/bin/sh
+grep SKALIBS_VERSION "$@/skalibs/config.h" | cut -d\" -f2
diff --git a/meta/deps/skalibs/git b/meta/deps/skalibs/git
new file mode 100644
index 0000000..5965139
--- /dev/null
+++ b/meta/deps/skalibs/git
@@ -0,0 +1 @@
+git://lila.oss/skalibs.git
diff --git a/meta/deps/skalibs/incdir b/meta/deps/skalibs/incdir
new file mode 100644
index 0000000..e4484e2
--- /dev/null
+++ b/meta/deps/skalibs/incdir
@@ -0,0 +1 @@
+src/include
diff --git a/meta/deps/skalibs/include b/meta/deps/skalibs/include
new file mode 100644
index 0000000..e69de29
diff --git a/meta/deps/skalibs/libdir b/meta/deps/skalibs/libdir
new file mode 100644
index 0000000..5baacc7
--- /dev/null
+++ b/meta/deps/skalibs/libdir
@@ -0,0 +1 @@
+skalibs
diff --git a/meta/deps/skalibs/library b/meta/deps/skalibs/library
new file mode 100644
index 0000000..39971a0
--- /dev/null
+++ b/meta/deps/skalibs/library
@@ -0,0 +1 @@
+skarnet
diff --git a/meta/deps/skalibs/version b/meta/deps/skalibs/version
new file mode 100644
index 0000000..48c7359
--- /dev/null
+++ b/meta/deps/skalibs/version
@@ -0,0 +1 @@
+2.13.0.0
diff --git a/project.mk b/project.mk
index 0d8c07b..00746c1 100644
--- a/project.mk
+++ b/project.mk
@@ -1,7 +1 @@
-$(error You need to edit project.mk)
-
-# binaries
-BINS = 
-
-# librairies
-LIBS = 
+BINS = ssp
diff --git a/src/doc/ssp.1.md b/src/doc/ssp.1.md
new file mode 100644
index 0000000..9eab108
--- /dev/null
+++ b/src/doc/ssp.1.md
@@ -0,0 +1,44 @@
+% ssp
+% ssp(1)
+
+# NAME
+
+ssp - 
+
+# SYNOPSIS
+
+*ssp* [*-q*] [*-v*] [*--debug* [[@[`level`]:]+`FD`|`FILE`]] [*-O* [@[`level`]:]+`FD`|`FILE`]
+
+# OPTIONS
+
+: *--debug* [[@[`level`]:]+`FD`|`FILE`]
+<inc autoopt_debug.md>
+<inc autoopt_logdbg_level.md>
+
+<inc opt_help.md>
+
+: *-O*, *--log-file* [@[`level`]:]+`FD`|`FILE`
+<inc autoopt_log.md>
+<inc autoopt_logdbg_level.md>
+
+: *-q*, *--quiet*
+<inc autoopt_quiet.md>
+
+: *-v*, *--verbose*
+<inc autoopt_verbose.md>
+
+<inc opt_version.md>
+
+# DESCRIPTION
+
+*ssp* is...
+
+<inc bugs.md>
+
+# REPOSITORY
+
+You can find the latest about *ssp* from its official site at https://lila.oss/ssp
+Latest source code can be browsed online at https://lila.oss/code/ssp; or you can close
+its [git](1) repo from git://lila.oss/ssp.git
+
+<inc author.md>
diff --git a/src/ssp/+limb b/src/ssp/+limb
new file mode 100644
index 0000000..e69de29
diff --git a/src/ssp/+skalibs b/src/ssp/+skalibs
new file mode 100644
index 0000000..e69de29
diff --git a/src/ssp/ssp.c b/src/ssp/ssp.c
new file mode 100644
index 0000000..39be0dd
--- /dev/null
+++ b/src/ssp/ssp.c
@@ -0,0 +1,76 @@
+/* This file is part of ssp                             https://lila.oss/ssp
+ * Copyright (C) 2023 Olivier Brunel                          jjk@jjacky.com */
+/* SPDX-License-Identifier: GPL-2.0-only */
+#include <limb/autoopt.h>
+#include <limb/exitcode.h>
+#include <limb/loadopt.h>
+#include <limb/output.h>
+#include "config.h"
+
+const char *PROG = "ssp";
+
+enum {
+    OPTID_DEBUG = OPTID_FIRST,
+    OPTID_VERSION,
+};
+
+static void
+parse_cmdline(int argc, const char *argv[], const char *file, const char *section)
+{
+    const char usage[] = "[-h] [OPTION..]";
+    const struct option options[] = {
+        OPTION_ARG_OPT(  0 , "debug",                   0, OPTID_DEBUG),
+        OPTION_ARG_NONE('h', "help",                    OPT_SKIP, OPTID_SHORTOPT),
+        OPTION_ARG_REQ( 'O', "log-file",                0, OPTID_SHORTOPT),
+        OPTION_ARG_NONE('q', "quiet",                   0, OPTID_SHORTOPT),
+        OPTION_ARG_NONE('v', "verbose",                 0, OPTID_SHORTOPT),
+        OPTION_ARG_NONE( 0 , "version",                 0, OPTID_VERSION),
+        LOADOPT_DONE
+    };
+    struct loadopt lo = { 0 };
+
+    int c;
+    while ((c = loadopt(argc, argv, options, file, section, 0, &lo))) switch (c) {
+        case OPTID_DEBUG:
+            if (!autoopt_debug(&options[lo.idx], lo.arg))
+                dieusage(EX_USAGE, usage);
+            break;
+        case 'h':
+            diehelp(0, usage,
+"     --debug [[@[level]:]+FD|FILE]     Enable debug output (to FD|FILE)\n"
+" -O, --output [@[level]:]+FD|FILE      Set output log to FD|FILE\n"
+"\n"
+" -q, --quiet                           Enable quiet mode\n"
+" -v, --verbose                         Enable verbose mode\n"
+"\n"
+" -h, --help                            Show this help screen and exit\n"
+"     --version                         Show version information and exit\n"
+);
+        case 'O':
+            if (!autoopt_log(&options[lo.idx], lo.arg))
+                dieusage(EX_USAGE, usage);
+            break;
+        case 'q':
+            autoopt_quiet(&options[lo.idx], lo.arg);
+            break;
+        case 'v':
+            autoopt_verbose(&options[lo.idx], lo.arg);
+            break;
+        case OPTID_VERSION:
+            dieversion(SSP_VERSION, "2023", SSP_CURYEAR, SSP_AUTHOR, SSP_URL, NULL);
+        case -1:
+            dieusage(EX_USAGE, usage);
+        default:
+            die(EX_SOFTWARE, "unexpected return value ", PUTMSG_INT(c), " from loadopt");
+    };
+}
+
+int
+main(int argc, const char *argv[])
+{
+    const char config[] = "/etc/ssp.conf";
+    parse_cmdline(argc, argv, config, NULL);
+
+    out("done.");
+    return 0;
+}