From e20e2eaa549f5c77264a071e1848dfded7a54467 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Tue, 9 Feb 2010 18:01:34 -0800 Subject: [PATCH] add -i (inode format) support to df command --- .../java/src/org/hyperic/sigar/cmd/Df.java | 80 ++++++++++++++----- 1 file changed, 58 insertions(+), 22 deletions(-) diff --git a/bindings/java/src/org/hyperic/sigar/cmd/Df.java b/bindings/java/src/org/hyperic/sigar/cmd/Df.java index 763faf2f..99d6a953 100644 --- a/bindings/java/src/org/hyperic/sigar/cmd/Df.java +++ b/bindings/java/src/org/hyperic/sigar/cmd/Df.java @@ -48,8 +48,19 @@ public class Df extends SigarCommandBase { "Mounted on", "Type" }; + //df -i + private static final String[] IHEADER = new String[] { + "Filesystem", + "Inodes", + "IUsed", + "IFree", + "IUse%", + "Mounted on", + "Type" + }; private GetlineCompleter completer; + private boolean opt_i; public Df(Shell shell) { super(shell); @@ -67,7 +78,7 @@ public class Df extends SigarCommandBase { } protected boolean validateArgs(String[] args) { - return args.length <= 1; + return true; } public String getSyntaxArgs() { @@ -79,31 +90,42 @@ public class Df extends SigarCommandBase { } public void printHeader() { - printf(HEADER); + printf(this.opt_i ? IHEADER : HEADER); } public void output(String[] args) throws SigarException { - if (args.length == 1) { + this.opt_i = false; + ArrayList sys = new ArrayList(); + + if (args.length > 0) { FileSystemMap mounts = this.proxy.getFileSystemMap(); - String name = FileCompleter.expand(args[0]); - FileSystem fs = mounts.getMountPoint(name); + for (int i=0; i