157678Sbostic /*- 257678Sbostic * Copyright (c) 1992 The Regents of the University of California. 357678Sbostic * All rights reserved. 457678Sbostic * 557678Sbostic * This code is derived from software contributed to Berkeley by 657678Sbostic * Rodney Ruddock of the University of Guelph. 757678Sbostic * 857678Sbostic * %sccs.include.redist.c% 957678Sbostic */ 1057678Sbostic 1157678Sbostic #ifndef lint 12*57710Sbostic static char sccsid[] = "@(#)c.c 5.2 (Berkeley) 01/23/93"; 1357678Sbostic #endif /* not lint */ 1457678Sbostic 15*57710Sbostic #include <sys/types.h> 16*57710Sbostic 17*57710Sbostic #include <db.h> 18*57710Sbostic #include <regex.h> 19*57710Sbostic #include <setjmp.h> 20*57710Sbostic #include <stdio.h> 21*57710Sbostic 2257678Sbostic #include "ed.h" 23*57710Sbostic #include "extern.h" 2457678Sbostic 2557678Sbostic /* 2657678Sbostic * This deletes the range of lines specified and then sets up things 2757678Sbostic * for the central input routine. 2857678Sbostic */ 2957678Sbostic 3057678Sbostic void 3157678Sbostic c(inputt, errnum) 32*57710Sbostic FILE *inputt; 33*57710Sbostic int *errnum; 3457678Sbostic { 35*57710Sbostic if (start_default && End_default) 36*57710Sbostic start = End = current; 37*57710Sbostic else 38*57710Sbostic if (start_default) 39*57710Sbostic start = End; 40*57710Sbostic if (start == NULL) { 41*57710Sbostic *errnum = -1; 42*57710Sbostic return; 43*57710Sbostic } 44*57710Sbostic start_default = End_default = 0; 4557678Sbostic 46*57710Sbostic /* first delete the lines */ 47*57710Sbostic d(inputt, errnum); 48*57710Sbostic if (*errnum < 0) 49*57710Sbostic return; 50*57710Sbostic *errnum = 0; 5157678Sbostic 52*57710Sbostic if ((current != NULL) && (current != bottom)) 53*57710Sbostic current = current->above; 54*57710Sbostic if (sigint_flag) 55*57710Sbostic SIGINT_ACTION; 56*57710Sbostic add_flag = 1; 57*57710Sbostic start_default = End_default = 1; 58*57710Sbostic /* now get the "change" lines */ 59*57710Sbostic input_lines(inputt, errnum); 60*57710Sbostic add_flag = 0; 61*57710Sbostic } 62