1
0
Files
irix-657m-src/eoe/lib/libdb/db.1.85/test/db-rev.patch
2022-09-29 17:59:04 +03:00

40 lines
791 B
Diff

*** rev.c Mon Mar 23 11:57:00 1992
--- /u/mandrews/src/BSD/db/db.1.85/test/rev.c Mon Oct 16 12:58:26 1995
***************
*** 46,54 ****
--- 46,56 ----
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ #include "cdefs.h"
void usage __P((void));
void warn __P((const char *, ...));
+ char *fgetline __P((FILE *, size_t *));
int
main(argc, argv)
***************
*** 130,133 ****
--- 132,149 ----
{
(void)fprintf(stderr, "usage: rev [file ...]\n");
exit(1);
+ }
+
+ char *
+ fgetline(FILE *fp, size_t *n)
+ {
+ static char buf[BUFSIZ];
+
+ if ((fgets(buf, BUFSIZ, fp)) == NULL)
+ *n = 0;
+ else {
+ *n = strlen(buf) - 1;
+ buf[(*n)] = '\0';
+ }
+ return(*n == 0 ? (char *)NULL : buf);
}