mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-15 11:20:03 +00:00
39 lines
475 B
C
39 lines
475 B
C
#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);
|
|
}
|
|
|