moved manpage stuff into doc subdir to less confuse users, fixed some warnings on intrepid ubuntu, fixed some non documented return codes

This commit is contained in:
Axel Kittenberger 2008-12-13 22:14:58 +00:00
parent 040ca04cb6
commit bb9956cc7a
4 changed files with 38 additions and 22 deletions

View File

@ -11,11 +11,11 @@ TESTS = tests/help.sh \
datarootdir = @datarootdir@
EXTRA_DIST = config.h.in inotify-nosys.h \
manpage.lsyncd.xml manpage.lsyncd.conf.xml lsyncd.conf.xml \
lsyncd.1 lsyncd.conf.xml.5
EXTRA_DIST = config.h.in inotify-nosys.h lsyncd.conf.xml \
doc/manpage.lsyncd.xml doc/manpage.lsyncd.conf.xml \
doc/lsyncd.1 doc/lsyncd.conf.xml.5
nodist_man1_MANS = lsyncd.1 lsyncd.conf.xml.5
nodist_man1_MANS = doc/lsyncd.1 doc/lsyncd.conf.xml.5
check-syntax:
$(CC) -c -O2 -Wall $(CHK_SOURCES) -o/dev/null
@ -26,11 +26,11 @@ XP = xsltproc -''-nonet \
-''-param make.year.ranges "1" \
-''-param make.single.year.ranges "1"
lsyncd.1: manpage.lsyncd.xml
$(XP) $(DB2MAN) $<
doc/lsyncd.1: doc/manpage.lsyncd.xml
$(XP) -o $@ $(DB2MAN) $<
lsyncd.conf.xml.5: manpage.lsyncd.conf.xml
$(XP) $(DB2MAN) $<
doc/lsyncd.conf.xml.5: doc/manpage.lsyncd.conf.xml
$(XP) -o $@ $(DB2MAN) $<
AM_CFLAGS=-Wall
AM_LDFLAGS=

View File

@ -62,7 +62,7 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/
<author>
<firstname>Axel</firstname>
<surname>Kittenberger</surname>
<contrib>Strives to keep this uptodate.</contrib>
<contrib>Strives to keep this up to date.</contrib>
<address>
<email>axel.kittenberger@univie.ac.at</email>
</address>
@ -301,6 +301,11 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/
<seg><errorcode>6</errorcode></seg>
<seg>Something wrong with the config file.</seg>
</seglistitem>
<seglistitem>
<seg><errorcode>7</errorcode></seg>
<seg>Kernel cannot do inotify.</seg>
</seglistitem>
<seglistitem>
<seg><errorcode>255</errorcode></seg>

View File

@ -68,7 +68,10 @@ enum lsyncd_exit_code
/* something wrong with the config file */
LSYNCD_BADCONFIGFILE = 6,
/* Internal exit code to denote that execv failed */
/* cannot open inotify instance */
LSYNCD_NOINOTIFY = 7,
/* something internal went really wrong */
LSYNCD_INTERNALFAIL = 255,
};
@ -697,8 +700,12 @@ bool action(struct dir_conf * dir_conf,
if (pid == 0) {
char * binary = dir_conf->binary ? dir_conf->binary : default_binary;
if (!flag_nodaemon) {
freopen(logfile, "a", stdout);
freopen(logfile, "a", stderr);
if (!freopen(logfile, "a", stdout)) {
printlogf(LOG_ERROR, "cannot redirect stdout to [%s].", logfile);
}
if (!freopen(logfile, "a", stderr)) {
printlogf(LOG_ERROR, "cannot redirect stderr to [%s].", logfile);
}
}
execv(binary, argv); // in a sane world does not return!
@ -1505,8 +1512,11 @@ bool parse_config(bool fullparse) {
/**
* Parses the command line options.
*
* exits() in some cases of badparameters, or on
* --version or --help
*/
bool parse_options(int argc, char **argv)
void parse_options(int argc, char **argv)
{
char **target;
@ -1546,7 +1556,7 @@ bool parse_options(int argc, char **argv)
break;
}
if (c == '?') {
return false;
exit(LSYNCD_BADPARAMETERS);
}
if (c == 0) { // longoption
if (!strcmp("conf", long_options[oi].name)) {
@ -1584,7 +1594,7 @@ bool parse_options(int argc, char **argv)
}
if (c == '?') {
return false;
exit(LSYNCD_BADPARAMETERS);
}
if (c == 0) { // longoption
@ -1656,7 +1666,6 @@ bool parse_options(int argc, char **argv)
if (pidfile) {
check_absolute_path(pidfile);
}
return true;
}
/**
@ -1748,27 +1757,28 @@ int main(int argc, char **argv)
{
int i;
if (!parse_options(argc, argv)) {
return -1;
}
parse_options(argc, argv);
if (default_exclude_file) {
parse_exclude_file(default_exclude_file);
}
inotf = inotify_init();
if (inotf == -1) {
printlogf(LOG_ERROR, "Cannot create inotify instance! (%d:%s)",
errno, strerror(errno));
return -1;
return LSYNCD_NOINOTIFY;
}
if (!flag_nodaemon) {
// this will make this process child of init
// close stdin/stdout/stderr and
// chdir to /
daemon(0, 0);
if (daemon(0, 0)) {
printlogf(LOG_ERROR, "Cannot daemonize! (%d:%s)",
errno, strerror(errno));
return LSYNCD_INTERNALFAIL;
}
}
printlogf(LOG_NORMAL, "Starting up");
@ -1814,6 +1824,7 @@ int main(int argc, char **argv)
dir_watch_num);
signal(SIGTERM, catch_alarm);
master_loop();
return 0;