new program readcons
This commit is contained in:
parent
6e527fbc4d
commit
ea77b9ce7c
1 changed files with 39 additions and 0 deletions
39
src/cmd/readcons.c
Normal file
39
src/cmd/readcons.c
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
#include <u.h>
|
||||||
|
#include <libc.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
usage(void)
|
||||||
|
{
|
||||||
|
fprint(2, "usage: readcons [-s] [-d default] prompt\n");
|
||||||
|
exits("usage");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
char *def, *p;
|
||||||
|
int secret;
|
||||||
|
|
||||||
|
def = nil;
|
||||||
|
secret = 0;
|
||||||
|
ARGBEGIN{
|
||||||
|
case 's':
|
||||||
|
secret = 1;
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
def = EARGF(usage());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
usage();
|
||||||
|
}ARGEND
|
||||||
|
|
||||||
|
if(argc != 1)
|
||||||
|
usage();
|
||||||
|
|
||||||
|
p = readcons(argv[0], def, secret);
|
||||||
|
if(p == nil)
|
||||||
|
exits("readcons");
|
||||||
|
print("%s\n", p);
|
||||||
|
exits(0);
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue