aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2014-09-20 18:09:44 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2014-09-20 18:12:55 +0200
commit38a0077033ebdd51f730852256352a4663b0f034 (patch)
tree2a6a411d8ec4eec541d76dad699a581b6a75c498
parent01c2bfa5a476a5dbeb74d30c79bf8db62b6be417 (diff)
downloadponymap-38a0077033ebdd51f730852256352a4663b0f034.tar.gz
ponymap-38a0077033ebdd51f730852256352a4663b0f034.tar.xz
ponymap-38a0077033ebdd51f730852256352a4663b0f034.zip
Generate a manpage
help2man should be enough so far.
-rw-r--r--.gitignore1
-rw-r--r--Makefile5
-rw-r--r--README2
-rw-r--r--ponymap.c6
-rw-r--r--utils.c4
5 files changed, 11 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index 972f800..a59174c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
# Build files
/ponymap
+/ponymap.1
/plugins/*.so
# Qt Creator files
diff --git a/Makefile b/Makefile
index 209ba14..a07ad22 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ LDFLAGS = `pkg-config --libs libssl jansson` -lpthread -lrt -ldl -lcurses
.PHONY: all clean
.SUFFIXES:
-targets = ponymap plugins/http.so plugins/irc.so plugins/ssh.so
+targets = ponymap ponymap.1 plugins/http.so plugins/irc.so plugins/ssh.so
all: $(targets)
@@ -19,5 +19,8 @@ clean:
ponymap: ponymap.c utils.c plugin-api.h siphash.c
$(CC) ponymap.c siphash.c -o $@ $(CFLAGS) $(LDFLAGS)
+ponymap.1: ponymap
+ help2man -No $@ ./$<
+
plugins/%.so: plugins/%.c utils.c plugin-api.h
$(CC) $< -o $@ $(CFLAGS) $(LDFLAGS) -shared -fPIC
diff --git a/README b/README
index efc6d2e..aa7f917 100644
--- a/README
+++ b/README
@@ -12,7 +12,7 @@ to write your own service detection plugins.
Building and Running
--------------------
-Build dependencies: openssl, clang, pkg-config, GNU make, Jansson
+Build dependencies: openssl, clang, pkg-config, GNU make, help2man, Jansson
If you don't have Clang, you can edit the Makefile to use GCC or TCC, they work
just as good. But there's no CMake support yet, so I force it in the Makefile.
diff --git a/ponymap.c b/ponymap.c
index e4c8a98..c19a94b 100644
--- a/ponymap.c
+++ b/ponymap.c
@@ -1826,7 +1826,7 @@ parse_program_arguments (struct app_context *ctx, int argc, char **argv)
g_debug_mode = true;
break;
case 'h':
- opt_handler_usage (&oh);
+ opt_handler_usage (&oh, stdout);
exit (EXIT_SUCCESS);
case 'V':
printf (PROGRAM_NAME " " PROGRAM_VERSION "\n");
@@ -1864,7 +1864,7 @@ parse_program_arguments (struct app_context *ctx, int argc, char **argv)
exit (EXIT_SUCCESS);
default:
print_error ("wrong options");
- opt_handler_usage (&oh);
+ opt_handler_usage (&oh, stderr);
exit (EXIT_FAILURE);
}
@@ -1873,7 +1873,7 @@ parse_program_arguments (struct app_context *ctx, int argc, char **argv)
if (!argc)
{
- opt_handler_usage (&oh);
+ opt_handler_usage (&oh, stderr);
exit (EXIT_FAILURE);
}
diff --git a/utils.c b/utils.c
index 1555715..f84001a 100644
--- a/utils.c
+++ b/utils.c
@@ -1962,7 +1962,7 @@ opt_handler_init (struct opt_handler *self, int argc, char **argv,
}
static void
-opt_handler_usage (struct opt_handler *self)
+opt_handler_usage (struct opt_handler *self, FILE *stream)
{
struct str usage;
str_init (&usage);
@@ -2000,7 +2000,7 @@ opt_handler_usage (struct opt_handler *self)
str_free (&row);
}
- fputs (usage.str, stderr);
+ fputs (usage.str, stream);
str_free (&usage);
}