distrib: run libtoolize
[nvi.git] / vi / v_zexit.c
blob285bac1cb91f88917d3d2b1e45fe3753d9101952
1 /*-
2 * Copyright (c) 1992, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1992, 1993, 1994, 1995, 1996
5 * Keith Bostic. All rights reserved.
7 * See the LICENSE file for redistribution information.
8 */
10 #include "config.h"
12 #ifndef lint
13 static const char sccsid[] = "$Id: v_zexit.c,v 10.7 2001/06/25 15:19:37 skimo Exp $ (Berkeley) $Date: 2001/06/25 15:19:37 $";
14 #endif /* not lint */
16 #include <sys/types.h>
17 #include <sys/queue.h>
18 #include <sys/time.h>
20 #include <bitstring.h>
21 #include <limits.h>
22 #include <stdio.h>
23 #include <string.h>
25 #include "../common/common.h"
26 #include "vi.h"
29 * v_zexit -- ZZ
30 * Save the file and exit.
32 * PUBLIC: int v_zexit __P((SCR *, VICMD *));
34 int
35 v_zexit(SCR *sp, VICMD *vp)
37 /* Write back any modifications. */
38 if (F_ISSET(sp->ep, F_MODIFIED) &&
39 file_write(sp, NULL, NULL, NULL, FS_ALL))
40 return (1);
42 /* Check to make sure it's not a temporary file. */
43 if (file_m3(sp, 0))
44 return (1);
46 /* Check for more files to edit. */
47 if (ex_ncheck(sp, 0))
48 return (1);
50 F_SET(sp, SC_EXIT);
51 return (0);