xref: /csrg-svn/contrib/ed/c.c (revision 57678)
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
12 static char sccsid[] = "@(#)c.c	5.1 (Berkeley) 01/23/93";
13 #endif /* not lint */
14 
15 #include "ed.h"
16 
17 /*
18  * This deletes the range of lines specified and then sets up things
19  * for the central input routine.
20  */
21 
22 void
23 c(inputt, errnum)
24 
25 FILE *inputt;
26 int *errnum;
27 
28 {
29 
30   if (start_default && End_default)
31     start = End = current;
32   else if (start_default)
33     start = End;
34   if (start == NULL)
35     {
36       *errnum = -1;
37       return;
38     }
39   start_default = End_default = 0;
40 
41   /* first delete the lines */
42   d(inputt, errnum);
43   if (*errnum < 0)
44       return;
45   *errnum = 0;
46 
47   if ((current != NULL) && (current != bottom))
48     current = current->above;
49   if (sigint_flag)
50     SIGINT_ACTION;
51   add_flag = 1;
52   start_default = End_default = 1;
53   /* now get the "change" lines */
54   input_lines(inputt, errnum);
55   add_flag = 0;
56 } /* end-c */
57