Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / nvi / ex / ex_stop.c
blobc16f6c012dacc5a61cee548210dcf0e952f5b4ab
1 /* $NetBSD$ */
3 /*-
4 * Copyright (c) 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.
9 * See the LICENSE file for redistribution information.
12 #include "config.h"
14 #ifndef lint
15 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";
16 #endif /* not lint */
18 #include <sys/types.h>
19 #include <sys/queue.h>
21 #include <bitstring.h>
22 #include <errno.h>
23 #include <limits.h>
24 #include <stdio.h>
25 #include <string.h>
26 #include <unistd.h>
28 #include "../common/common.h"
31 * ex_stop -- :stop[!]
32 * :suspend[!]
33 * Suspend execution.
35 * PUBLIC: int ex_stop __P((SCR *, EXCMD *));
37 int
38 ex_stop(SCR *sp, 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);