chiark / gitweb /
Add getpass to the fun
authorMark Wooding <mdw@distorted.org.uk>
Tue, 1 Apr 2008 17:57:09 +0000 (18:57 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 1 Apr 2008 17:57:09 +0000 (18:57 +0100)
Makefile.am
debian/control
debian/inst
getpass.1 [new file with mode: 0644]
getpass.c [new file with mode: 0755]

index acb078815331e8165b831ed61cc5b56d6e17a349..5387354a33da88d44deb7094924191a349453a76 100644 (file)
@@ -50,6 +50,11 @@ bin_PROGRAMS         += if-mtu
 if_mtu_SOURCES          = if-mtu.c
 dist_man_MANS          += if-mtu.1
 
+## getpass
+bin_PROGRAMS           += getpass
+getpass_SOURCES                 = getpass.c
+dist_man_MANS          += getpass.1
+
 ## xtitle
 bin_PROGRAMS           += xtitle
 xtitle_SOURCES          = xtitle.c
index 1c31949de4c84c157e45bffd971e764c79eb8228..451354848a520bd191f3282251dbcd7c6f5c209a 100644 (file)
@@ -9,9 +9,25 @@ Standards-Version: 3.1.1
 Package: nsict-utils
 Architecture: all
 Section: utils
-Depends: mdwopt-perl, nsict-cdb, locking, qmail-checkspam, nsict-mail,
- if-mtu, shadowfix, zz, gorp, splitconf, xtitle, pause, buf, create, inplace,
- stamp, space
+Depends:
+       mdwopt-perl,
+       nsict-cdb,
+       locking,
+       qmail-checkspam,
+       nsict-mail,
+       if-mtu,
+       shadowfix,
+       zz,
+       gorp,
+       splitconf,
+       xtitle,
+       pause,
+       buf,
+       create,
+       inplace,
+       stamp,
+       space,
+       getpass
 Description: Dummy package for convenience.
 
 Package: mdwopt-perl
@@ -107,6 +123,11 @@ Architecture: any
 Section: utils
 Description: Like cat, but prefixing each line with a datestamp.
 
+Package: getpass
+Architecture: any
+Section: utils
+Description: Read a password without echoing; write it to stdout.
+
 Package: space
 Architecture: any
 Section: utils
index fe4302d0a3d94cfffa20651b9020498af38843a5..ca8851d470cd6ff100c8325da837521e3bf2dd4b 100644 (file)
@@ -15,6 +15,8 @@ check-sender nsict-mail /usr/bin
 check-sender.1 nsict-mail /usr/share/man/man1
 create create /usr/bin
 create.1 create /usr/share/man/man1
+getpass getpass /usr/bin
+getpass.1 getpass /usr/share/man/man1
 gorp gorp /usr/bin
 gorp.1 gorp /usr/share/man/man1
 if-mtu if-mtu /usr/bin
diff --git a/getpass.1 b/getpass.1
new file mode 100644 (file)
index 0000000..bb00343
--- /dev/null
+++ b/getpass.1
@@ -0,0 +1,15 @@
+.TH getpass 1 "1 April 2008"
+.SH NAME
+getpass \- read a secret string from the user
+.SH SYNOPSIS
+.B getpass
+.RI [ prompt ]
+.SH DESCRIPTION
+The
+.B getpass
+program reads a message from the user without echoing it to the terminal,
+and writes the message to standard output.
+.SH SEE ALSO
+.BR getpass (3).
+.SH AUTHOR
+Mark Wooding <mdw@distorted.org.uk>
diff --git a/getpass.c b/getpass.c
new file mode 100755 (executable)
index 0000000..e71b084
--- /dev/null
+++ b/getpass.c
@@ -0,0 +1,13 @@
+#include <unistd.h>
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+  char *p = getpass(argc > 1 ? argv[1] : "Go on: ");
+  if (!p) {
+    perror("getpass");
+    return (1);
+  }
+  puts(p);
+  return (0);
+}