*** empty log message ***
[nvi.git] / ex / ex_stop.c
blob5e2b065d64bb7f533087ea3982dbc7930750dd35
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.10 1996/03/06 19:52:42 bostic Exp $ (Berkeley) $Date: 1996/03/06 19:52:42 $";
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);