getttyent.c (165903) | getttyent.c (175345) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#if defined(LIBC_SCCS) && !defined(lint) 31static char sccsid[] = "@(#)getttyent.c 8.1 (Berkeley) 6/4/93"; 32#endif /* LIBC_SCCS and not lint */ 33#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#if defined(LIBC_SCCS) && !defined(lint) 31static char sccsid[] = "@(#)getttyent.c 8.1 (Berkeley) 6/4/93"; 32#endif /* LIBC_SCCS and not lint */ 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/lib/libc/gen/getttyent.c 165903 2007-01-09 00:28:16Z imp $"); | 34__FBSDID("$FreeBSD: head/lib/libc/gen/getttyent.c 175345 2008-01-15 06:50:50Z das $"); |
35 36#include <ttyent.h> 37#include <stdio.h> 38#include <stdlib.h> 39#include <ctype.h> 40#include <string.h> 41#include <dirent.h> 42#include <paths.h> --- 49 unchanged lines hidden (view full) --- 92 tty.ty_window = NULL; 93 tty.ty_comment = NULL; 94 tty.ty_group = _TTYS_NOGROUP; 95 return (&tty); 96 } 97 return (NULL); 98 } 99 /* extend buffer if line was too big, and retry */ | 35 36#include <ttyent.h> 37#include <stdio.h> 38#include <stdlib.h> 39#include <ctype.h> 40#include <string.h> 41#include <dirent.h> 42#include <paths.h> --- 49 unchanged lines hidden (view full) --- 92 tty.ty_window = NULL; 93 tty.ty_comment = NULL; 94 tty.ty_group = _TTYS_NOGROUP; 95 return (&tty); 96 } 97 return (NULL); 98 } 99 /* extend buffer if line was too big, and retry */ |
100 while (!index(p, '\n')) { | 100 while (!index(p, '\n') && !feof(tf)) { |
101 i = strlen(p); 102 lbsize += MALLOCCHUNK; 103 if ((p = realloc(line, lbsize)) == NULL) { 104 (void)endttyent(); 105 return (NULL); 106 } 107 line = p; 108 if (!fgets(&line[i], lbsize - i, tf)) --- 191 unchanged lines hidden --- | 101 i = strlen(p); 102 lbsize += MALLOCCHUNK; 103 if ((p = realloc(line, lbsize)) == NULL) { 104 (void)endttyent(); 105 return (NULL); 106 } 107 line = p; 108 if (!fgets(&line[i], lbsize - i, tf)) --- 191 unchanged lines hidden --- |