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[] = "@(#)line_number.c 5.1 (Berkeley) 01/23/93"; 13 #endif /* not lint */ 14 15 #include "ed.h" 16 17 /* 18 * Converts a LINE to a line number (int) that can be printed to 19 * the device the user is at. Used by n. 20 */ 21 22 int 23 line_number(line_addr) 24 25 LINE *line_addr; 26 27 { 28 int l_cnt=1; /* yes! =1 */ 29 LINE *l_temp1; 30 31 l_temp1 = top; 32 if ((line_addr == NULL) && (top == NULL)) 33 return(0); 34 35 while (1) 36 { 37 if (sigint_flag) 38 SIGINT_ACTION; 39 if (line_addr == l_temp1) 40 break; 41 l_temp1 = l_temp1->below; 42 l_cnt++; 43 } /* end-while */ 44 return(l_cnt); 45 } /* end-line_number */ 46