From 799e10f3619ea7949a4f606b2f29b662daf31e3c Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Fri, 22 Nov 2013 02:12:34 +0000 Subject: df: add --output=file to directly output specified arguments * src/df.c (usage): Document the new 'file' --output field. (get_dev): Add a new parameter to pass the specified argument from the command line through. Use '-' if a command line parameter is not being used. * doc/coreutils.texi (df invocation): Describe the new 'file' field. * tests/df/df-output.sh: Adjust all fields test, and add a specific test for --output=file. * NEWS: Mention the new feature. --- tests/df/df-output.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/df/df-output.sh b/tests/df/df-output.sh index a10f2706b..83cdc93ee 100755 --- a/tests/df/df-output.sh +++ b/tests/df/df-output.sh @@ -67,11 +67,11 @@ compare exp out || fail=1 # that --o (without argument) is identical to the full list. cat <<\EOF > exp || framework_failure_ -Filesystem Type Inodes IUsed IFree IUse% Size Used Avail Use% Mounted on +Filesystem Type Inodes IUsed IFree IUse% Size Used Avail Use% File Mounted on EOF df -h --o=source,fstype,itotal,iused,iavail,ipcent \ - --o=size,used,avail,pcent,target '.' >out || fail=1 + --o=size,used,avail,pcent,file,target '.' >out || fail=1 sed -e '1 { s/ [ ]*/ /g q @@ -127,4 +127,14 @@ compare exp out2 || fail=1 df --help > out || fail=1 grep ' --output' out >/dev/null || { fail=1; cat out; } +# Ensure that the FILE field contains the argument. +cat <<\EOF > exp || framework_failure_ +. +exp +EOF + +df --output=file '.' exp >out || fail=1 +sed '1d' out > out2 +compare exp out2 || fail=1 + Exit $fail -- cgit v1.2.3-54-g00ecf