2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
5 * %sccs.include.redist.c%
9 static char sccsid
[] = "$Id: ex_quit.c,v 8.7 1993/12/10 12:20:58 bostic Exp $ (Berkeley) $Date: 1993/12/10 12:20:58 $";
12 #include <sys/types.h>
29 force
= F_ISSET(cmdp
, E_FORCE
);
31 /* Check for modifications. */
32 if (F_ISSET(ep
, F_MODIFIED
) && ep
->refcnt
<= 1 && !force
) {
34 "Modified since last write; write or use ! to override.");
40 * Historic practice: quit! or two quit's done in succession
41 * (where ZZ counts as a quit) didn't check for other files.
43 * Also check for related screens; if they exist, quit, the
44 * user will get the message on the last screen.
46 if (!force
&& sp
->ccnt
!= sp
->q_ccnt
+ 1 &&
47 ep
->refcnt
<= 1 && file_unedited(sp
) != NULL
) {
48 sp
->q_ccnt
= sp
->ccnt
;
50 "More files; use \":n\" to go to the next file, \":q!\" to quit.");
54 F_SET(sp
, force
? S_EXIT_FORCE
: S_EXIT
);