fetch.9 - document casuword
[dragonfly.git] / contrib / nvi / ex / ex_stop.c
blobbc55fd24ccb726e8fec294b88597e38e6b1be150
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[] = "@(#)ex_stop.c 10.10 (Berkeley) 3/6/96";
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(sp, cmdp)
37 SCR *sp;
38 EXCMD *cmdp;
40 int allowed;
42 /* For some strange reason, the force flag turns off autowrite. */
43 if (!FL_ISSET(cmdp->iflags, E_C_FORCE) && file_aw(sp, FS_ALL))
44 return (1);
46 if (sp->gp->scr_suspend(sp, &allowed))
47 return (1);
48 if (!allowed)
49 ex_emsg(sp, NULL, EXM_NOSUSPEND);
50 return (0);