change shell rc file name from '.sigar' to '.sigar_shellrc'

in addition to looking in ~/ look in .
This commit is contained in:
Doug MacEachern 2004-07-23 00:37:19 +00:00
parent 2a4cd1a688
commit f59e82e003
1 changed files with 12 additions and 3 deletions

View File

@ -22,6 +22,8 @@ import net.hyperic.sigar.test.SigarTestRunner;
public class Shell extends ShellBase { public class Shell extends ShellBase {
public static final String RCFILE_NAME = ".sigar_shellrc";
private Sigar sigar = new Sigar(); private Sigar sigar = new Sigar();
private SigarProxy proxy = SigarProxyCache.newInstance(this.sigar); private SigarProxy proxy = SigarProxyCache.newInstance(this.sigar);
private ProcessFinder finder = new ProcessFinder(this.proxy); private ProcessFinder finder = new ProcessFinder(this.proxy);
@ -123,6 +125,13 @@ public class Shell extends ShellBase {
return this.foundPids; 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) { public static void main(String[] args) {
Shell shell = new Shell(); Shell shell = new Shell();
@ -130,9 +139,9 @@ public class Shell extends ShellBase {
shell.init("sigar", System.out, System.err); shell.init("sigar", System.out, System.err);
shell.registerCommands(); shell.registerCommands();
String home = System.getProperty("user.home"); String home = System.getProperty("user.home");
try {
shell.readRCFile(new File(home, ".sigar"), false); shell.readCommandFile(new File(home, RCFILE_NAME));
} catch (IOException e) { } shell.readCommandFile(new File(RCFILE_NAME));
if (args.length == 0) { if (args.length == 0) {
shell.isInteractive = true; shell.isInteractive = true;