view 3rdparty/packages/ed/getptr.c @ 1427:b3868abe1fee

Rearrangement of directories and files for making bootable 6809/6309 MV disks
author boisy
date Tue, 02 Dec 2003 22:35:55 +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);
}