GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: usr.bin/vi/build/../ex/ex_stop.c Lines: 0 8 0.0 %
Date: 2017-11-07 Branches: 0 8 0.0 %

Line Branch Exec Source
1
/*	$OpenBSD: ex_stop.c,v 1.6 2014/11/12 04:28:41 bentley Exp $	*/
2
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.
8
 *
9
 * See the LICENSE file for redistribution information.
10
 */
11
12
#include "config.h"
13
14
#include <sys/types.h>
15
#include <sys/queue.h>
16
17
#include <bitstring.h>
18
#include <errno.h>
19
#include <limits.h>
20
#include <stdio.h>
21
#include <string.h>
22
#include <unistd.h>
23
24
#include "../common/common.h"
25
26
/*
27
 * ex_stop -- :stop[!]
28
 *	      :suspend[!]
29
 *	Suspend execution.
30
 *
31
 * PUBLIC: int ex_stop(SCR *, EXCMD *);
32
 */
33
int
34
ex_stop(SCR *sp, EXCMD *cmdp)
35
{
36
	int allowed;
37
38
	/* For some strange reason, the force flag turns off autowrite. */
39
	if (!FL_ISSET(cmdp->iflags, E_C_FORCE) && file_aw(sp, FS_ALL))
40
		return (1);
41
42
	if (sp->gp->scr_suspend(sp, &allowed))
43
		return (1);
44
	if (!allowed)
45
		ex_emsg(sp, NULL, EXM_NOSUSPEND);
46
	return (0);
47
}