view 3rdparty/packages/ed/optpat.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

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

TOKEN *oldpat;

TOKEN *
 optpat()
{
  char delim, str[MAXPAT], *cp;

  delim = *inptr++;
  cp = str;
  while (*inptr != delim && *inptr != NL) {
        if (*inptr == ESCAPE && inptr[1] != NL) *cp++ = *inptr++;
        *cp++ = *inptr++;
  }

  *cp = EOS;
  if (*str == EOS) return(oldpat);
  if (oldpat) unmakepat(oldpat);
  oldpat = getpat(str);
  return(oldpat);
}