Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ struct intlist *whichlist;
pid_t child;

static int disable(void);
static int clear(void);
static int doverbose(int, char**);
static int doediting(int, char**);
static int doconfig(int, char**);
Expand Down Expand Up @@ -124,6 +125,7 @@ static int int_doverbose(char *, int, int, char **);
static int int_doediting(char *, int, int, char **);
static int int_manual(char *, int, int, char **);
static int int_shell(char *, int, int, char **);
static int int_clear(void);
static int int_help(void);
static int int_exit(void);
static int hostname(int, char **);
Expand Down Expand Up @@ -1694,6 +1696,7 @@ static char
rtablehelp[] = "Routing table switch",
grouphelp[] = "Modify group attributes",
arphelp[] = "Static ARP set",
clearhelp[]= "Clear the terminal screen",
#ifdef notyet
parphelp[] = "Proxy ARP set",
#endif
Expand Down Expand Up @@ -1813,6 +1816,7 @@ Command cmdtab[] = {
{ "pipex", pipexhelp, CMPL(ta) (char **)pipextab, sizeof(Menu), ipcmd, 1, 1, 1, 0 },
{ "flush", flushhelp, CMPL(ta) (char **)flushlist, sizeof(Menu), flushcmd, 1, 0, 0, 0 },
{ "enable", enablehelp, CMPL(ta) (char **)enabletab, sizeof(Menu), enable, 0, 0, 0, 0 },
{ "clear", clearhelp, CMPL0 0, 0, clear, 0, 0, 0, 0 },
{ "disable", disablehelp, CMPL0 0, 0, disable, 1, 0, 0, 0 },
{ "route", routehelp, CMPL0 0, 0, route, 1, 1, 1, 0 },
{ "pf", pfhelp, CMPL(t) (char **)ctl_pf, ssctl, ctlhandler, 1, 1, 0, 1 },
Expand Down Expand Up @@ -2659,6 +2663,14 @@ group(int argc, char **argv)
return 0;
}

//clear terminal screen
int
clear(void)
{
char *argv[] = {CLEAR, NULL, NULL };
cmdargs(CLEAR, argv);
return 0;
}
/*
* disable privileged mode
*/
Expand Down
1 change: 1 addition & 0 deletions externs.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ extern pid_t child;
#define DEFAULT_EDITOR "/usr/bin/vi"
#define NSHRC_TEMP "/var/run/nshrc"
#define NSHRC "/etc/nshrc"
#define CLEAR "/usr/bin/clear"
#define PING "/sbin/ping"
#define PING6 "/sbin/ping6"
#define TRACERT "/usr/sbin/traceroute"
Expand Down
33 changes: 19 additions & 14 deletions nsh.8
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,16 @@ is not ambiguous double <Tab> completes the command.
E.g show all available valid commands with double tab key sequence <tab><tab>
.Bd -literal -offset indent
nsh(config-p)/
! exit ipsec ping smtp
? flush ldap ping6 snmp
arp ftp-proxy ldp pipex ssh
bgp group motd quit sshd
bridge halt mpls rad telnet
configure help nameserver reboot tftp
ddb hostname ndp relay tftp-proxy
dhcp ifstate no resolv traceroute
disable ike nppp rip traceroute6
dvmrp inet ntp route verbose
editing interface ospf rtable who
eigrp ip ospf6 sasync write-config
enable ip6 pf show
! disable halt ldap ospf relay smtp verbose
? do help ldp ospf6 resolv snmp who
arp dvmrp hostname manual pf rip ssh write-config
bgp editing ifstate motd ping route sshd
bridge eigrp ike mpls ping6 rtable telnet
clear enable inet nameserver pipex sasync tftp
configure exit interface ndp powerdown saveenv tftp-proxy
crontab flush ip no quit scheduler traceroute
ddb ftp-proxy ip6 nppp rad setenv traceroute6
dhcp group ipsec ntp reboot show unsetenv
nsh(config-p)/
.Ed
If what is typed is ambiguous double tab presents the administrator
Expand Down Expand Up @@ -358,6 +355,7 @@ nsh(p)/help
pipex Set PIPEX parameters
flush Flush system tables
enable Enable privileged mode
clear Clear the terminal screen
disable Disable privileged mode
route Add a host or network route
pf Packet filter control
Expand Down Expand Up @@ -480,6 +478,13 @@ diagnostics in an unprivileged
.Nm
shell.
.Pp
.Tg clear
.Ic clear
.Pp
Wipe contents of terminal and scrollback buffer and present a
.Nm
prompt at the first line of the active terminal.
.Pp
.Tg rtable
.Tg rdomain
.Op no
Expand Down Expand Up @@ -1368,7 +1373,7 @@ daemon can be edited with
command, the configuration syntax of
.Ic snmp
daemon is documented in
.Xr snmpd.conf 5
.Xr snmpd.conf 5
.Pp
.Tg ldapd
.Tg ldap
Expand Down