From f59e82e003428f62101c6dabc3cbcb563ed945a2 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Fri, 23 Jul 2004 00:37:19 +0000 Subject: [PATCH] change shell rc file name from '.sigar' to '.sigar_shellrc' in addition to looking in ~/ look in . --- .../java/src/net/hyperic/sigar/cmd/Shell.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bindings/java/src/net/hyperic/sigar/cmd/Shell.java b/bindings/java/src/net/hyperic/sigar/cmd/Shell.java index 816f7489..84860c52 100644 --- a/bindings/java/src/net/hyperic/sigar/cmd/Shell.java +++ b/bindings/java/src/net/hyperic/sigar/cmd/Shell.java @@ -22,6 +22,8 @@ import net.hyperic.sigar.test.SigarTestRunner; public class Shell extends ShellBase { + public static final String RCFILE_NAME = ".sigar_shellrc"; + private Sigar sigar = new Sigar(); private SigarProxy proxy = SigarProxyCache.newInstance(this.sigar); private ProcessFinder finder = new ProcessFinder(this.proxy); @@ -123,6 +125,13 @@ public class Shell extends ShellBase { return this.foundPids; } + public void readCommandFile(File rc) { + try { + readRCFile(rc, false); + this.out.println("Loaded rc file: " + rc); + } catch (IOException e) { } + } + public static void main(String[] args) { Shell shell = new Shell(); @@ -130,9 +139,9 @@ public class Shell extends ShellBase { shell.init("sigar", System.out, System.err); shell.registerCommands(); String home = System.getProperty("user.home"); - try { - shell.readRCFile(new File(home, ".sigar"), false); - } catch (IOException e) { } + + shell.readCommandFile(new File(home, RCFILE_NAME)); + shell.readCommandFile(new File(RCFILE_NAME)); if (args.length == 0) { shell.isInteractive = true;