diff options
author | Mattias Andrée <maandree@member.fsf.org> | 2015-12-24 09:44:38 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@member.fsf.org> | 2015-12-24 09:44:38 +0100 |
commit | 85e9259035a9df477a68f722592c0f10413b6c53 (patch) | |
tree | 7e5623f325aff3bfb1060449e6f1ab8309d1c685 | |
parent | m (diff) | |
download | sat-85e9259035a9df477a68f722592c0f10413b6c53.tar.gz sat-85e9259035a9df477a68f722592c0f10413b6c53.tar.bz2 sat-85e9259035a9df477a68f722592c0f10413b6c53.tar.xz |
satd: command line
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
-rw-r--r-- | src/satd.c | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -19,12 +19,46 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +/** + * 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 */ } |