From 0907c31db34713f0e74b90f725fabb5c91c5f45f Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Wed, 23 May 2012 23:27:42 +0200 Subject: Allow saving to/restoring from a file without shell redirection Mathieu Bridon suggested that in some environments where there is no access to a full shell with input/output redirection, it'd be useful to read from/write to directly a file (bugzilla #788). The patch adds the new "-file" option to specify a filename to print into when listing/saving sets or read from when restoring sets. --- lib/session.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/session.c') diff --git a/lib/session.c b/lib/session.c index 6700ea1..3803bfa 100644 --- a/lib/session.c +++ b/lib/session.c @@ -1940,6 +1940,19 @@ cleanup: return ret; } +/** + * ipset_session_outfn - set session output printing function + * + * Set the session printing function. + * + */ +int +ipset_session_outfn(struct ipset_session *session, ipset_outfn outfn) +{ + session->outfn = outfn ? outfn : printf; + return 0; +} + /** * ipset_session_init - initialize an ipset session * -- cgit v1.2.3