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