view 3rdparty/packages/ed/optpat.c @ 2216:d096a278e068

Added info targets
author boisy
date Tue, 17 Mar 2009 02:52:57 +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);
}