view 3rdparty/packages/ed/getptr.c @ 1124:c2b85c18a13a

Makefiles now use os9 attr
author boisy
date Sun, 13 Apr 2003 22:26:31 +0000
parents bef1844de0dc
children
line wrap: on
line source

/*      getptr.c        */
#include <stdio.h>
#include "tools.h"
#include "ed.h"

LINE *
 getptr(num)
int num;
{
  LINE *ptr;
  int j;

  if (2 * num > lastln && num <= lastln) {      /* high line numbers */
        ptr = line0.l_prev;
        for (j = lastln; j > num; j--) ptr = ptr->l_prev;
  } else {                      /* low line numbers */
        ptr = &line0;
        for (j = 0; j < num; j++) ptr = ptr->l_next;
  }
  return(ptr);
}