Hello tech@,
I'm playing around with vi some more and found that pledge was placed
before a declaration, which triggered (by stricter compiler flags) a:
warning: ISO C90 forbids mixed declarations and code
I agree that it's cleaner to set the declaration of optstr before pledge.
Sincerely,
Martijn van Duren
Index: common/main.c
===================================================================
RCS file: /cvs/src/usr.bin/./vi/common/main.c,v
retrieving revision 1.32
diff -u -p -r1.32 main.c
--- common/main.c 6 Jan 2016 22:27:39 -0000 1.32
+++ common/main.c 9 Jan 2016 09:32:59 -0000
@@ -55,11 +55,6 @@ editor(GS *gp, int argc, char *argv[])
int ch, flagchk, lflag, secure, startup, readonly, rval, silent;
char *tag_f, *wsizearg, path[256];
- if (pledge("stdio rpath wpath cpath fattr flock getpw tty proc exec", NULL) == -1) {
- perror("pledge");
- goto err;
- }
-
static const char *optstr[3] = {
#ifdef DEBUG
"c:D:FlRrSsT:t:vw:",
@@ -71,6 +66,11 @@ editor(GS *gp, int argc, char *argv[])
"c:eFlrSt:w:"
#endif
};
+
+ if (pledge("stdio rpath wpath cpath fattr flock getpw tty proc exec", NULL) == -1) {
+ perror("pledge");
+ goto err;
+ }
/* Initialize the busy routine, if not defined by the screen. */
if (gp->scr_busy == NULL)