Update manpages.
Add script for generating manpages from pod.
--- /dev/null
+#!/bin/sh
+# Makes manual pages from pods
+
+POD2MAN="pod2man"
+VERSION="unknown"
+CMAKEFILE="../CMakeLists.txt"
+
+# Extract release version
+if [ -f ${CMAKEFILE} ] ; then
+ _mjver=`fgrep 'SET(RSPAMD_VERSION_MAJOR' ${CMAKEFILE} | sed -e 's/^.*RSPAMD_VERSION_MAJOR \([0-9]\).*/\1/'`
+ _miver=`fgrep 'SET(RSPAMD_VERSION_MINOR' ${CMAKEFILE} | sed -e 's/^.*RSPAMD_VERSION_MINOR \([0-9]\).*/\1/'`
+ _pver=`fgrep 'SET(RSPAMD_VERSION_PATCH' ${CMAKEFILE} | sed -e 's/^.*RSPAMD_VERSION_PATCH \([0-9]\).*/\1/'`
+ VERSION="${_mjver}.${_miver}.${_pver}"
+fi
+
+pod2man -c "Rspamd documentation" -n rspamd -s 8 -r "rspamd-${VERSION}" < rspamd.pod > rspamd.8
+pod2man -c "Rspamd documentation" -n rspamc -s 1 -r "rspamd-${VERSION}" < rspamc.pod > rspamc.1
.\" ========================================================================
.\"
.IX Title "rspamc 1"
-.TH rspamc 1 "2011-02-25" "rspamd-0.3.7_1" "Rspamd documentation"
+.TH rspamc 1 "2011-03-15" "rspamd-0.3.8" "Rspamd documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
rspamc \- a simple client for rspamd spam filtering system
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
-rspamc [\fB\-h\fR \fIhost[:port]\fR] [\fB\-p\fR]
+rspamc [\fB\-h\fR \fIhost[:port]\fR] [\fB\-p\fR] [\fB\-v\fR]
[\fB\-i\fR \fIip\fR] [\fB\-s\fR \fIstatfile\fR] [\fB\-w\fR \fIweight\fR]
-[\fB\-P\fR \fIpassword\fR] [\fB\-f\fR \fIflag\fR] [command] [file [file ...]]
+[\fB\-P\fR \fIpassword\fR] [\fB\-f\fR \fIflag\fR] [\fB\-t\fR \fItimeout\fR] [command] [file [file ...]]
.PP
rspamc [\fB\-\-help\fR]
.SH "DESCRIPTION"
.IP "\fB\-p\fR, \fB\-\-pass\-all\fR" 4
.IX Item "-p, --pass-all"
Pass all filters when checking messages. Ignored in case of learning.
+.IP "\fB\-v\fR, \fB\-\-verbose\fR" 4
+.IX Item "-v, --verbose"
+Be more verbose while displaying results. For example show descriptions of symbols.
.IP "\fB\-P\fR \fIpassword\fR, \fB\-\-password\fR \fIpassword\fR" 4
.IX Item "-P password, --password password"
Specify controller's password. Mandatory option for learning.
Weight of message for fuzzy operations.
.IP "\fB\-f\fR \fIflag\fR, \fB\-\-flag\fR \fIflag\fR" 4
.IX Item "-f flag, --flag flag"
-Weight of message for fuzzy operations.
+Flag of list for fuzzy operations.
+.IP "\fB\-t\fR \fItimeout\fR, \fB\-\-timeout\fR \fItimeout\fR" 4
+.IX Item "-t timeout, --timeout timeout"
+Timeout in seconds for all operations. Default value is 5 seconds.
.SH "RETURN VALUE"
.IX Header "RETURN VALUE"
On exit \fBrspamc\fR returns 0 if operation was successfull and error code otherwise.
.Vb 1
\& rspamc stat
.Ve
+.PP
+Get uptime:
+.PP
+.Vb 1
+\& rspamc uptime
+.Ve
.SH "AUTHOR"
.IX Header "AUTHOR"
Vsevolod Stakhov <vsevolod@highsecure.ru>
=head1 SYNOPSIS
-rspamc [B<-h> I<host[:port]>] [B<-p>]
+rspamc [B<-h> I<host[:port]>] [B<-p>] [B<-v>]
[B<-i> I<ip>] [B<-s> I<statfile>] [B<-w> I<weight>]
-[B<-P> I<password>] [B<-f> I<flag>] [command] [file [file ...]]
+[B<-P> I<password>] [B<-f> I<flag>] [B<-t> I<timeout>] [command] [file [file ...]]
rspamc [B<--help>]
Pass all filters when checking messages. Ignored in case of learning.
+=item B<-v>, B<--verbose>
+
+Be more verbose while displaying results. For example show descriptions of symbols.
+
=item B<-P> I<password>, B<--password> I<password>
Specify controller's password. Mandatory option for learning.
=item B<-f> I<flag>, B<--flag> I<flag>
-Weight of message for fuzzy operations.
+Flag of list for fuzzy operations.
+=item B<-t> I<timeout>, B<--timeout> I<timeout>
+
+Timeout in seconds for all operations. Default value is 5 seconds.
=back
rspamc stat
+Get uptime:
+
+ rspamc uptime
+
=head1 AUTHOR
Vsevolod Stakhov <vsevolod@highsecure.ru>
This program is free software; you may redistribute it and/or modify it
under the terms of BSD license.
-=cut
\ No newline at end of file
+=cut
.\" ========================================================================
.\"
.IX Title "rspamd 8"
-.TH rspamd 8 "2011-02-25" "rspamd-0.3.7_1" "Rspamd documentation"
+.TH rspamd 8 "2011-03-15" "rspamd-0.3.8" "Rspamd documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
return res;
}
+GString *
+rspamd_get_uptime (GError **err)
+{
+ struct rspamd_connection *c;
+ GString *res;
+ static const gchar outcmd[] = "uptime\r\n";
+
+ g_assert (client != NULL);
+
+ /* Connect to server */
+ c = rspamd_connect_random_server (TRUE, err);
+
+ if (c == NULL) {
+ return NULL;
+ }
+
+ res = rspamd_send_controller_command (c, outcmd, strlen (outcmd), -1, err);
+
+ return res;
+}
+
/*
* Free results
*/
*/
GString *rspamd_get_stat (GError **err);
+/*
+ * Get uptime from server
+ */
+GString *rspamd_get_uptime (GError **err);
+
/*
* Free results
*/
RSPAMC_COMMAND_LEARN,
RSPAMC_COMMAND_FUZZY_ADD,
RSPAMC_COMMAND_FUZZY_DEL,
- RSPAMC_COMMAND_STAT
+ RSPAMC_COMMAND_STAT,
+ RSPAMC_COMMAND_UPTIME
};
/*
else if (g_ascii_strcasecmp (cmd, "STAT") == 0) {
return RSPAMC_COMMAND_STAT;
}
+ else if (g_ascii_strcasecmp (cmd, "UPTIME") == 0) {
+ return RSPAMC_COMMAND_UPTIME;
+ }
return RSPAMC_COMMAND_UNKNOWN;
}
res = rspamd_get_stat (&err);
if (res == NULL) {
if (err != NULL) {
- fprintf (stderr, "cannot learn message: %s\n", err->message);
+ fprintf (stderr, "cannot stat: %s\n", err->message);
}
else {
- fprintf (stderr, "cannot learn message\n");
+ fprintf (stderr, "cannot stat\n");
+ }
+ exit (EXIT_FAILURE);
+ }
+ if (tty) {
+ printf ("\033[1m");
+ }
+ PRINT_FUNC ("Results for host: %s\n\n", connect_str);
+ if (tty) {
+ printf ("\033[0m");
+ }
+ res = g_string_append_c (res, '\0');
+ printf ("%s\n", res->str);
+}
+
+static void
+rspamd_do_uptime ()
+{
+ GError *err = NULL;
+ GString *res;
+
+ /* Add server */
+ add_rspamd_server (TRUE);
+
+ res = rspamd_get_uptime (&err);
+ if (res == NULL) {
+ if (err != NULL) {
+ fprintf (stderr, "cannot uptime: %s\n", err->message);
+ }
+ else {
+ fprintf (stderr, "cannot uptime\n");
}
exit (EXIT_FAILURE);
}
case RSPAMC_COMMAND_STAT:
rspamd_do_stat ();
break;
+ case RSPAMC_COMMAND_UPTIME:
+ rspamd_do_uptime ();
+ break;
default:
fprintf (stderr, "invalid arguments\n");
exit (EXIT_FAILURE);