linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Andrés Roldán" <aroldan@fluidsignal.com>
To: "John T. Williams" <jtwilliams@vt.edu>
Cc: linux-c-programming <linux-c-programming@vger.kernel.org>
Subject: Re: I'm really starting to dislike stdio
Date: Thu, 19 Jun 2003 07:56:09 -0500	[thread overview]
Message-ID: <7dhe6m445y.fsf@void.central.fluidsignal.com> (raw)
In-Reply-To: <004001c33635$21f3d3a0$e764a8c0@fesnel.noip.org> (John T. Williams's message of "Thu, 19 Jun 2003 03:33:16 -0400")

man 3 getpass

Cheers

"John T. Williams" <jtwilliams@vt.edu> writes:

> I really appricated the help with the progress bar.
>
> I have another problem
>
> I am trying to read in a password from the stdin, but I don't want it to
> display to the screen as the person types it in.
> I either like to mock su, and take input w/o any output, or output a *  for
> each typed character, and I cannot figure out how to get this to work
>
> I've tried
> _____________________
>
>         read(1, &tmpch, 1);
>
>         while(tmpch != '\n') {
>                 memset(prog, '*', stars);
>                 printf("\rPassword: %-20s ", prog );
>                 stars++;
>
>                 buff[loop] = tmpch;
>                 loop++;
>                 read(1, &tmpch, 1);
>         }
>         read(1, &tmpch, 1);
>
>         while(tmpch != '\n') {
>                 memset(prog, '*', stars);
>                 printf("\rPassword: %-20s ", prog );
>                 stars++;
>
>                 buff[loop] = tmpch;
>                 loop++;
>                 read(1, &tmpch, 1);
>         }
> --------------------------
>
> I've tried
>
> ____________________
>
>
> tmpch = getchar();
> while(tmpch != '\n') {
>     memset(prog, '*', stars)
>     printf("\rPassword: %-20s ", prog );
>     stars++;
>
>     buff[loop] = tmpch;
>     loop++;
>     tmpch = getchar();
> }
>
> and I tried getc from the curses library.
> The problem with all of these is that they only actually do the read part
> after I've hit the <enter> key.  I want it to process each character as it
> is typed.  Anyone who has any ideas or can tell me a better way to read
> characters w/o displaying it to the screen and I'd be greatful.
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Andres Roldan <aroldan@fluidsignal.com>
http://people.fluidsignal.com/~aroldan
CSO, Fluidsignal Group

      parent reply	other threads:[~2003-06-19 12:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-18  9:58 stdio John T. Williams
2003-06-18 12:02 ` stdio Jan-Benedict Glaw
2003-06-18 12:17 ` stdio Luciano Moreira - igLnx
2003-06-18 13:04 ` stdio Stephen Satchell
2003-06-18 17:45   ` stdio Glynn Clements
2003-06-18 18:30 ` stdio Chris Nanakos
2003-06-19  7:33   ` I'm really starting to dislike stdio John T. Williams
2003-06-19 11:26     ` Jan-Benedict Glaw
2003-06-19 17:39       ` Glynn Clements
2003-06-19 12:56     ` Andrés Roldán [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7dhe6m445y.fsf@void.central.fluidsignal.com \
    --to=aroldan@fluidsignal.com \
    --cc=jtwilliams@vt.edu \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).