/* * passwords.h * ***************************************************************************** * * Get passwords in C * ~~~~~~~~~~~~~~~~~~ ***************************************************************************** * * Author : Rajesh _ThE gReAt * Built on : Some time in 2k * Last Modified on : Friday, February 15, 2002, 11:45:58 PM * * * Known errors : ---===(none)===--- * ***************************************************************************** * DISCLAIMER: ***************************************************************************** * * Programmers may incorporate any or all code into their programs, * giving proper credit within the source. Publication of the * source routines is permitted so long as proper credit is given * to Rajesh _ThE gReAt. * * Copyright (C) 2002, 2003 by Rajesh _ThE gReAt. You may use this program, or * code or tables extracted from it, as desired without restriction. * I can not and will not be held responsible for any damage caused from * the use of this software. * * Read license.txt from http://www.rajeshgoli.com/license.txt * or http://www.rajeshgoli.com/license.htm * before using / distributing / or any sort of use of my source * Also read my disclaimer http://www.rajeshgoli.com/disclaimer.htm * * YOU AGREE TO BE BOUND BY MY DISCLAIMER AND LICENSE BY IN ANY WAY * USING THIS FILE . * ***************************************************************************** * This source works with Turbo C 2.0 and Turbo C++ 3.0 and above. ***************************************************************************** * Rajesh _ThE gReAt is a synonym of Rajesh Goli * Source freely distributable *****************************************************************************/ #define OUTCHAR '*' #ifndef __STDIO_H #include #endif #ifndef __CONIO_H #include #endif char *getpassword(char *write) { char ch; char *pass; char *work; work=pass; putc('\n',stdout); while(*write) putchar(*(write++)); do { ch = getch(); *(pass++)=ch; } while(ch != '\r'); *(--pass)=0; /*Replace '\r' by NULL charecter*/ return(work); } char *getpass_star(char *write) { char ch; char *pass; char *work; work=pass; putc('\n',stdout); while(*write) putchar(*(write++)); do { ch = getch(); *(pass++)=ch; if(ch!='\r') putc(OUTCHAR,stdout); } while(ch != '\r'); *(--pass)=0; /*Replace '\r' by NULL charecter*/ return(work); }