Skip to content
Snippets Groups Projects
Commit 98457919 authored by Guy Zana's avatar Guy Zana
Browse files

cli: add an ifconfig command skeleton

parent 2906b38f
No related branches found
No related tags found
No related merge requests found
...@@ -101,5 +101,6 @@ ...@@ -101,5 +101,6 @@
/console/tests.js: ../../console/tests.js /console/tests.js: ../../console/tests.js
/console/help.js: ../../console/help.js /console/help.js: ../../console/help.js
/console/run.js: ../../console/run.js /console/run.js: ../../console/run.js
/console/ifconfig.js: ../../console/ifconfig.js
/console/cli.js: ../../console/cli.js /console/cli.js: ../../console/cli.js
/&/etc/hosts: ../../static/& /&/etc/hosts: ../../static/&
...@@ -10,6 +10,7 @@ load("/console/cat.js"); ...@@ -10,6 +10,7 @@ load("/console/cat.js");
load("/console/help.js"); load("/console/help.js");
load("/console/tests.js"); load("/console/tests.js");
load("/console/run.js"); load("/console/run.js");
load("/console/ifconfig.js");
// Commands // Commands
var _commands = new Array(); var _commands = new Array();
...@@ -20,6 +21,7 @@ _commands["cat"] = cat; ...@@ -20,6 +21,7 @@ _commands["cat"] = cat;
_commands["help"] = help_cmd; _commands["help"] = help_cmd;
_commands["test"] = test_cmd; _commands["test"] = test_cmd;
_commands["run"] = run_cmd; _commands["run"] = run_cmd;
_commands["ifconfig"] = ifconfig_cmd;
// I/O // I/O
var _reader = new BufferedReader( new InputStreamReader(System['in']) ); var _reader = new BufferedReader( new InputStreamReader(System['in']) );
......
var ifconfig_cmd = {
set_ip: function(ifname, ip, netmask) {
},
invoke: function(inp) {
if (inp.length != 6) {
this.help();
return;
}
// FIXME: use real argument parsing
var ifname = inp[1];
var ip = inp[2];
var mask = inp[4];
var up_down_unused = inp[6];
set_ip(ifname, ip, mask);
},
help: function() {
print("ifconfig <ifname> <ip> netmask <mask> up")
}
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment