-/* $OpenBSD: compile.c,v 1.51 2022/12/26 19:16:02 jmc Exp $ */
+/* $OpenBSD: compile.c,v 1.52 2024/06/18 00:32:22 millert Exp $ */
/*-
* Copyright (c) 1992 Diomidis Spinellis.
stack = 0;
for (;;) {
- if ((p = cu_fgets(&lbuf, &bufsize)) == NULL) {
+ if ((p = cu_getline(&lbuf, &bufsize)) == NULL) {
if (stack != 0)
error(COMPILE, "unexpected EOF (pending }'s)");
return (link);
*sp++ = *p;
}
size += sp - op;
- } while ((p = cu_fgets(&lbuf, &bufsize)));
+ } while ((p = cu_getline(&lbuf, &bufsize)));
error(COMPILE, "unterminated substitute in regular expression");
}
lbuf = text = NULL;
asize = size = 0;
- while ((p = cu_fgets(&lbuf, &bufsize))) {
+ while ((p = cu_getline(&lbuf, &bufsize))) {
size_t len = ROUNDLEN(strlen(p) + 1);
if (asize - size < len) {
do {
-/* $OpenBSD: extern.h,v 1.14 2018/11/14 10:59:33 martijn Exp $ */
+/* $OpenBSD: extern.h,v 1.15 2024/06/18 00:32:22 millert Exp $ */
/*-
* Copyright (c) 1992 Diomidis Spinellis.
* Copyright (c) 1992, 1993
void cfclose(struct s_command *, struct s_command *);
void compile(void);
void cspace(SPACE *, const char *, size_t, enum e_spflag);
-char *cu_fgets(char **, size_t *);
+char *cu_getline(char **, size_t *);
__dead void error(int, const char *, ...);
void warning(const char *, ...);
-int mf_fgets(SPACE *, enum e_spflag);
+int mf_getline(SPACE *, enum e_spflag);
int lastline(void);
void finish_file(void);
void process(void);
-/* $OpenBSD: main.c,v 1.44 2023/02/08 08:18:11 tb Exp $ */
+/* $OpenBSD: main.c,v 1.45 2024/06/18 00:32:22 millert Exp $ */
/*-
* Copyright (c) 1992 Diomidis Spinellis.
}
/*
- * Like fgets, but go through the chain of compilation units chaining them
+ * Like getline, but go through the chain of compilation units chaining them
* together. Empty strings and files are ignored.
*/
char *
-cu_fgets(char **outbuf, size_t *outsize)
+cu_getline(char **outbuf, size_t *outsize)
{
static enum {ST_EOF, ST_FILE, ST_STRING} state = ST_EOF;
static FILE *f; /* Current open file */
}
/*
- * Like fgets, but go through the list of files chaining them together.
+ * Like getline, but go through the list of files chaining them together.
* Set len to the length of the line.
*/
int
-mf_fgets(SPACE *sp, enum e_spflag spflag)
+mf_getline(SPACE *sp, enum e_spflag spflag)
{
struct stat sb;
size_t len;
-/* $OpenBSD: process.c,v 1.35 2022/01/12 15:13:36 martijn Exp $ */
+/* $OpenBSD: process.c,v 1.36 2024/06/18 00:32:22 millert Exp $ */
/*-
* Copyright (c) 1992 Diomidis Spinellis.
size_t len, oldpsl;
char *p;
- for (linenum = 0; mf_fgets(&PS, REPLACE);) {
+ for (linenum = 0; mf_getline(&PS, REPLACE);) {
pd = 0;
top:
cp = prog;
if (!nflag && !pd)
OUT();
flush_appends();
- if (!mf_fgets(&PS, REPLACE))
+ if (!mf_getline(&PS, REPLACE))
exit(0);
pd = 0;
break;
case 'N':
flush_appends();
cspace(&PS, "\n", 1, 0);
- if (!mf_fgets(&PS, 0))
+ if (!mf_getline(&PS, 0))
exit(0);
break;
case 'p':