view 3rdparty/packages/ed/ckglob.c @ 2868:cfa46960b6bd

makefiles: Rename DW3 to DW all over Rename dw3*.sb to dwio*.sb This is part of getting default and lwtools-port branches together, trying to avoid things falling through the cracks.
author Tormod Volden <debian.tormod@gmail.com>
date Sun, 24 Nov 2013 11:13:40 +0100
parents bef1844de0dc
children
line wrap: on
line source

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

int ckglob()
{
  TOKEN *glbpat;
  char c, delim;
  char lin[MAXLINE];
  int num;
  LINE *ptr;

  c = *inptr;

  if (c != 'g' && c != 'v') return(0);

  if (deflt(1, lastln) < 0) return(ERR);

  delim = *++inptr;
  if (delim <= ' ') return(ERR);

  glbpat = optpat();

  if (*inptr == delim) inptr++;

  ptr = getptr(1);
  for (num = 1; num <= lastln; num++) {
        ptr->l_stat &= ~LGLOB;
        if (line1 <= num && num <= line2) {
                strcpy(lin, ptr->l_buff);
                strcat(lin, "\n");
                if (matchs(lin, glbpat, 0)) {
                        if (c == 'g') ptr->l_stat |= LGLOB;
                } else {
                        if (c == 'v') ptr->l_stat |= LGLOB;
                }
        }
        ptr = ptr->l_next;
  }
  return(1);
}