date and time created 93/05/11 11:53:22 by bostic
[unix-history] / usr / src / contrib / ed / c.c
CommitLineData
5496c33f
KB
1/*-
2 * Copyright (c) 1992 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Rodney Ruddock of the University of Guelph.
7 *
8 * %sccs.include.redist.c%
9 */
10
11#ifndef lint
035e94f8 12static char sccsid[] = "@(#)c.c 5.4 (Berkeley) %G%";
5496c33f
KB
13#endif /* not lint */
14
ecbf4ad0
KB
15#include <sys/types.h>
16
ecbf4ad0
KB
17#include <regex.h>
18#include <setjmp.h>
19#include <stdio.h>
20
e692f66f
KB
21#ifdef DBI
22#include <db.h>
23#endif
24
5496c33f 25#include "ed.h"
ecbf4ad0 26#include "extern.h"
5496c33f
KB
27
28/*
29 * This deletes the range of lines specified and then sets up things
30 * for the central input routine.
31 */
32
33void
34c(inputt, errnum)
ecbf4ad0
KB
35 FILE *inputt;
36 int *errnum;
5496c33f 37{
035e94f8
RC
38 if (Start_default && End_default)
39 Start = End = current;
ecbf4ad0 40 else
035e94f8
RC
41 if (Start_default)
42 Start = End;
43 if (Start == NULL) {
ecbf4ad0
KB
44 *errnum = -1;
45 return;
46 }
035e94f8 47 Start_default = End_default = 0;
ecbf4ad0
KB
48
49 /* first delete the lines */
50 d(inputt, errnum);
51 if (*errnum < 0)
52 return;
53 *errnum = 0;
54
55 if ((current != NULL) && (current != bottom))
56 current = current->above;
ecbf4ad0 57 add_flag = 1;
035e94f8 58 Start_default = End_default = 1;
ecbf4ad0
KB
59 /* now get the "change" lines */
60 input_lines(inputt, errnum);
61 add_flag = 0;
62}