summaryrefslogtreecommitdiff
path: root/usr.bin/mg/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/mg/main.c')
-rw-r--r--usr.bin/mg/main.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.bin/mg/main.c b/usr.bin/mg/main.c
index a8bf7264bbb..abbee6b6395 100644
--- a/usr.bin/mg/main.c
+++ b/usr.bin/mg/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.33 2004/07/19 12:14:08 vincent Exp $ */
+/* $OpenBSD: main.c,v 1.34 2005/03/09 16:20:48 jfb Exp $ */
/*
* Mainline.
@@ -31,7 +31,7 @@ main(int argc, char **argv)
{
char *cp, *init_fcn_name = NULL;
PF init_fcn = NULL;
- int o, i, nfiles;
+ int o, i, nfiles, status;
while ((o = getopt(argc, argv, "f:")) != -1)
switch (o) {
@@ -105,10 +105,13 @@ notnum:
}
curbp = findbuffer(cp);
(void)showbuffer(curbp, curwp, 0);
- (void)readin(cp);
- if (init_fcn_name)
- init_fcn(0, 1);
- nfiles++;
+ if ((status = readin(cp)) != TRUE) {
+ killbuffer(curbp);
+ } else {
+ if (init_fcn_name)
+ init_fcn(0, 1);
+ nfiles++;
+ }
}
}
}