Back to index

wims  3.65+svn20090927
Defines | Functions | Variables
oncechar.c File Reference
#include "../wims.h"

Go to the source code of this file.

Defines

#define MAX_WORDLEN   1023

Functions

int getword (void)
void checkword (void)
int main (int argc, char *argv[])

Variables

char wbuf [MAX_WORDLEN+1]
char selbuf [256]

Define Documentation

#define MAX_WORDLEN   1023

Definition at line 26 of file oncechar.c.


Function Documentation

void checkword ( void  )

Definition at line 40 of file oncechar.c.

{
    char sbuf[256];
    char *p, *pt;
    memmove(sbuf,selbuf,sizeof(sbuf));
    for(p=wbuf; *p; p++) {
       pt=strchr(sbuf,*p); if(pt==NULL) return;
       else *pt=' ';
    }
    printf("%s\n",wbuf);
}

Here is the caller graph for this function:

int getword ( void  )

Definition at line 31 of file oncechar.c.

{
    int t,c;
    
    do c=getchar(); while(isspace(c));
    for(t=0; t<MAX_WORDLEN && isalnum(c); t++, c=getchar()) wbuf[t]=c;
    wbuf[t]=0; return c;    
}

Here is the caller graph for this function:

int main ( int  argc,
char *  argv[] 
)

Definition at line 52 of file oncechar.c.

{
    int c;
    char *p;
    
    p=getenv("oncechar"); if(p==NULL || *p==0) return 0;
    snprintf(selbuf,sizeof(selbuf),"%s",p);
    for(p=selbuf; *p; p++) 
      if(isspace(*p) || strchr("^?*.${}[]()\\",*p)!=NULL) strcpy(p,p+1);
    do{
       c=getword(); checkword();
    }
    while(c!=EOF);
    return 0;
}

Here is the call graph for this function:


Variable Documentation

char selbuf[256]

Definition at line 29 of file oncechar.c.

char wbuf[MAX_WORDLEN+1]

Definition at line 28 of file oncechar.c.