Subversion Repositories wimsdev

Rev

Rev 8185 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8185 Rev 12248
Line 30... Line 30...
30
char wbuf[MAX_WORDLEN+1];
30
char wbuf[MAX_WORDLEN+1];
31
char selbuf[256];
31
char selbuf[256];
32
 
32
 
33
int getword(void)
33
int getword(void)
34
{
34
{
35
    int t,c;
35
  int t,c;
36
 
36
 
37
    do c=getchar(); while(isspace(c));
37
  do c=getchar(); while(isspace(c));
38
    for(t=0; t<MAX_WORDLEN && isalnum(c); t++, c=getchar()) wbuf[t]=c;
38
  for(t=0; t<MAX_WORDLEN && isalnum(c); t++, c=getchar()) wbuf[t]=c;
39
    wbuf[t]=0; return c;
39
  wbuf[t]=0; return c;
40
}
40
}
41
 
41
 
42
void checkword(void)
42
void checkword(void)
43
{
43
{
44
    char sbuf[256];
44
  char sbuf[256];
45
    char *p, *pt;
45
  char *p, *pt;
46
    memmove(sbuf,selbuf,sizeof(sbuf));
46
  memmove(sbuf,selbuf,sizeof(sbuf));
47
    for(p=wbuf; *p; p++) {
47
  for(p=wbuf; *p; p++) {
48
      pt=strchr(sbuf,*p); if(pt==NULL) return;
48
    pt=strchr(sbuf,*p); if(pt==NULL) return;
49
      else *pt=' ';
49
    else *pt=' ';
50
    }
50
  }
51
    printf("%s\n",wbuf);
51
  printf("%s\n",wbuf);
52
}
52
}
53
 
53
 
54
int main(int argc, char *argv[])
54
int main(int argc, char *argv[])
55
{
55
{
56
    int c;
56
  int c;
57
    char *p;
57
  char *p;
58
 
58
 
59
    p=getenv("oncechar"); if(p==NULL || *p==0) return 0;
59
  p=getenv("oncechar"); if(p==NULL || *p==0) return 0;
60
    snprintf(selbuf,sizeof(selbuf),"%s",p);
60
  snprintf(selbuf,sizeof(selbuf),"%s",p);
61
    for(p=selbuf; *p; p++)
61
  for(p=selbuf; *p; p++)
62
      if(isspace(*p) || strchr("^?*.${}[]()\\",*p)!=NULL) ovlstrcpy(p,p+1);
62
    if(isspace(*p) || strchr("^?*.${}[]()\\",*p)!=NULL) ovlstrcpy(p,p+1);
63
    do{
63
  do{
64
      c=getword(); checkword();
64
    c=getword(); checkword();
65
    }
65
  }
66
    while(c!=EOF);
66
  while(c!=EOF);
67
    return 0;
67
  return 0;
68
}
68
}
69
 
69