-/* $OpenBSD: glbl.c,v 1.18 2016/03/22 17:58:28 mmcc Exp $ */
+/* $OpenBSD: glbl.c,v 1.19 2017/04/26 21:25:43 naddy Exp $ */
/* $NetBSD: glbl.c,v 1.2 1995/03/21 09:04:41 cgd Exp $ */
/* glob.c: This file contains the global command routines for the ed line
return ERR;
if (isbinary)
NUL_TO_NEWLINE(s, lp->len);
- if (!regexec(pat, s, 0, NULL, 0) == isgcmd &&
+ if ((!regexec(pat, s, 0, NULL, 0)) == isgcmd &&
set_active_node(lp) < 0)
return ERR;
}
-/* $OpenBSD: io.c,v 1.19 2016/03/22 17:58:28 mmcc Exp $ */
+/* $OpenBSD: io.c,v 1.20 2017/04/26 21:25:43 naddy Exp $ */
/* $NetBSD: io.c,v 1.2 1995/03/21 09:04:43 cgd Exp $ */
/* io.c: This file contains the i/o routines for the ed line editor */
seterrmsg("cannot close input file");
return ERR;
}
- fprintf(stderr, !scripted ? "%d\n" : "", size);
+ if (!scripted)
+ fprintf(stderr, "%d\n", size);
return current_addr - n;
}
seterrmsg("cannot close output file");
return ERR;
}
- fprintf(stderr, !scripted ? "%d\n" : "", size);
+ if (!scripted)
+ fprintf(stderr, "%d\n", size);
return n ? m - n + 1 : 0;
}
-/* $OpenBSD: main.c,v 1.59 2017/01/03 20:24:29 tb Exp $ */
+/* $OpenBSD: main.c,v 1.60 2017/04/26 21:25:43 naddy Exp $ */
/* $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $ */
/* main.c: This file contains the main control and user-interface routines
fputs("?\n", stderr);
seterrmsg("warning: file modified");
if (!interactive) {
- fprintf(stderr, garrulous ?
- "script, line %d: %s\n" :
- "", lineno, errmsg);
+ if (garrulous)
+ fprintf(stderr,
+ "script, line %d: %s\n",
+ lineno, errmsg);
quit(2);
}
clearerr(stdin);
fputs("?\n", stderr); /* give warning */
seterrmsg("warning: file modified");
if (!interactive) {
- fprintf(stderr, garrulous ?
- "script, line %d: %s\n" :
- "", lineno, errmsg);
+ if (garrulous)
+ fprintf(stderr,
+ "script, line %d: %s\n",
+ lineno, errmsg);
quit(2);
}
break;
case FATAL:
- if (!interactive)
- fprintf(stderr, garrulous ?
- "script, line %d: %s\n" : "",
- lineno, errmsg);
- else
- fprintf(stderr, garrulous ? "%s\n" : "",
- errmsg);
+ if (!interactive) {
+ if (garrulous)
+ fprintf(stderr,
+ "script, line %d: %s\n",
+ lineno, errmsg);
+ } else if (garrulous)
+ fprintf(stderr, "%s\n", errmsg);
quit(3);
break;
default:
fputs("?\n", stderr);
if (!interactive) {
- fprintf(stderr, garrulous ?
- "script, line %d: %s\n" : "",
- lineno, errmsg);
+ if (garrulous)
+ fprintf(stderr,
+ "script, line %d: %s\n",
+ lineno, errmsg);
quit(2);
}
break;