|
From: <cr...@us...> - 2008-05-11 13:52:45
|
Revision: 4084
http://jnode.svn.sourceforge.net/jnode/?rev=4084&view=rev
Author: crawley
Date: 2008-05-11 06:52:42 -0700 (Sun, 11 May 2008)
Log Message:
-----------
Converted NetstatCommand
Modified Paths:
--------------
trunk/net/descriptors/org.jnode.net.command.xml
trunk/net/src/net/org/jnode/net/command/NetstatCommand.java
Modified: trunk/net/descriptors/org.jnode.net.command.xml
===================================================================
--- trunk/net/descriptors/org.jnode.net.command.xml 2008-05-11 09:16:47 UTC (rev 4083)
+++ trunk/net/descriptors/org.jnode.net.command.xml 2008-05-11 13:52:42 UTC (rev 4084)
@@ -60,6 +60,9 @@
<optional><argument argLabel="subnetMask"/></optional>
</sequence>
</syntax>
+ <syntax alias="netstat">
+ <empty description="Print statistics for all network devices"/>
+ </syntax>
<syntax alias="tcpinout">
<argument argLabel="localPort" description="Run tcpinout in server mode"/>
<sequence description="Run tcpinout in client mode">
Modified: trunk/net/src/net/org/jnode/net/command/NetstatCommand.java
===================================================================
--- trunk/net/src/net/org/jnode/net/command/NetstatCommand.java 2008-05-11 09:16:47 UTC (rev 4083)
+++ trunk/net/src/net/org/jnode/net/command/NetstatCommand.java 2008-05-11 13:52:42 UTC (rev 4084)
@@ -31,7 +31,6 @@
import org.jnode.net.util.NetUtils;
import org.jnode.shell.AbstractCommand;
import org.jnode.shell.CommandLine;
-import org.jnode.shell.help.Help;
import org.jnode.util.Statistic;
import org.jnode.util.Statistics;
@@ -40,30 +39,19 @@
*/
public class NetstatCommand extends AbstractCommand {
- public static Help.Info HELP_INFO = new Help.Info(
- "netstat",
- "Print the statistics of all network devices"
- );
+ public NetstatCommand() {
+ super("Print statistics for all network devices");
+ }
- public static void main(String[] args)
- throws Exception {
+ public static void main(String[] args) throws Exception {
new NetstatCommand().execute(args);
}
/**
* Execute this command
*/
- public void execute(
- CommandLine cmdLine,
- InputStream in,
- PrintStream out,
- PrintStream err)
+ public void execute(CommandLine cmdLine, InputStream in, PrintStream out, PrintStream err)
throws Exception {
- showStats(out);
- }
-
- private void showStats(PrintStream out)
- throws NetworkException {
final NetworkLayerManager nlm = NetUtils.getNLM();
for (NetworkLayer nl : nlm.getNetworkLayers()) {
@@ -82,7 +70,6 @@
final String prefix2 = prefix + prefix;
out.print(prefix2);
showStats(out, tl.getStatistics(), maxWidth - prefix2.length(), prefix2);
- //out.println();
}
out.println();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|