version 1.2, 1999/12/10 06:45:12 |
version 1.3, 2000/01/24 04:22:53 |
|
|
/* |
/* |
* Copyright (c) 1996, 1998, 1999 Todd C. Miller <Todd.Miller@courtesan.com> |
* Copyright (c) 1996, 1998-2000 Todd C. Miller <Todd.Miller@courtesan.com> |
* All rights reserved. |
* All rights reserved. |
* |
* |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
|
|
#endif /* TCSASOFT */ |
#endif /* TCSASOFT */ |
|
|
#ifndef lint |
#ifndef lint |
static const char rcsid[] = "$Sudo: tgetpass.c,v 1.91 1999/12/05 02:18:47 millert Exp $"; |
static const char rcsid[] = "$Sudo: tgetpass.c,v 1.93 2000/01/17 23:46:26 millert Exp $"; |
#endif /* lint */ |
#endif /* lint */ |
|
|
static char *tgetline __P((int, char *, size_t, int)); |
static char *tgetline __P((int, char *, size_t, int)); |
|
|
|
|
/* Read a character, exit loop on error, EOF or EOL */ |
/* Read a character, exit loop on error, EOF or EOL */ |
n = read(fd, &c, 1); |
n = read(fd, &c, 1); |
if (n != 1 || c == '\n') |
if (n != 1 || c == '\n' || c == '\r') |
break; |
break; |
*cp++ = c; |
*cp++ = c; |
} |
} |
free(readfds); |
free(readfds); |
} else { |
} else { |
/* Keep reading until out of space, EOF, error, or newline */ |
/* Keep reading until out of space, EOF, error, or newline */ |
while (--left && (n = read(fd, &c, 1)) == 1 && c != '\n') |
while (--left && (n = read(fd, &c, 1)) == 1 && (c != '\n' || c != '\r')) |
*cp++ = c; |
*cp++ = c; |
} |
} |
*cp = '\0'; |
*cp = '\0'; |