[PATCH] Add hidden password support for windows platform

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 2, 2014 at 12:08 PM, Jason Wessel
<jason.wessel at windriver.com> wrote:
>  static void read_stdin(char **string, int hidden)
>  {
>         char *c = malloc(1025), *ret;
> @@ -417,8 +450,12 @@ static void read_stdin(char **string, int hidden)
>                 exit(1);
>         }
>
> -#ifndef _WIN32
>         if (hidden) {
> +#ifdef _WIN32
> +               disable_echo();
> +               ret = fgets(c, 1025, stdin);
> +               restore_echo();
> +#else /* ! _WIN32 */
>                 struct termios t;
>                 int fd = fileno(stdin);
>
> @@ -431,8 +468,8 @@ static void read_stdin(char **string, int hidden)
>                 t.c_lflag |= ECHO;
>                 tcsetattr(fd, TCSANOW, &t);
>                 fprintf(stderr, "\n");
> -       } else
>  #endif

It would be nicer if we could just call {disable,restore}_echo() from
this function without having to worry about WIN32 / !WIN32.

Maybe if enough of these special cases accumulate, we could wind up
with all of the Windows implementations/stubs in windows.c, and the
UNIX/Linux versions in unix.c.  That could also capture the
differences in the syslog and --background logic.

David, what do you think?



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux