GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  READCONS (3)

NAME

readcons - prompt console for input

CONTENTS

Synopsis
Description
Example
Source

SYNOPSIS

#include <u.h>

#include <libc.h>

char *readcons(char *prompt, char *def, int secret)

DESCRIPTION

Readcons prompts at the console for input. It returns a NUL-terminated buffer containing the input without a final newline. The buffer should be freed (and perhaps cleared first) when no longer needed.

If the user types an empty string (just a newline) and def is non-zero, then a copy of def is returned instead of the empty string.

If secret is non-zero, the input is not echoed to the screen.

EXAMPLE

A stripped-down version of netkey (see passwd(1)):
pass = readcons("password", nil, 1); passtokey(key, pass); memset(pass, 0, strlen(pass)); free(pass); for(;;){
        chal = readcons("challenge", nil, 0);
        sprint(buf, "%d", strtol(chal, 0, 10));
        free(chal);
        netcrypt(key, buf);
        print("response: %s0, buf); }

SOURCE

/usr/local/plan9/src/lib9/readcons.c
Search for    or go to Top of page |  Section 3 |  Main Index


READCONS (3) -->

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.