io.c (e026a48c34d396fe7d0e382673a69bc047c0bfca) | io.c (d005495293cb4ddf2f4690f0b74c9ae1a3ce80a8) |
---|---|
1/* 2 * Copyright (c) 1985 Sun Microsystems, Inc. 3 * Copyright (c) 1980, 1993 4 * The Regents of the University of California. All rights reserved. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 19 unchanged lines hidden (view full) --- 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 */ 35 | 1/* 2 * Copyright (c) 1985 Sun Microsystems, Inc. 3 * Copyright (c) 1980, 1993 4 * The Regents of the University of California. All rights reserved. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 19 unchanged lines hidden (view full) --- 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 */ 35 |
36#ifndef lint | |
37#if 0 | 36#if 0 |
37#ifndef lint |
|
38static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93"; | 38static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93"; |
39#endif | |
40#endif /* not lint */ | 39#endif /* not lint */ |
40#endif 41 |
|
41#include <sys/cdefs.h> 42__FBSDID("$FreeBSD$"); 43 44#include <ctype.h> 45#include <err.h> 46#include <stdio.h> 47#include <stdlib.h> 48#include <string.h> --- 304 unchanged lines hidden (view full) --- 353 return; /* only return if there is really something in 354 * this buffer */ 355 } 356 for (p = in_buffer;;) { 357 if (p >= in_buffer_limit) { 358 int size = (in_buffer_limit - in_buffer) * 2 + 10; 359 int offset = p - in_buffer; 360 in_buffer = realloc(in_buffer, size); | 42#include <sys/cdefs.h> 43__FBSDID("$FreeBSD$"); 44 45#include <ctype.h> 46#include <err.h> 47#include <stdio.h> 48#include <stdlib.h> 49#include <string.h> --- 304 unchanged lines hidden (view full) --- 354 return; /* only return if there is really something in 355 * this buffer */ 356 } 357 for (p = in_buffer;;) { 358 if (p >= in_buffer_limit) { 359 int size = (in_buffer_limit - in_buffer) * 2 + 10; 360 int offset = p - in_buffer; 361 in_buffer = realloc(in_buffer, size); |
361 if (in_buffer == 0) 362 err(1, "input line too long"); | 362 if (in_buffer == NULL) 363 errx(1, "input line too long"); |
363 p = in_buffer + offset; 364 in_buffer_limit = in_buffer + size - 2; 365 } 366 if ((i = getc(f)) == EOF) { 367 *p++ = ' '; 368 *p++ = '\n'; 369 had_eof = true; 370 break; --- 295 unchanged lines hidden --- | 364 p = in_buffer + offset; 365 in_buffer_limit = in_buffer + size - 2; 366 } 367 if ((i = getc(f)) == EOF) { 368 *p++ = ' '; 369 *p++ = '\n'; 370 had_eof = true; 371 break; --- 295 unchanged lines hidden --- |