view 3rdparty/packages/ed/optpat.c @ 1540:dbc5e82a3127

Updated rbfdefs in correct version -- thanks Rodney!
author boisy
date Thu, 22 Apr 2004 12:04:42 +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);
}