From 85e9259035a9df477a68f722592c0f10413b6c53 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 24 Dec 2015 09:44:38 +0100 Subject: satd: command line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/satd.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src') diff --git a/src/satd.c b/src/satd.c index 2d2c2f8..4534ae4 100644 --- a/src/satd.c +++ b/src/satd.c @@ -19,12 +19,46 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ +#include +#include +#include +/** + * The name of the process. + */ +char *argv0 = "satr"; + + + +/** + * Print usage information. + */ +static void +usage(void) +{ + fprintf(stderr, "usage: [-f] %s\n", + strrchr(argv0) ? (strrchr(argv0) + 1) : argv0); + exit(2); +} + + int main(int argc, char *argv[]) { + int foreground = 0; + + if (argc > 0) + argv0 = argv[0]; + if (argc > 2) + usage(); + if (argc == 2) { + if (strcmp(argv[1], "-f")) + usage(); + foreground = 1; + } + /* TODO guess what, this is going to be the daemon */ } -- cgit v1.2.3-70-g09d2