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[] = "@(#)i.c 5.2 (Berkeley) 01/23/93"; 13 #endif /* not lint */ 14 15 #include <sys/types.h> 16 17 #include <db.h> 18 #include <regex.h> 19 #include <setjmp.h> 20 #include <stdio.h> 21 #include <string.h> 22 23 #include "ed.h" 24 #include "extern.h" 25 26 /* 27 * Set things up for the central input routine to correctly place 28 * the text as per the insert command. 29 */ 30 void 31 i(inputt, errnum) 32 FILE *inputt; 33 int *errnum; 34 { 35 #ifdef POSIX 36 LINE *l_address; 37 #endif 38 39 if ((End_default == 1) && (current != NULL)) 40 start = End = current->above; 41 else { 42 if (End == NULL) { 43 strcpy(help_msg, "illegal address for command i"); 44 *errnum = -1; 45 return; 46 } else 47 End = End->above; 48 } 49 start_default = End_default = 0; 50 #ifdef POSIX 51 l_address = End; 52 #endif 53 54 if (sigint_flag) 55 SIGINT_ACTION; 56 /* 57 * 'i' is just a variation on 'a': completely true with BSD; with 58 * POSIX we have to fake the location of "current" in a special case. 59 */ 60 a(inputt, errnum); 61 #ifdef POSIX 62 if (l_address->above) 63 current = l_address->below; 64 #endif 65 } 66