Skip to contentSkip to conversation

doc: nft: describe -I override behaviour when path starts by ./ and /

PATCH New Pablo Neira Ayuso 1 participant 2 messages Jun 7, 2017 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/2 doc: nft: describe -I override behaviour when path starts by ./ and /

You can override -I by starting your path either using ./ for relative paths and / for absolute paths.

---
 doc/nft.xml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
doc/nft.xml +4 -1
index 9364133f1787..f93baa03d721 100644
@@ -207,7 +207,10 @@ vi:ts=4 sw=4
 			<para>
 				Other files can be included by using the <command>include</command> statement.
 				The directories to be searched for include files can be specified using
-				the <option>-I/--includepath</option> option.
+				the <option>-I/--includepath</option> option. You can override this behaviour
+				either by prepending ./ to your path to force inclusion of files located in the
+				current working directory (ie. relative path) or / for file location expressed
+				as an absolute path.
 			</para>
 			<para>
 				If the <literal>filename</literal> parameter is a directory, then all files in
Signature · 1 line
2.1.4
author maintainer
#1 lore raw

PATCH 2/2 src: display default directory for file inclusion in -h/--help

If no explicit relative or absolute path is enforced by the user, nft relies on either -I/--includepath or the default include directory that is set at compile time.

Given most of our users will rely on packaged versions of nft, provide a way to display the location of this default includepath directory.

---
 doc/nft.xml | 5 +++++
 src/main.c  | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)
doc/nft.xml +5 -0
index f93baa03d721..faf0ffde9e19 100644
@@ -213,6 +213,11 @@ vi:ts=4 sw=4
 				as an absolute path.
 			</para>
 			<para>
+				If -I/--includepath is not specified, then nft relies on the default directory
+				that is specified at compile time. You can retrieve this default directory via
+				-h/--help option.
+			</para>
+			<para>
 				If the <literal>filename</literal> parameter is a directory, then all files in
 				the directory are loaded in alphabetical order.
 			</para>
src/main.c +2 -2
index 6dae817af40b..5089ff2448f3 100644
@@ -125,12 +125,12 @@ static void show_help(const char *name)
 "  -s, --stateless		Omit stateful information of ruleset.\n"
 "  -N				Translate IP addresses to names.\n"
 "  -a, --handle			Output rule handle.\n"
-"  -I, --includepath <directory>	Add <directory> to the paths searched for include files.\n"
+"  -I, --includepath <directory>	Add <directory> to the paths searched for include files. Default is: %s\n"
 #ifdef DEBUG
 "  --debug <level [,level...]>	Specify debugging level (scanner, parser, eval, netlink, mnl, proto-ctx, segtree, all)\n"
 #endif
 "\n",
-	name);
+	name, DEFAULT_INCLUDE_PATH);
 }
 
 #ifdef DEBUG
Signature · 1 line
2.1.4