Autogenerate man page for mnexec.

This commit is contained in:
Bob Lantz
2012-07-06 23:18:24 -07:00
parent 89a6dea7f9
commit d85a58feeb
3 changed files with 36 additions and 18 deletions
+12 -6
View File
@@ -5,7 +5,7 @@ MN = bin/mn
BIN = $(MN)
PYSRC = $(MININET) $(TEST) $(EXAMPLES) $(BIN)
MNEXEC = mnexec
MANPAGE = mn.1
MANPAGES = mn.1 mnexec.1
P8IGN = E251,E201,E302,E202
BINDIR = /usr/bin
MANDIR = /usr/share/man/man1
@@ -13,7 +13,7 @@ MANDIR = /usr/share/man/man1
all: codecheck test
clean:
rm -rf build dist *.egg-info *.pyc $(MNEXEC) $(MANPAGE)
rm -rf build dist *.egg-info *.pyc $(MNEXEC) $(MANPAGES)
codecheck: $(PYSRC)
-echo "Running code check"
@@ -41,12 +41,18 @@ develop: $(MNEXEC) $(MANPAGE)
install $(MANPAGE) $(MANDIR)
python setup.py develop
man: $(MANPAGE)
man: $(MANPAGES)
$(MANPAGE): $(MN)
mn.1: $(MN)
PYTHONPATH=. help2man -N -n "create a Mininet network." \
--no-discard-stderr $(MN) \
-o $@
--no-discard-stderr $< -o $@
mnexec: mnexec.c $(MN) mininet/net.py
cc -DVERSION=\"`$(MN) --version`\" $< -o $@
mnexec.1: mnexec
help2man -N -n "execution utility for Mininet." \
-h "-h" -v "-v" --no-discard-stderr ./$< -o $@
doc: man
doxygen doxygen.cfg
+1 -1
View File
@@ -89,7 +89,7 @@ def addDictOption( opts, choicesDict, default, name, helpStr=None ):
def version( *_args ):
"Print Mininet version and exit"
print "mn (Mininet %s)" % VERSION
print "%s" % VERSION
exit()
class MininetRunner( object ):
+23 -11
View File
@@ -23,17 +23,23 @@
#include <limits.h>
#include <sched.h>
#if !defined(VERSION)
#define VERSION "(devel)"
#endif
void usage(char *name)
{
printf("Execution utility for Mininet.\n"
"usage: %s [-cdnp] [-a pid] [-g group] [-r rtprio] cmd args...\n"
"-c: close all file descriptors except stdin/out/error\n"
"-d: detach from tty by calling setsid()\n"
"-n: run in new network namespace\n"
"-p: print ^A + pid\n"
"-a pid: attach to pid's network namespace\n"
"-g group: add to cgroup\n"
"-r rtprio: run with SCHED_RR (usually requires -g)\n",
printf("Execution utility for Mininet\n\n"
"Usage: %s [-cdnp] [-a pid] [-g group] [-r rtprio] cmd args...\n\n"
"Options:\n"
" -c: close all file descriptors except stdin/out/error\n"
" -d: detach from tty by calling setsid()\n"
" -n: run in new network namespace\n"
" -p: print ^A + pid\n"
" -a pid: attach to pid's network namespace\n"
" -g group: add to cgroup\n"
" -r rtprio: run with SCHED_RR (usually requires -g)\n"
" -v: print version\n",
name);
}
@@ -92,7 +98,7 @@ int main(int argc, char *argv[])
int nsid;
int pid;
static struct sched_param sp;
while ((c = getopt(argc, argv, "+cdnpa:g:r:")) != -1)
while ((c = getopt(argc, argv, "+cdnpa:g:r:vh")) != -1)
switch(c) {
case 'c':
/* close file descriptors except stdin/out/error */
@@ -152,9 +158,15 @@ int main(int argc, char *argv[])
return 1;
}
break;
case 'v':
printf("%s\n", VERSION);
exit(0);
case 'h':
usage(argv[0]);
exit(0);
default:
usage(argv[0]);
break;
exit(1);
}
if (optind < argc) {