@@ -1441,7 +1441,8 @@ cmd \-a \-c arg file file
cmd \-carg -a file file
cmd \-a \-carg \-\- file file
.Ed
-.It hash Fl rv Ar command ...
+.It hash Op Ar command ...
+.It hash Fl r
The shell maintains a hash table which remembers the
locations of commands.
With no arguments whatsoever,
@@ -1457,9 +1458,6 @@ With arguments, the
.Ic hash
command removes the specified commands from the hash table (unless
they are functions) and then locates them.
-With the
-.Fl v
-option, hash prints the locations of the commands as it finds them.
The
.Fl r
option causes the hash command to delete all the entries in the hash table
@@ -36,6 +36,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
+#include <stdbool.h>
#include <stdlib.h>
#ifdef HAVE_PATHS_H
#include <paths.h>
@@ -271,11 +272,16 @@ hashcmd(int argc, char **argv)
int c;
struct cmdentry entry;
char *name;
+ bool clear;
- while ((c = nextopt("r")) != '\0') {
+ clear = false;
+ while ((c = nextopt("r")) != '\0')
+ clear = true;
+ if(clear) {
clearcmdentry();
return 0;
}
+
if (*argptr == NULL) {
for (pp = cmdtable ; pp < &cmdtable[CMDTABLESIZE] ; pp++) {
for (cmdp = *pp ; cmdp ; cmdp = cmdp->next) {