version 1.23, 2014/10/11 04:31:55 |
version 1.24, 2015/01/16 06:40:08 |
|
|
* SUCH DAMAGE. |
* SUCH DAMAGE. |
*/ |
*/ |
|
|
#include <sys/param.h> |
|
|
|
#include <err.h> |
#include <err.h> |
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
#include <unistd.h> |
#include <unistd.h> |
|
|
|
#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) |
|
|
/* |
/* |
* There's a structure per input file which encapsulates the state of the |
* There's a structure per input file which encapsulates the state of the |
* file. We repeatedly read lines from each file until we've read in all |
* file. We repeatedly read lines from each file until we've read in all |
|
|
if (lp->linealloc <= len + 1) { |
if (lp->linealloc <= len + 1) { |
char *p; |
char *p; |
u_long newsize = lp->linealloc + |
u_long newsize = lp->linealloc + |
MAX(100, len + 1 - lp->linealloc); |
MAXIMUM(100, len + 1 - lp->linealloc); |
if ((p = realloc(lp->line, newsize)) == NULL) |
if ((p = realloc(lp->line, newsize)) == NULL) |
err(1, NULL); |
err(1, NULL); |
lp->line = p; |
lp->line = p; |