distrib: run libtoolize
[nvi.git] / ex / ex_stop.c
blob0a157e7cce9d3928d143e581309db2045a84ffdb
1 /*-
2 * Copyright (c) 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: ex_stop.c,v 10.11 2001/06/25 15:19:20 skimo Exp $ (Berkeley) $Date: 2001/06/25 15:19:20 $";
14 #endif /* not lint */
16 #include <sys/types.h>
17 #include <sys/queue.h>
19 #include <bitstring.h>
20 #include <errno.h>
21 #include <limits.h>
22 #include <stdio.h>
23 #include <string.h>
24 #include <unistd.h>
26 #include "../common/common.h"
29 * ex_stop -- :stop[!]
30 * :suspend[!]
31 * Suspend execution.
33 * PUBLIC: int ex_stop __P((SCR *, EXCMD *));
35 int
36 ex_stop(SCR *sp, EXCMD *cmdp)
38 int allowed;
40 /* For some strange reason, the force flag turns off autowrite. */
41 if (!FL_ISSET(cmdp->iflags, E_C_FORCE) && file_aw(sp, FS_ALL))
42 return (1);
44 if (sp->gp->scr_suspend(sp, &allowed))
45 return (1);
46 if (!allowed)
47 ex_emsg(sp, NULL, EXM_NOSUSPEND);
48 return (0);