update copyright notice
[unix-history] / usr / src / usr.bin / more / linenum.c
index 909adc3..1a5a5ec 100644 (file)
@@ -3,15 +3,13 @@
  * Copyright (c) 1988 Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1988 Regents of the University of California.
  * All rights reserved.
  *
- * This code is derived from software contributed to Berkeley by
- * Mark Nudleman.
- * 
  * Redistribution and use in source and binary forms are permitted
  * provided that the above copyright notice and this paragraph are
  * duplicated in all such forms and that any documentation,
  * advertising materials, and other materials related to such
  * distribution and use acknowledge that the software was developed
  * Redistribution and use in source and binary forms are permitted
  * provided that the above copyright notice and this paragraph are
  * duplicated in all such forms and that any documentation,
  * advertising materials, and other materials related to such
  * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
+ * by Mark Nudleman and the University of California, Berkeley.  The
+ * name of Mark Nudleman or the
  * University may not be used to endorse or promote products derived
  * from this software without specific prior written permission.
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  * University may not be used to endorse or promote products derived
  * from this software without specific prior written permission.
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
@@ -20,7 +18,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)linenum.c  5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)linenum.c  5.4 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -248,9 +246,7 @@ find_linenum(pos)
        register int lno;
        register int loopcount;
        POSITION cpos;
        register int lno;
        register int loopcount;
        POSITION cpos;
-#if GET_TIME
        long startime;
        long startime;
-#endif
 
        if (!linenums)
                /*
 
        if (!linenums)
                /*
@@ -289,9 +285,7 @@ find_linenum(pos)
         * traversing fewer bytes in the file.
         */
        flush();
         * traversing fewer bytes in the file.
         */
        flush();
-#if GET_TIME
        startime = get_time();
        startime = get_time();
-#endif
        if (p == &anchor || pos - p->prev->pos < p->pos - pos)
        {
                /*
        if (p == &anchor || pos - p->prev->pos < p->pos - pos)
        {
                /*
@@ -309,7 +303,6 @@ find_linenum(pos)
                        cpos = forw_raw_line(cpos);
                        if (sigs || cpos == NULL_POSITION)
                                return (0);
                        cpos = forw_raw_line(cpos);
                        if (sigs || cpos == NULL_POSITION)
                                return (0);
-#if GET_TIME
                        if (loopcount >= 0 && ++loopcount > 100)
                        {
                                loopcount = 0;
                        if (loopcount >= 0 && ++loopcount > 100)
                        {
                                loopcount = 0;
@@ -319,13 +312,6 @@ find_linenum(pos)
                                        loopcount = -1;
                                }
                        }
                                        loopcount = -1;
                                }
                        }
-#else
-                       if (loopcount >= 0 && ++loopcount > LONGLOOP)
-                       {
-                               longloopmessage();
-                               loopcount = -1;
-                       }
-#endif
                }
                lnloop = 0;
                /*
                }
                lnloop = 0;
                /*
@@ -350,7 +336,6 @@ find_linenum(pos)
                        cpos = back_raw_line(cpos);
                        if (sigs || cpos == NULL_POSITION)
                                return (0);
                        cpos = back_raw_line(cpos);
                        if (sigs || cpos == NULL_POSITION)
                                return (0);
-#if GET_TIME
                        if (loopcount >= 0 && ++loopcount > 100)
                        {
                                loopcount = 0;
                        if (loopcount >= 0 && ++loopcount > 100)
                        {
                                loopcount = 0;
@@ -360,13 +345,6 @@ find_linenum(pos)
                                        loopcount = -1;
                                }
                        }
                                        loopcount = -1;
                                }
                        }
-#else
-                       if (loopcount >= 0 && ++loopcount > LONGLOOP)
-                       {
-                               longloopmessage();
-                               loopcount = -1;
-                       }
-#endif
                }
                lnloop = 0;
        }
                }
                lnloop = 0;
        }
@@ -405,7 +383,7 @@ debug()
        clear_eol();
        for (p = anchor.next;  p != &anchor;  p = p->next)
        {
        clear_eol();
        for (p = anchor.next;  p != &anchor;  p = p->next)
        {
-               sprintf(buf, "%d-%d ", p->line, p->pos);
+               (void)sprintf(buf, "%d-%d ", p->line, p->pos);
                putstr(buf);
        }
        putstr("\n");
                putstr(buf);
        }
        putstr("\n");