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