#include <stdio.h>
#include <curses.h>
#define MAX_LENGHT      8
#define ENTER           10  // Bug? I tried #define ENTER KEY_ENTER but it didn't work...

int ch;
char password[MAX_LENGHT];
char *mypass="password";
int pos=0;

int main()
{
   initscr();
   noecho();                    /* turn off echoing*/
   printw("Please enter the password:\n");
   while(true)
     {
       ch=getch();

       if(ch == ENTER) break;   /* User has pressed ENTER*/

       else                     /* A..Z a...z  */
         {
           printw("%c", '*');
           password[pos++] = ch;
           password[pos] = '\0';
         }
     }

   printw("%c", '\n');
   for(int i = 0; i<10; i++)
     printw("%c", password[i]);

   echo();                      /* you can turn on echoing now*/
   getch();
   endwin();
   return 0;
}
