1 /* $OpenBSD: ex_quit.c,v 1.5 2014/11/12 04:28:41 bentley Exp $ */
2
3 /*-
4 * Copyright (c) 1992, 1993, 1994
5 * The Regents of the University of California. All rights reserved.
6 * Copyright (c) 1992, 1993, 1994, 1995, 1996
7 * Keith Bostic. All rights reserved.
8 *
9 * See the LICENSE file for redistribution information.
10 */
11
12 #include "config.h"
13
14 #include <sys/types.h>
15 #include <sys/queue.h>
16
17 #include <bitstring.h>
18 #include <limits.h>
19 #include <stdio.h>
20
21 #include "../common/common.h"
22
23 /*
24 * ex_quit -- :quit[!]
25 * Quit.
26 *
27 * PUBLIC: int ex_quit(SCR *, EXCMD *);
28 */
29 int
ex_quit(SCR * sp,EXCMD * cmdp)30 ex_quit(SCR *sp, EXCMD *cmdp)
31 {
32 int force;
33
34 force = FL_ISSET(cmdp->iflags, E_C_FORCE);
35
36 /* Check for file modifications, or more files to edit. */
37 if (file_m2(sp, force) || ex_ncheck(sp, force))
38 return (1);
39
40 F_SET(sp, force ? SC_EXIT_FORCE : SC_EXIT);
41 return (0);
42 }
43