head	1.11;
access;
symbols
	perseant-exfatfs-base-20250801:1.11
	perseant-exfatfs-base-20240630:1.11
	perseant-exfatfs:1.11.0.36
	perseant-exfatfs-base:1.11
	cjep_sun2x:1.11.0.34
	cjep_sun2x-base:1.11
	cjep_staticlib_x-base1:1.11
	cjep_staticlib_x:1.11.0.32
	cjep_staticlib_x-base:1.11
	phil-wifi-20200421:1.11
	phil-wifi-20200411:1.11
	phil-wifi-20200406:1.11
	pgoyette-compat-merge-20190127:1.11
	pgoyette-compat-20190127:1.11
	pgoyette-compat-20190118:1.11
	pgoyette-compat-1226:1.11
	pgoyette-compat-1126:1.11
	pgoyette-compat-1020:1.11
	pgoyette-compat-0930:1.11
	pgoyette-compat-0906:1.11
	pgoyette-compat-0728:1.11
	pgoyette-compat-0625:1.11
	pgoyette-compat-0521:1.11
	pgoyette-compat-0502:1.11
	pgoyette-compat-0422:1.11
	pgoyette-compat-0415:1.11
	pgoyette-compat-0407:1.11
	pgoyette-compat-0330:1.11
	pgoyette-compat-0322:1.11
	pgoyette-compat-0315:1.11
	pgoyette-compat:1.11.0.30
	pgoyette-compat-base:1.11
	perseant-stdc-iso10646:1.11.0.28
	perseant-stdc-iso10646-base:1.11
	prg-localcount2-base3:1.11
	prg-localcount2-base2:1.11
	prg-localcount2-base1:1.11
	prg-localcount2:1.11.0.26
	prg-localcount2-base:1.11
	pgoyette-localcount-20170426:1.11
	bouyer-socketcan-base1:1.11
	pgoyette-localcount-20170320:1.11
	bouyer-socketcan:1.11.0.24
	bouyer-socketcan-base:1.11
	pgoyette-localcount-20170107:1.11
	pgoyette-localcount-20161104:1.11
	localcount-20160914:1.11
	pgoyette-localcount-20160806:1.11
	pgoyette-localcount-20160726:1.11
	pgoyette-localcount:1.11.0.22
	pgoyette-localcount-base:1.11
	netbsd-5-2-3-RELEASE:1.11
	netbsd-5-1-5-RELEASE:1.11
	yamt-pagecache-base9:1.11
	yamt-pagecache-tag8:1.11
	tls-earlyentropy:1.11.0.18
	tls-earlyentropy-base:1.11
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.11
	riastradh-drm2-base3:1.11
	netbsd-5-2-2-RELEASE:1.11
	netbsd-5-1-4-RELEASE:1.11
	netbsd-5-2-1-RELEASE:1.11
	netbsd-5-1-3-RELEASE:1.11
	agc-symver:1.11.0.20
	agc-symver-base:1.11
	tls-maxphys-base:1.11
	yamt-pagecache-base8:1.11
	netbsd-5-2:1.11.0.16
	yamt-pagecache-base7:1.11
	netbsd-5-2-RELEASE:1.11
	netbsd-5-2-RC1:1.11
	yamt-pagecache-base6:1.11
	yamt-pagecache-base5:1.11
	yamt-pagecache-base4:1.11
	netbsd-5-1-2-RELEASE:1.11
	netbsd-5-1-1-RELEASE:1.11
	yamt-pagecache-base3:1.11
	yamt-pagecache-base2:1.11
	yamt-pagecache:1.11.0.14
	yamt-pagecache-base:1.11
	bouyer-quota2-nbase:1.11
	bouyer-quota2:1.11.0.12
	bouyer-quota2-base:1.11
	matt-nb5-pq3:1.11.0.10
	matt-nb5-pq3-base:1.11
	netbsd-5-1:1.11.0.8
	netbsd-5-1-RELEASE:1.11
	netbsd-5-1-RC4:1.11
	netbsd-5-1-RC3:1.11
	netbsd-5-1-RC2:1.11
	netbsd-5-1-RC1:1.11
	netbsd-5-0-2-RELEASE:1.11
	netbsd-5-0-1-RELEASE:1.11
	jym-xensuspend-nbase:1.11
	netbsd-5-0:1.11.0.6
	netbsd-5-0-RELEASE:1.11
	netbsd-5-0-RC4:1.11
	netbsd-5-0-RC3:1.11
	netbsd-5-0-RC2:1.11
	jym-xensuspend:1.11.0.4
	jym-xensuspend-base:1.11
	netbsd-5-0-RC1:1.11
	netbsd-5:1.11.0.2
	netbsd-5-base:1.11
	matt-mips64-base2:1.10
	matt-mips64:1.10.0.32
	mjf-devfs2:1.10.0.30
	mjf-devfs2-base:1.10
	netbsd-4-0-1-RELEASE:1.10
	wrstuden-revivesa-base-3:1.10
	wrstuden-revivesa-base-2:1.10
	wrstuden-fixsa-newbase:1.10
	wrstuden-revivesa-base-1:1.10
	yamt-pf42-base4:1.10
	yamt-pf42-base3:1.10
	hpcarm-cleanup-nbase:1.10
	yamt-pf42-baseX:1.10
	yamt-pf42-base2:1.10
	wrstuden-revivesa:1.10.0.28
	wrstuden-revivesa-base:1.10
	yamt-pf42:1.10.0.26
	yamt-pf42-base:1.10
	keiichi-mipv6-nbase:1.10
	keiichi-mipv6:1.10.0.24
	keiichi-mipv6-base:1.10
	matt-armv6-nbase:1.10
	matt-armv6-prevmlocking:1.10
	wrstuden-fixsa-base-1:1.10
	netbsd-4-0:1.10.0.22
	netbsd-4-0-RELEASE:1.10
	cube-autoconf:1.10.0.20
	cube-autoconf-base:1.10
	netbsd-4-0-RC5:1.10
	netbsd-4-0-RC4:1.10
	netbsd-4-0-RC3:1.10
	netbsd-4-0-RC2:1.10
	netbsd-4-0-RC1:1.10
	matt-armv6:1.10.0.18
	matt-armv6-base:1.10
	matt-mips64-base:1.10
	hpcarm-cleanup:1.10.0.16
	hpcarm-cleanup-base:1.10
	netbsd-3-1-1-RELEASE:1.10
	netbsd-3-0-3-RELEASE:1.10
	wrstuden-fixsa:1.10.0.14
	wrstuden-fixsa-base:1.10
	abandoned-netbsd-4-base:1.10
	abandoned-netbsd-4:1.10.0.8
	netbsd-3-1:1.10.0.10
	netbsd-3-1-RELEASE:1.10
	netbsd-3-0-2-RELEASE:1.10
	netbsd-3-1-RC4:1.10
	netbsd-3-1-RC3:1.10
	netbsd-3-1-RC2:1.10
	netbsd-3-1-RC1:1.10
	netbsd-4:1.10.0.12
	netbsd-4-base:1.10
	chap-midi-nbase:1.10
	netbsd-3-0-1-RELEASE:1.10
	chap-midi:1.10.0.6
	chap-midi-base:1.10
	netbsd-3-0:1.10.0.4
	netbsd-3-0-RELEASE:1.10
	netbsd-3-0-RC6:1.10
	netbsd-3-0-RC5:1.10
	netbsd-3-0-RC4:1.10
	netbsd-3-0-RC3:1.10
	netbsd-3-0-RC2:1.10
	netbsd-3-0-RC1:1.10
	netbsd-2-0-3-RELEASE:1.9.4.2
	netbsd-2-1:1.9.6.1.0.2
	netbsd-2-1-RELEASE:1.9.6.1
	netbsd-2-1-RC6:1.9.6.1
	netbsd-2-1-RC5:1.9.6.1
	netbsd-2-1-RC4:1.9.6.1
	netbsd-2-1-RC3:1.9.6.1
	netbsd-2-1-RC2:1.9.6.1
	netbsd-2-1-RC1:1.9.6.1
	netbsd-2-0-2-RELEASE:1.9.4.2
	netbsd-3:1.10.0.2
	netbsd-3-base:1.10
	netbsd-2-0-1-RELEASE:1.9
	netbsd-2:1.9.0.6
	netbsd-2-base:1.9
	netbsd-2-0-RELEASE:1.9
	netbsd-2-0-RC5:1.9
	netbsd-2-0-RC4:1.9
	netbsd-2-0-RC3:1.9
	netbsd-2-0-RC2:1.9
	netbsd-2-0-RC1:1.9
	netbsd-2-0:1.9.0.4
	netbsd-2-0-base:1.9
	netbsd-1-6-PATCH002-RELEASE:1.9
	netbsd-1-6-PATCH002:1.9
	netbsd-1-6-PATCH002-RC4:1.9
	netbsd-1-6-PATCH002-RC3:1.9
	netbsd-1-6-PATCH002-RC2:1.9
	netbsd-1-6-PATCH002-RC1:1.9
	netbsd-1-6-PATCH001:1.9
	netbsd-1-6-PATCH001-RELEASE:1.9
	netbsd-1-6-PATCH001-RC3:1.9
	netbsd-1-6-PATCH001-RC2:1.9
	netbsd-1-6-PATCH001-RC1:1.9
	fvdl_fs64_base:1.9
	netbsd-1-6-RELEASE:1.9
	netbsd-1-6-RC3:1.9
	netbsd-1-6-RC2:1.9
	netbsd-1-6-RC1:1.9
	netbsd-1-6:1.9.0.2
	netbsd-1-6-base:1.9
	netbsd-1-5-PATCH003:1.7
	netbsd-1-5-PATCH002:1.7
	netbsd-1-5-PATCH001:1.7
	nvi_1_79:1.1.1.6
	netbsd-1-5-RELEASE:1.7
	netbsd-1-5-BETA2:1.7
	netbsd-1-5-BETA:1.7
	netbsd-1-4-PATCH003:1.7
	netbsd-1-5-ALPHA2:1.7
	netbsd-1-5:1.7.0.10
	netbsd-1-5-base:1.7
	minoura-xpg4dl-base:1.7
	minoura-xpg4dl:1.7.0.8
	netbsd-1-4-PATCH002:1.7
	wrstuden-devbsize-19991221:1.7
	wrstuden-devbsize:1.7.0.6
	wrstuden-devbsize-base:1.7
	comdex-fall-1999:1.7.0.4
	comdex-fall-1999-base:1.7
	netbsd-1-4-PATCH001:1.7
	netbsd-1-4-RELEASE:1.7
	netbsd-1-4:1.7.0.2
	netbsd-1-4-base:1.7
	netbsd-1-3-PATCH003:1.6
	netbsd-1-3-PATCH003-CANDIDATE2:1.6
	netbsd-1-3-PATCH003-CANDIDATE1:1.6
	netbsd-1-3-PATCH003-CANDIDATE0:1.6
	netbsd-1-3-PATCH002:1.6
	netbsd-1-3-PATCH001:1.6
	netbsd-1-3-RELEASE:1.6
	netbsd-1-3-BETA:1.6
	netbsd-1-3:1.6.0.2
	netbsd-1-3-base:1.6
	netbsd-1-2-PATCH001:1.6
	netbsd-1-2-RELEASE:1.6
	netbsd-1-2-BETA:1.6
	netbsd-1-2:1.6.0.4
	netbsd-1-2-base:1.6
	nvi_1_66:1.1.1.5
	BOSTIC:1.1.1
	netbsd-1-1-PATCH001:1.5
	netbsd-1-1-RELEASE:1.5
	netbsd-1-1:1.5.0.4
	netbsd-1-1-base:1.5
	netbsd-1-0-PATCH06:1.5
	netbsd-1-0-PATCH05:1.5
	netbsd-1-0-PATCH04:1.5
	netbsd-1-0-PATCH03:1.5
	netbsd-1-0-PATCH02:1.5
	netbsd-1-0-PATCH1:1.5
	netbsd-1-0-PATCH0:1.5
	netbsd-1-0-RELEASE:1.5
	netbsd-1-0:1.5.0.2
	nvi-1-34b:1.1.1.4
	nvi-1-33b:1.1.1.3
	netbsd-1-0-base:1.3
	nvi-1-11b:1.1.1.2
	nvi-1-03:1.1.1.1
	bostic-nvi:1.1.1;
locks; strict;
comment	@ * @;


1.11
date	2008.10.29.16.49.37;	author christos;	state dead;
branches;
next	1.10;

1.10
date	2005.02.12.12.53.23;	author aymeric;	state Exp;
branches;
next	1.9;

1.9
date	2002.04.09.01.47.33;	author thorpej;	state Exp;
branches
	1.9.4.1
	1.9.6.1;
next	1.8;

1.8
date	2001.03.31.11.37.50;	author aymeric;	state Exp;
branches;
next	1.7;

1.7
date	98.01.09.08.08.00;	author perry;	state Exp;
branches;
next	1.6;

1.6
date	96.05.20.03.47.52;	author mrg;	state Exp;
branches;
next	1.5;

1.5
date	94.08.17.20.12.49;	author cgd;	state Exp;
branches
	1.5.2.1;
next	1.4;

1.4
date	94.08.17.16.36.09;	author cgd;	state Exp;
branches;
next	1.3;

1.3
date	94.03.28.04.29.36;	author cgd;	state Exp;
branches;
next	1.2;

1.2
date	94.01.24.06.40.33;	author cgd;	state Exp;
branches;
next	1.1;

1.1
date	94.01.24.05.53.05;	author cgd;	state Exp;
branches
	1.1.1.1;
next	;

1.9.4.1
date	2005.02.12.12.24.13;	author aymeric;	state Exp;
branches;
next	1.9.4.2;

1.9.4.2
date	2005.02.12.12.46.26;	author aymeric;	state Exp;
branches;
next	;

1.9.6.1
date	2005.05.06.14.42.03;	author riz;	state Exp;
branches;
next	;

1.5.2.1
date	94.08.17.20.12.49;	author cgd;	state dead;
branches;
next	1.5.2.2;

1.5.2.2
date	94.08.17.20.12.50;	author cgd;	state Exp;
branches;
next	;

1.1.1.1
date	94.01.24.05.53.06;	author cgd;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	94.03.28.02.55.06;	author cgd;	state Exp;
branches;
next	1.1.1.3;

1.1.1.3
date	94.08.17.16.16.52;	author cgd;	state Exp;
branches;
next	1.1.1.4;

1.1.1.4
date	94.08.17.19.18.30;	author cgd;	state Exp;
branches;
next	1.1.1.5;

1.1.1.5
date	96.05.20.01.56.41;	author mrg;	state Exp;
branches;
next	1.1.1.6;

1.1.1.6
date	2001.03.31.11.29.46;	author aymeric;	state Exp;
branches;
next	;


desc
@@


1.11
log
@bye old vi!
@
text
@/*	$NetBSD: ex_screen.c,v 1.10 2005/02/12 12:53:23 aymeric Exp $	*/

/*-
 * Copyright (c) 1993, 1994
 *	The Regents of the University of California.  All rights reserved.
 * Copyright (c) 1993, 1994, 1995, 1996
 *	Keith Bostic.  All rights reserved.
 *
 * See the LICENSE file for redistribution information.
 */

#include "config.h"

#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char sccsid[] = "@@(#)ex_screen.c	10.11 (Berkeley) 6/29/96";
#else
__RCSID("$NetBSD: ex_screen.c,v 1.10 2005/02/12 12:53:23 aymeric Exp $");
#endif
#endif /* not lint */

#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

#include <bitstring.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "../common/common.h"
#include "../vi/vi.h"

/*
 * ex_bg --	:bg
 *	Hide the screen.
 *
 * PUBLIC: int ex_bg __P((SCR *, EXCMD *));
 */
int
ex_bg(sp, cmdp)
	SCR *sp;
	EXCMD *cmdp;
{
	return (vs_bg(sp));
}

/*
 * ex_fg --	:fg [file]
 *	Show the screen.
 *
 * PUBLIC: int ex_fg __P((SCR *, EXCMD *));
 */
int
ex_fg(sp, cmdp)
	SCR *sp;
	EXCMD *cmdp;
{
	SCR *nsp;
	int newscreen;

	newscreen = F_ISSET(cmdp, E_NEWSCREEN);
	if (vs_fg(sp, &nsp, cmdp->argc ? cmdp->argv[0]->bp : NULL, newscreen))
		return (1);

	/* Set up the switch. */
	if (newscreen) {
		sp->nextdisp = nsp;
		F_SET(sp, SC_SSWITCH);
	}
	return (0);
}

/*
 * ex_resize --	:resize [+-]rows
 *	Change the screen size.
 *
 * PUBLIC: int ex_resize __P((SCR *, EXCMD *));
 */
int
ex_resize(sp, cmdp)
	SCR *sp;
	EXCMD *cmdp;
{
	adj_t adj;

	switch (FL_ISSET(cmdp->iflags,
	    E_C_COUNT | E_C_COUNT_NEG | E_C_COUNT_POS)) {
	case E_C_COUNT:
		adj = A_SET;
		break;
	case E_C_COUNT | E_C_COUNT_NEG:
		adj = A_DECREASE;
		break;
	case E_C_COUNT | E_C_COUNT_POS:
		adj = A_INCREASE;
		break;
	default:
		ex_emsg(sp, cmdp->cmd->usage, EXM_USAGE);
		return (1);
	}
	return (vs_resize(sp, cmdp->count, adj));
}

/*
 * ex_sdisplay --
 *	Display the list of screens.
 *
 * PUBLIC: int ex_sdisplay __P((SCR *));
 */
int
ex_sdisplay(sp)
	SCR *sp;
{
	GS *gp;
	SCR *tsp;
	int cnt, col, len, sep;

	gp = sp->gp;
	if ((tsp = gp->hq.cqh_first) == (void *)&gp->hq) {
		msgq(sp, M_INFO, "149|No background screens to display");
		return (0);
	}

	col = len = sep = 0;
	for (cnt = 1; tsp != (void *)&gp->hq && !INTERRUPTED(sp);
	    tsp = tsp->q.cqe_next) {
		col += len = strlen(tsp->frp->name) + sep;
		if (col >= sp->cols - 1) {
			col = len;
			sep = 0;
			(void)ex_puts(sp, "\n");
		} else if (cnt != 1) {
			sep = 1;
			(void)ex_puts(sp, " ");
		}
		(void)ex_puts(sp, tsp->frp->name);
		++cnt;
	}
	if (!INTERRUPTED(sp))
		(void)ex_puts(sp, "\n");
	return (0);
}
@


1.10
log
@Fix the RCSID's to be $NetBSD$ instead of $NetBSD
@
text
@d1 1
a1 1
/*	$NetBSD: ex_screen.c,v 1.9 2002/04/09 01:47:33 thorpej Exp $	*/
d19 1
a19 1
__RCSID("$NetBSD$");
@


1.9
log
@Use __RCSID() and __COPYRIGHT().
@
text
@d1 1
a1 1
/*	$NetBSD: ex_screen.c,v 1.8 2001/03/31 11:37:50 aymeric Exp $	*/
d19 1
a19 1
__RCSID("$NetBSD");
@


1.9.6.1
log
@Pull up revision 1.10 (requested by aymeric in ticket #1195):
Fix the RCSID's to be $NetBSD$ instead of $NetBSD
@
text
@d1 1
a1 1
/*	$NetBSD: ex_screen.c,v 1.9 2002/04/09 01:47:33 thorpej Exp $	*/
d19 1
a19 1
__RCSID("$NetBSD$");
@


1.9.4.1
log
@Fix the RCSID's to be $NetBSD$ instead of $NetBSD
@
text
@d1 1
a1 1
/*	$NetBSD: ex_screen.c,v 1.9 2002/04/09 01:47:33 thorpej Exp $	*/
d19 1
a19 1
__RCSID("$NetBSD$");
@


1.9.4.2
log
@Backout previous. Sorry.
@
text
@d19 1
a19 1
__RCSID("$NetBSD");
@


1.8
log
@merge changes after import of nvi 1.79
@
text
@d1 1
a1 1
/*	$NetBSD: ex_screen.c,v 1.7 1998/01/09 08:08:00 perry Exp $	*/
d14 1
d16 1
d18 3
@


1.7
log
@RCS Id Police.
@
text
@d1 1
a1 1
/*	$NetBSD$	*/
d15 1
a15 1
static const char sccsid[] = "@@(#)ex_screen.c	10.10 (Berkeley) 3/6/96";
d56 13
a68 1
	return (vs_fg(sp, cmdp->argc ? cmdp->argv[0]->bp : NULL));
@


1.6
log
@merge in nvi 1.66
@
text
@d1 2
@


1.5
log
@clean up import.
@
text
@d4 2
d7 1
a7 27
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the University of
 *	California, Berkeley and its contributors.
 * 4. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
d10 2
d13 1
a13 1
static char sccsid[] = "@@(#)ex_screen.c	8.15 (Berkeley) 8/17/94";
a21 1
#include <signal.h>
a24 5
#include <termios.h>

#include "compat.h"
#include <db.h>
#include <regex.h>
d26 2
a27 15
#include "vi.h"
#include "excmd.h"

/*
 * ex_split --	:s[plit] [file ...]
 *	Split the screen, optionally setting the file list.
 */
int
ex_split(sp, ep, cmdp)
	SCR *sp;
	EXF *ep;
	EXCMDARG *cmdp;
{
	return (sp->s_split(sp, cmdp->argc ? cmdp->argv : NULL, cmdp->argc));
}
d32 2
d36 1
a36 1
ex_bg(sp, ep, cmdp)
d38 1
a38 2
	EXF *ep;
	EXCMDARG *cmdp;
d40 1
a40 1
	return (sp->s_bg(sp));
d46 2
d50 1
a50 1
ex_fg(sp, ep, cmdp)
d52 1
a52 2
	EXF *ep;
	EXCMDARG *cmdp;
d54 1
a54 1
	return (sp->s_fg(sp, cmdp->argc ? cmdp->argv[0]->bp : NULL));
d60 2
d64 1
a64 1
ex_resize(sp, ep, cmdp)
d66 1
a66 2
	EXF *ep;
	EXCMDARG *cmdp;
d68 1
a68 1
	enum adjust adj;
d70 13
a82 2
	if (!F_ISSET(cmdp, E_COUNT)) {
		msgq(sp, M_ERR, "Usage: %s", cmdp->cmd->usage);
d85 1
a85 7
	if (F_ISSET(cmdp, E_COUNT_NEG))
		adj = A_DECREASE;
	else if (F_ISSET(cmdp, E_COUNT_POS))
		adj = A_INCREASE;
	else
		adj = A_SET;
	return (sp->s_rabs(sp, cmdp->count, adj));
d91 2
d95 1
a95 1
ex_sdisplay(sp, ep)
a96 1
	EXF *ep;
d98 1
d102 3
a104 3
	if ((tsp = sp->gp->hq.cqh_first) == (void *)&sp->gp->hq) {
		(void)ex_printf(EXCOOKIE,
		    "No backgrounded screens to display.\n");
d109 2
a110 1
	for (cnt = 1; tsp != (void *)&sp->gp->hq; tsp = tsp->q.cqe_next) {
d115 1
a115 1
			(void)ex_printf(EXCOOKIE, "\n");
d118 1
a118 1
			(void)ex_printf(EXCOOKIE, " ");
d120 1
a120 1
		(void)ex_printf(EXCOOKIE, "%s", tsp->frp->name);
d123 2
a124 1
	(void)ex_printf(EXCOOKIE, "\n");
@


1.5.2.1
log
@file ex_screen.c was added on branch netbsd-1-0 on 1994-08-17 20:12:50 +0000
@
text
@d1 155
@


1.5.2.2
log
@clean up import.
@
text
@a0 155
/*-
 * Copyright (c) 1993, 1994
 *	The Regents of the University of California.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the University of
 *	California, Berkeley and its contributors.
 * 4. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#ifndef lint
static char sccsid[] = "@@(#)ex_screen.c	8.15 (Berkeley) 8/17/94";
#endif /* not lint */

#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

#include <bitstring.h>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>

#include "compat.h"
#include <db.h>
#include <regex.h>

#include "vi.h"
#include "excmd.h"

/*
 * ex_split --	:s[plit] [file ...]
 *	Split the screen, optionally setting the file list.
 */
int
ex_split(sp, ep, cmdp)
	SCR *sp;
	EXF *ep;
	EXCMDARG *cmdp;
{
	return (sp->s_split(sp, cmdp->argc ? cmdp->argv : NULL, cmdp->argc));
}

/*
 * ex_bg --	:bg
 *	Hide the screen.
 */
int
ex_bg(sp, ep, cmdp)
	SCR *sp;
	EXF *ep;
	EXCMDARG *cmdp;
{
	return (sp->s_bg(sp));
}

/*
 * ex_fg --	:fg [file]
 *	Show the screen.
 */
int
ex_fg(sp, ep, cmdp)
	SCR *sp;
	EXF *ep;
	EXCMDARG *cmdp;
{
	return (sp->s_fg(sp, cmdp->argc ? cmdp->argv[0]->bp : NULL));
}

/*
 * ex_resize --	:resize [+-]rows
 *	Change the screen size.
 */
int
ex_resize(sp, ep, cmdp)
	SCR *sp;
	EXF *ep;
	EXCMDARG *cmdp;
{
	enum adjust adj;

	if (!F_ISSET(cmdp, E_COUNT)) {
		msgq(sp, M_ERR, "Usage: %s", cmdp->cmd->usage);
		return (1);
	}
	if (F_ISSET(cmdp, E_COUNT_NEG))
		adj = A_DECREASE;
	else if (F_ISSET(cmdp, E_COUNT_POS))
		adj = A_INCREASE;
	else
		adj = A_SET;
	return (sp->s_rabs(sp, cmdp->count, adj));
}

/*
 * ex_sdisplay --
 *	Display the list of screens.
 */
int
ex_sdisplay(sp, ep)
	SCR *sp;
	EXF *ep;
{
	SCR *tsp;
	int cnt, col, len, sep;

	if ((tsp = sp->gp->hq.cqh_first) == (void *)&sp->gp->hq) {
		(void)ex_printf(EXCOOKIE,
		    "No backgrounded screens to display.\n");
		return (0);
	}

	col = len = sep = 0;
	for (cnt = 1; tsp != (void *)&sp->gp->hq; tsp = tsp->q.cqe_next) {
		col += len = strlen(tsp->frp->name) + sep;
		if (col >= sp->cols - 1) {
			col = len;
			sep = 0;
			(void)ex_printf(EXCOOKIE, "\n");
		} else if (cnt != 1) {
			sep = 1;
			(void)ex_printf(EXCOOKIE, " ");
		}
		(void)ex_printf(EXCOOKIE, "%s", tsp->frp->name);
		++cnt;
	}
	(void)ex_printf(EXCOOKIE, "\n");
	return (0);
}
@


1.4
log
@clean up import.  still have to hack some things.
@
text
@d35 1
a35 1
static const char sccsid[] = "@@(#)ex_screen.c	8.14 (Berkeley) 8/17/94";
@


1.3
log
@nvi 1.11(beta) from bostic.  reconcile conflicts/kill rcsids.
@
text
@d35 1
a35 1
static char sccsid[] = "@@(#)ex_screen.c	8.12 (Berkeley) 3/8/94";
d67 1
a67 1
	return (sp->s_split(sp, cmdp->argc ? cmdp->argv : NULL));
d141 1
a141 1
		col += len = strlen(FILENAME(tsp->frp)) + sep;
d150 1
a150 1
		(void)ex_printf(EXCOOKIE, "%s", FILENAME(tsp->frp));
@


1.2
log
@more Ids than you'll ever want.
@
text
@d2 1
a2 1
 * Copyright (c) 1993
d35 1
a35 2
/* from: static char sccsid[] = "@@(#)ex_screen.c	8.10 (Berkeley) 12/2/93"; */
static char *rcsid = "$Id$";
d39 2
d42 4
d48 5
d97 1
a97 1
 * ex_resize --	:resize [change]
d106 13
a118 3
	if (!F_ISSET(cmdp, E_COUNT))
		cmdp->count = 1;
	return (sp->s_rabs(sp, cmdp->count));
@


1.1
log
@Initial revision
@
text
@d35 2
a36 1
static char sccsid[] = "@@(#)ex_screen.c	8.10 (Berkeley) 12/2/93";
@


1.1.1.1
log
@nvi 1.03, from ftp.cs.berkeley.edu, per keith bostic's permission.
@
text
@@


1.1.1.2
log
@nvi/nex 1.11beta from bostic.
@
text
@d2 1
a2 1
 * Copyright (c) 1993, 1994
d35 1
a35 1
static char sccsid[] = "@@(#)ex_screen.c	8.12 (Berkeley) 3/8/94";
a38 2
#include <sys/queue.h>
#include <sys/time.h>
a39 4
#include <bitstring.h>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
a41 5
#include <termios.h>

#include "compat.h"
#include <db.h>
#include <regex.h>
d86 1
a86 1
 * ex_resize --	:resize [+-]rows
d95 3
a97 13
	enum adjust adj;

	if (!F_ISSET(cmdp, E_COUNT)) {
		msgq(sp, M_ERR, "Usage: %s", cmdp->cmd->usage);
		return (1);
	}
	if (F_ISSET(cmdp, E_COUNT_NEG))
		adj = A_DECREASE;
	else if (F_ISSET(cmdp, E_COUNT_POS))
		adj = A_INCREASE;
	else
		adj = A_SET;
	return (sp->s_rabs(sp, cmdp->count, adj));
@


1.1.1.3
log
@new public version of nvi
@
text
@d35 1
a35 1
static const char sccsid[] = "@@(#)ex_screen.c	8.14 (Berkeley) 8/17/94";
d67 1
a67 1
	return (sp->s_split(sp, cmdp->argc ? cmdp->argv : NULL, cmdp->argc));
d141 1
a141 1
		col += len = strlen(tsp->frp->name) + sep;
d150 1
a150 1
		(void)ex_printf(EXCOOKIE, "%s", tsp->frp->name);
@


1.1.1.4
log
@new public version of nvi
@
text
@d35 1
a35 1
static char sccsid[] = "@@(#)ex_screen.c	8.15 (Berkeley) 8/17/94";
@


1.1.1.5
log
@import of nvi 1.66
@
text
@a3 2
 * Copyright (c) 1993, 1994, 1995, 1996
 *	Keith Bostic.  All rights reserved.
d5 27
a31 1
 * See the LICENSE file for redistribution information.
a33 2
#include "config.h"

d35 1
a35 1
static const char sccsid[] = "@@(#)ex_screen.c	10.10 (Berkeley) 3/6/96";
d44 1
d48 5
d54 15
a68 2
#include "../common/common.h"
#include "../vi/vi.h"
a72 2
 *
 * PUBLIC: int ex_bg __P((SCR *, EXCMD *));
d75 1
a75 1
ex_bg(sp, cmdp)
d77 2
a78 1
	EXCMD *cmdp;
d80 1
a80 1
	return (vs_bg(sp));
a85 2
 *
 * PUBLIC: int ex_fg __P((SCR *, EXCMD *));
d88 1
a88 1
ex_fg(sp, cmdp)
d90 2
a91 1
	EXCMD *cmdp;
d93 1
a93 1
	return (vs_fg(sp, cmdp->argc ? cmdp->argv[0]->bp : NULL));
a98 2
 *
 * PUBLIC: int ex_resize __P((SCR *, EXCMD *));
d101 1
a101 1
ex_resize(sp, cmdp)
d103 2
a104 1
	EXCMD *cmdp;
d106 1
a106 1
	adj_t adj;
d108 5
a112 6
	switch (FL_ISSET(cmdp->iflags,
	    E_C_COUNT | E_C_COUNT_NEG | E_C_COUNT_POS)) {
	case E_C_COUNT:
		adj = A_SET;
		break;
	case E_C_COUNT | E_C_COUNT_NEG:
d114 1
a114 2
		break;
	case E_C_COUNT | E_C_COUNT_POS:
d116 3
a118 6
		break;
	default:
		ex_emsg(sp, cmdp->cmd->usage, EXM_USAGE);
		return (1);
	}
	return (vs_resize(sp, cmdp->count, adj));
a123 2
 *
 * PUBLIC: int ex_sdisplay __P((SCR *));
d126 1
a126 1
ex_sdisplay(sp)
d128 1
a129 1
	GS *gp;
d133 3
a135 3
	gp = sp->gp;
	if ((tsp = gp->hq.cqh_first) == (void *)&gp->hq) {
		msgq(sp, M_INFO, "149|No background screens to display");
d140 1
a140 2
	for (cnt = 1; tsp != (void *)&gp->hq && !INTERRUPTED(sp);
	    tsp = tsp->q.cqe_next) {
d145 1
a145 1
			(void)ex_puts(sp, "\n");
d148 1
a148 1
			(void)ex_puts(sp, " ");
d150 1
a150 1
		(void)ex_puts(sp, tsp->frp->name);
d153 1
a153 2
	if (!INTERRUPTED(sp))
		(void)ex_puts(sp, "\n");
@


1.1.1.6
log
@import of nvi 1.79
@
text
@d13 1
a13 1
static const char sccsid[] = "@@(#)ex_screen.c	10.11 (Berkeley) 6/29/96";
d54 1
a54 13
	SCR *nsp;
	int newscreen;

	newscreen = F_ISSET(cmdp, E_NEWSCREEN);
	if (vs_fg(sp, &nsp, cmdp->argc ? cmdp->argv[0]->bp : NULL, newscreen))
		return (1);

	/* Set up the switch. */
	if (newscreen) {
		sp->nextdisp = nsp;
		F_SET(sp, SC_SSWITCH);
	}
	return (0);
@

