Back to index

wims  3.65+svn20090927
Defines | Functions | Variables
lines.c File Reference
#include <stdarg.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define int_buf_size   40

Functions

char * int2str (int i)
void * xmalloc (size_t n)
int msleep (int ms)
void _tolinux (char *p)
void mystrncpy (char *dest, char *src, int lim)
char * find_matching (char *p, char c)
char * find_word_end (char *p)
char * find_word_start (char *p)
char * strparchr (char *p, char c)
char * strparstr (char *p, char *fnd)
char * find_item_end (char *p)
char * find_line_end (char *p)
char * charchr (char *p, char *w)
char * wordchr (char *p, char *w)
char * itemchr (char *p, char *w)
char * linechr (char *p, char *w)
char * varchr (char *p, char *v)
int _cutit_ (char *p, char *list[], int max, char *end_finder(char *pt), int tag)
int cutitems (char *p, char *list[], int max)
int cutwords (char *p, char *list[], int max)
int cutlines (char *p, char *list[], int max)
int cutchars (char *p, char *list[], int max)
char * strip_trailing_spaces (char *p)
int verify_order (void *list, int items, size_t item_size)
int search_list (void *list, int items, size_t item_size, const char *str)
unsigned int linenum (char *p)
unsigned int itemnum (char *p)
unsigned int wordnum (char *p)
unsigned int charnum (char *p)
char * fnd_line (char *p, int n, char bf[])
char * fnd_item (char *p, int n, char bf[])
char * fnd_word (char *p, int n, char bf[])
char * fnd_char (char *p, int n, char bf[])
int rows2lines (char *p)
void lines2rows (char *p)
unsigned int rownum (char *p)
char * fnd_row (char *p, int n, char bf[])
char * memstr (char *s1, char *s2, int len)
int check_parentheses (char *p, int style)
void strip_enclosing_par (char *p)
void singlespace (char *p)
void nospace (char *p)
void _spaces2_ (char *p, char c)
void words2items (char *p)
void words2lines (char *p)
void lines2items (char *p)
void lines2words (char *p)
void items2words (char *p)
void items2lines (char *p)
void deaccent (char *p)
void reaccent (char *p)
void string_modify (char *start, char *bad_beg, char *bad_end, char *good,...)
int catfile (FILE *outf, char *fn,...)
long int filelength (char *fn,...)

Variables

char * acctab = ""
char * deatab = "ceeeeuuuuaaaaaoooooiiiinyyCEEEEUUUUAAAAAOOOOOIIIINY"
char * reaccents = "'`\"^~"
char * reaccentl = "aeiouycnAEIOUYCN"
char * reaccentab

Define Documentation

#define int_buf_size   40

Definition at line 20 of file lines.c.


Function Documentation

int _cutit_ ( char *  p,
char *  list[],
int  max,
char *  end_finderchar *pt,
int  tag 
)

Definition at line 266 of file lines.c.

{
    int i;
    char *pp, *pe, *p0;
    if(tag&1) pp=find_word_start(p); else pp=p; /* strip head space */
    for(i=0;i<max && *pp;i++) {
       pe=end_finder(pp);
       if((tag&2) && myisspace(pe[-1])) { /* strip tailing space */
           for(p0=pe; p0>pp && myisspace(p0[-1]); p0--);
           if(p0<pe) *p0=0;
       }
       if(*pe) *pe++=0;
       list[i]=pp;
       if(tag&1) pp=find_word_start(pe); else pp=pe;
    }
    return i;
}

Here is the call graph for this function:

void _spaces2_ ( char *  p,
char  c 
)

Definition at line 612 of file lines.c.

{
    char *pp; int n;
    singlespace(p);
    n=strlen(p); if(*p==' ') {memmove(p,p+1,n);n--;}
    if(n==0) return; if(p[n-1]==' ') p[n-1]=0;
    for(pp=strchr(p,' '); pp; pp=strchr(pp,' ')) *pp++=c;
}

Here is the call graph for this function:

void _tolinux ( char *  p)

Definition at line 57 of file lines.c.

{
    char *pp,*p1;
    pp=strchr(p,13); if(pp==NULL) return;
    for(p1=pp; *pp; pp++) {
       if(*pp==13) {
           if(*(pp+1)=='\n' || (pp>p && *(pp-1)=='\n') ||
              (*(pp+1)=='\\' && *(pp+2)=='\n')) continue;
           else *pp='\n';
       }
       *p1++=*pp;
    }
    *p1=0;
}

Here is the caller graph for this function:

int catfile ( FILE *  outf,
char *  fn,
  ... 
)

Definition at line 711 of file lines.c.

{
    char buf[4096];
    va_list vp;
    int l,tot,fd;
    
    tot=0;
    va_start(vp,fn);
    vsnprintf(buf,sizeof(buf),fn,vp); va_end(vp);
    fd=open(buf,O_RDONLY); if(fd==-1) return 0;
    for(l=read(fd,buf,4096);l>0 && l<=4096; l=read(fd,buf,4096)) {
       fwrite(buf,1,l,outf); tot+=l;
    }
    close(fd);
    return tot;
}

Here is the caller graph for this function:

char* charchr ( char *  p,
char *  w 
)

Definition at line 203 of file lines.c.

{
    return strchr(p,w[0]);
}

Here is the caller graph for this function:

unsigned int charnum ( char *  p)

Definition at line 396 of file lines.c.

{
    return strlen(p);
}

Here is the caller graph for this function:

int check_parentheses ( char *  p,
int  style 
)

Definition at line 528 of file lines.c.

{
    int i,j,k;
    j=strlen(p);
    if(j>=MAX_LINELEN) return 65535;
    if(style!=0) {
       char buf[MAX_LINELEN+1];
       char *pp, *pe, c;
       for(pp=p;pp<p+j;pp++) {
           switch (*pp) {
              case ')':
              case ']':
              case '}': return -1;
              case '(': c=')'; goto find;
              case '[': c=']'; goto find;
              case '{': c='}';
              find: {
                  pe=find_matching(pp+1,c);
                  if(pe==NULL) return 1;
                  memcpy(buf,pp+1,pe-pp-1);
                  buf[pe-pp-1]=0;
                  if((k=check_parentheses(buf,1))!=0) return k;
                  else pp=pe;
              }
              default: break;
           }
       }
       return 0;
    }
    for(i=k=0;i<j && k>=0;i++) {
       if(*(p+i)=='(') k++;
       if(*(p+i)==')') k--;
    }
    return k;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int cutchars ( char *  p,
char *  list[],
int  max 
)

Definition at line 299 of file lines.c.

{
    int i; char *pp;
    for(i=0,pp=p;*pp && i<max;list[i++]=pp++);
    return i;
}

Here is the call graph for this function:

int cutitems ( char *  p,
char *  list[],
int  max 
)

Definition at line 284 of file lines.c.

{
    return _cutit_(p,list,max,find_item_end,3);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int cutlines ( char *  p,
char *  list[],
int  max 
)

Definition at line 294 of file lines.c.

{
    return _cutit_(p,list,max,find_line_end,0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int cutwords ( char *  p,
char *  list[],
int  max 
)

Definition at line 289 of file lines.c.

{
    return _cutit_(find_word_start(p),list,max,find_word_end,1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void deaccent ( char *  p)

Definition at line 660 of file lines.c.

{
    signed char *sp;
    char *v;
    for(sp=p;*sp;sp++) {
       if(*sp<0 && (v=strchr(acctab,*sp))!=NULL)
         *sp=*(deatab+(v-acctab));
    }
}

Here is the caller graph for this function:

long int filelength ( char *  fn,
  ... 
)

Definition at line 729 of file lines.c.

{
    char buf[MAX_FNAME+1];
    va_list vp;
    struct stat st;
    int l;
    
    va_start(vp,fn);
    vsnprintf(buf,sizeof(buf),fn,vp); va_end(vp);
    l=stat(buf,&st); if(l) return -1;
    return st.st_size;
}

Here is the caller graph for this function:

char* find_item_end ( char *  p)

Definition at line 190 of file lines.c.

{
    return strparstr(p,",");
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* find_line_end ( char *  p)

Definition at line 196 of file lines.c.

{
    char *pp=strstr(p,"\n");
    if(pp==NULL) pp=p+strlen(p);
    return pp;
}

Here is the caller graph for this function:

char* find_matching ( char *  p,
char  c 
)

Definition at line 86 of file lines.c.

{
    char *pp;
    int parenth, brak, brace;
    if(c=='|') {
       for(pp=p;*pp!=0;pp++) {
           switch(*pp) {
              case '|': return pp;
              case '(': {
                  pp=find_matching(pp+1,')');
                  if(pp==NULL) return NULL;
                  break;
              }
              case '[': {
                  pp=find_matching(pp+1,']');
                  if(pp==NULL) return NULL;
                  break;
              }
              case '{': {
                  pp=find_matching(pp+1,'}');
                  if(pp==NULL) return NULL;
                  break;
              }
              case ')':
              case ']':
              case '}': return NULL;
              
              default: break;
           }
       }
       return NULL;
    }
    parenth=brak=brace=0;
    for(pp=p; *pp!=0; pp++) {
       switch(*pp) {
           case '[': brak++; break;
           case ']': brak--; break;
           case '(': parenth++; break;
           case ')': parenth--; break;
           case '{': brace++; break;
           case '}': brace--; break;
           default: continue;
       }
       if(parenth<0 || brak<0 || brace<0) {
           if(*pp!=c || parenth>0 || brak>0 || brace>0) return NULL;
           else break;
       }
    }
    if(*pp!=c) return NULL;
    return pp;
}

Here is the call graph for this function:

char* find_word_end ( char *  p)

Definition at line 139 of file lines.c.

{
    while(!myisspace(*p) && *p!=0) p++;
    return p;
}
char* find_word_start ( char *  p)

Definition at line 146 of file lines.c.

{
    while(myisspace(*p)) p++;
    return p;
}
char* fnd_char ( char *  p,
int  n,
char  bf[] 
)

Definition at line 452 of file lines.c.

{
    int t;
    
    t=strlen(p);
    if(n>t || n<1) {*bf=0;fnd_position=NULL; fnd_nextpos="";}
    else {
       *bf=*(p+n-1); *(bf+1)=0;
       fnd_position=p+n-1;fnd_nextpos=p+n;
    }
    return bf;
}

Here is the caller graph for this function:

char* fnd_item ( char *  p,
int  n,
char  bf[] 
)

Definition at line 418 of file lines.c.

{
    char *pp, *pe;
    int i;

    for(i=1,pp=p; i<n && (pp==p || *(pp-1)!=0); pp=find_item_end(pp)+1, i++);
    fnd_position=pp; if(pp>p && *(pp-1)==0) {
       fnd_position=NULL; *bf=0; return bf;
    }
    pp=find_word_start(pp); pe=find_item_end(pp);
    if(*pe) fnd_nextpos=pe+1; else fnd_nextpos=pe;
    while(pe>pp && myisspace(*(pe-1))) pe--;
    memmove(bf,pp,pe-pp); bf[pe-pp]=0;
    return bf;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* fnd_line ( char *  p,
int  n,
char  bf[] 
)

Definition at line 402 of file lines.c.

{
    char *pp;
    int i;
    
    for(i=1,pp=p; pp-1!=NULL && *pp!=0 && i<n; pp=strchr(pp,'\n')+1, i++);
    fnd_position=pp; if(pp-1==NULL) {
       fnd_position=NULL; fnd_nextpos=""; *bf=0; return bf;
    }
    for(i=0; *(pp+i)!=0 && *(pp+i)!='\n'; i++) *(bf+i)=*(pp+i);
    *(bf+i)=0;
    if(pp[i]=='\n') i++; fnd_nextpos=pp+i;
    return bf;
}

Here is the caller graph for this function:

char* fnd_row ( char *  p,
int  n,
char  bf[] 
)

Definition at line 505 of file lines.c.

{
    rows2lines(p); return fnd_line(p,n,bf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* fnd_word ( char *  p,
int  n,
char  bf[] 
)

Definition at line 435 of file lines.c.

{
    char *pp;
    int i;
    
    for(i=1, pp=find_word_start(p); *pp!=0 && i<n ; i++) {
       while(!myisspace(*pp) && *pp!=0) pp++;
       pp=find_word_start(pp);
    }
    if(*pp) fnd_position=pp; else fnd_position=NULL;
    for(i=0; *(pp+i)!=0 && !myisspace(*(pp+i)); i++) *(bf+i)=*(pp+i);
    fnd_nextpos=find_word_start(pp+i);
    *(bf+i)=0; 
    return bf;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* int2str ( int  i)

Definition at line 23 of file lines.c.

{
    int neg,t;
    static char int_buf[int_buf_size];
    int_buf[int_buf_size-1]=0;
    neg=0; if(i<0) {neg=1;i=-i;}
    for(t=int_buf_size-2;t>=0;) {
       int_buf[t--]=i%10+'0'; i/=10;
       if(i==0) break;
    }
    if(t<=0) {int_buf[0]=0; return int_buf;} /* should never occur. */
    if(neg) int_buf[t--]='-';
    t++; return int_buf+t;
}

Here is the caller graph for this function:

char* itemchr ( char *  p,
char *  w 
)

Definition at line 222 of file lines.c.

{
    char *r, *r1, *r2; int n;

    if(*w==0) return NULL;
    n=strlen(w);
    for(r=strstr(p,w);r!=NULL; r=strstr(r+1,w)) {
       r1=r-1;while(r1>=p && myisspace(*r1)) r1--;
       r2=find_word_start(r+n);
       if((r1<p || *r1==',') && (*r2==0 || *r2==',')) return r;
    }
    return r;
}

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int itemnum ( char *  p)

Definition at line 374 of file lines.c.

{
    int i; char *pp;

    if(*p==0) return 0;
    for(i=0,pp=p; pp==p || *(pp-1)!=0; pp=find_item_end(pp)+1, i++);
    return i;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void items2lines ( char *  p)

Definition at line 650 of file lines.c.

{
    char *pp;
    for(pp=strparstr(p,",");*pp;pp=strparstr(pp+1,",")) *pp='\n';
}

Here is the call graph for this function:

void items2words ( char *  p)

Definition at line 643 of file lines.c.

{
    char *pp;
    for(pp=strparstr(p,",");*pp;pp=strparstr(pp+1,",")) *pp=' ';
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* linechr ( char *  p,
char *  w 
)

Definition at line 237 of file lines.c.

{
    char *r;
    int n;

    if(*w==0) return NULL;
    n=strlen(w);
    for(r=strstr(p,w);r!=NULL; r=strstr(r+1,w)) {
       if((r<=p || *(r-1)=='\n') && (*(r+n)==0 || *(r+n)=='\n'))
         break;
    }
    return r;
}

Here is the caller graph for this function:

unsigned int linenum ( char *  p)

Definition at line 362 of file lines.c.

{
    int i; char *pp;

    /* Ending blank line will be thus removed. */
    i=strlen(p); if(i>1 && *(p+i-1)=='\n') *(p+i-1)=0;
    if(*p=='\n') i=1; else i=0;
    for(pp=p; pp!=NULL && *pp!=0; pp=strchr(pp+1,'\n'), i++);
    return i;
}

Here is the caller graph for this function:

void lines2items ( char *  p)

Definition at line 629 of file lines.c.

{
    char *pp;
    for(pp=strchr(p,'\n'); pp; pp=strchr(pp,'\n')) *pp++=',';
}
void lines2rows ( char *  p)

Definition at line 488 of file lines.c.

{
    char *pp;
    strip_trailing_spaces(p);
    for(pp=strchr(find_word_start(p),'\n'); pp!=NULL; pp=strchr(pp+1,'\n'))
      *pp=';';
}

Here is the call graph for this function:

Here is the caller graph for this function:

void lines2words ( char *  p)

Definition at line 636 of file lines.c.

{
    char *pp;
    for(pp=strchr(p,'\n'); pp; pp=strchr(pp,'\n')) *pp++=' ';
}
char* memstr ( char *  s1,
char *  s2,
int  len 
)

Definition at line 513 of file lines.c.

{
    char *p, *pp;
    pp=s1;
    for(p=s1; p<s1+len; p=pp) {
       pp=strstr(p,s2); if(pp!=NULL) break;
       pp=p+strlen(p);
       while(pp<s1+len && *pp==0) pp++;
    }
    return pp;
}

Here is the caller graph for this function:

int msleep ( int  ms)

Definition at line 48 of file lines.c.

{
    struct timespec req, rem;
    if(ms<=0) return 0;
    req.tv_sec=ms/1000; req.tv_nsec=(ms%1000)*1000*1000;
    return nanosleep(&req,&rem);
}

Here is the caller graph for this function:

void mystrncpy ( char *  dest,
char *  src,
int  lim 
)

Definition at line 73 of file lines.c.

{
    int i;
    i=strlen(src);
    if(i<0 || (i>=lim && i>=MAX_LINELEN)) error1("cmd_output_too_long");
    if(i>=lim) i=lim-1;
    memmove(dest,src,i); dest[i]=0;
}
void nospace ( char *  p)

Definition at line 605 of file lines.c.

{
    char *pp, *pt;
    for(pp=pt=p;*pp;pp++) if(!myisspace(*pp)) *pt++=*pp;
    *pt=0;
}

Here is the caller graph for this function:

void reaccent ( char *  p)

Definition at line 677 of file lines.c.

{
    char *sp, *ap, c;
    int i, k;
    if(*p==0) return;
    for(sp=p+1; *sp; sp++) {
       ap=strchr(reaccents,*sp); if(ap==NULL) continue;
       i=ap-reaccents;
       sp--; ap=strchr(reaccentl,*sp); if(ap==NULL) {sp++; continue;}
       k=ap-reaccentl;
       c=reaccentab[k*strlen(reaccents)+i];
       if(c!=*sp) {*sp=c; strcpy(sp+1,sp+2);}
       else sp++;
    }
}

Here is the caller graph for this function:

unsigned int rownum ( char *  p)

Definition at line 496 of file lines.c.

{
    char buf[MAX_LINELEN+1];
    snprintf(buf,sizeof(buf),"%s",p);
    rows2lines(buf);
    return linenum(buf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int rows2lines ( char *  p)

Definition at line 466 of file lines.c.

{
    char *pp, *p2;
    int t;
    if(strchr(p,'\n')!=NULL) return 0;
    for(t=0, pp=p; *pp; pp++) {
       if(*pp=='(') {p2=find_matching(pp+1,')'); if(p2!=NULL) pp=p2; continue;}
       if(*pp=='[') {p2=find_matching(pp+1,']'); if(p2!=NULL) pp=p2; continue;}
       if(*pp=='{') {p2=find_matching(pp+1,'}'); if(p2!=NULL) pp=p2; continue;}
       if(*pp==';') {*pp='\n'; t++; continue;}
       if(*pp=='&' && myisalpha(*(pp+1))) {
           for(p2=pp+1; myisalpha(*p2) && p2-pp<14; p2++);
           pp=p2; continue;
       }
       if(*pp=='&' && *(pp+1)=='#') {
           for(p2=pp+2; myisdigit(*p2) && p2-pp<6; p2++);
           pp=p2; continue;
       }
    }
    return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int search_list ( void *  list,
int  items,
size_t  item_size,
const char *  str 
)

Definition at line 336 of file lines.c.

{
    int i1,i2,j,k;
    char **p;
    char c;
    
    if(items<=0) return -1;
    j=0; c=*str;
    p=list;
    k=**p-c; if(k==0) k=strcmp(*p,str);
    if(k==0) return k; if(k>0) return -1;
    p=list+(items-1)*item_size; 
    k=**p-c; if(k==0) k=strcmp(*p,str);
    if(k==0) return items-1; if(k<0) return ~items;
    for(i1=0,i2=items-1;i2>i1+1;) {
       j=(i2+i1)/2;
       p=list+(j*item_size);
       k=**p-c; if(k==0) k=strcmp(*p,str);
       if(k==0) return j;
       if(k>0) {i2=j; continue;}
       if(k<0) {i1=j; continue;}   
    }
    return ~i2;
}
void singlespace ( char *  p)

Definition at line 593 of file lines.c.

{
    char *pp, *pt, *p2;
    for(pp=pt=p;*pp;pp++) {
       if(!myisspace(*pp)) {*pt++=*pp; continue; }
       *pt++=' ';
       for(p2=pp+1;myisspace(*p2);p2++); pp=--p2;
    }
    *pt=0;
}
void string_modify ( char *  start,
char *  bad_beg,
char *  bad_end,
char *  good,
  ... 
)

Definition at line 694 of file lines.c.

{
    char buf[MAX_LINELEN+1];
    int ln, le;
    va_list vp;
    
    va_start(vp,good);
    vsnprintf(buf,sizeof(buf),good,vp); va_end(vp);
    ln=strlen(buf); le=strlen(bad_end);
    if(ln+le+(bad_beg-start)>=MAX_LINELEN) {
       error1("string_too_long"); return;
    }
    if(ln!=bad_end-bad_beg) memmove(bad_beg+ln,bad_end,le+1);
    memmove(bad_beg,buf,ln);
}
void strip_enclosing_par ( char *  p)

Definition at line 565 of file lines.c.

{
    char *p1;
    partest: strip_trailing_spaces(p);
    if(*p=='(') {
       p1=find_matching(p+1,')');
       if(p1 && *(p1+1)==0) {
           *p1=0; strcpy(p,find_word_start(p+1));
           goto partest;
       }
    }
    if(*p=='[') {
       p1=find_matching(p+1,']');
       if(p1 && *(p1+1)==0) {
           *p1=0; strcpy(p,find_word_start(p+1));
           goto partest;
       }
    }
    if(*p=='{') {
       p1=find_matching(p+1,'}');
       if(p1 && *(p1+1)==0) {
           *p1=0; strcpy(p,find_word_start(p+1));
           goto partest;
       }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* strip_trailing_spaces ( char *  p)

Definition at line 307 of file lines.c.

{
    char *pp;
    if(*p==0) return p;
    for(pp=p+strlen(p)-1; pp>=p && myisspace(*pp); pp--);
    if(pp[1]) pp[1]=0; return pp;
}
char* strparchr ( char *  p,
char  c 
)

Definition at line 153 of file lines.c.

{
    char *pp;
    
    for(pp=p;*pp && *pp!=c && pp-p<MAX_LINELEN; pp++) {
       switch(*pp) {
           case '(': pp=find_matching(pp+1,')'); break;
           case '[': pp=find_matching(pp+1,']'); break;
           case '{': pp=find_matching(pp+1,'}'); break;
       }
       if(pp==NULL) return NULL;
    }
    if(*pp==c) return pp; else return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* strparstr ( char *  p,
char *  fnd 
)

Definition at line 169 of file lines.c.

{
    char *pp, c;
    int n;
    
    if(*fnd==0) return p+strlen(p);
    c=*fnd; n=strlen(fnd);
    for(pp=p;pp-1!=NULL && *pp!=0; pp++) {
       if(*pp==c && (n==1 || strncmp(pp,fnd,n)==0)) return pp;
       switch(*pp) {
           case '(': pp=find_matching(pp+1,')'); break;
           case '[': pp=find_matching(pp+1,']'); break;
           case '{': pp=find_matching(pp+1,'}'); break;
       }
    }
    if(pp-1==NULL) pp=strstr(p,fnd);
    if(pp!=NULL) return pp; 
    else return p+strlen(p);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* varchr ( char *  p,
char *  v 
)

Definition at line 253 of file lines.c.

{
    char *pp; int n;
    if(*v==0) return NULL;
    n=strlen(v);
    for(pp=strstr(p,v); pp!=NULL; pp=strstr(pp+1,v)) {
       if((pp==p || (!myisalnum(*(pp-1)) && *(pp-1)!='_')) &&
          ((!myisalnum(*(pp+n)) && *(pp+n)!='_' && *(pp+n)!='\'')
           || *(pp+n)==0)) break;
    }
    return pp;
}
int verify_order ( void *  list,
int  items,
size_t  item_size 
)

Definition at line 319 of file lines.c.

{
    int i; char *old, **p;
    p=list; old=*p;
    for(i=item_size;i<items*item_size;i+=item_size) {
       p=list+i;
       if(strcmp(*p,old)<0) {
           fprintf(stderr,"Table disorder: %s > %s",old,*p);
           exit(1);
       }
       old=*p;
    }
    return 0;
}

Here is the caller graph for this function:

char* wordchr ( char *  p,
char *  w 
)

Definition at line 209 of file lines.c.

{
    char *r; int n;

    if(*w==0) return NULL;
    n=strlen(w);
    for(r=strstr(p,w);r!=NULL && 
       ( (r>p && !myisspace(*(r-1))) || (!myisspace(*(r+n)) && *(r+n)!=0) );
       r=strstr(r+1,w));
    return r;
}
unsigned int wordnum ( char *  p)

Definition at line 384 of file lines.c.

{
    int i; char *pp;
    
    for(i=0, pp=find_word_start(p); *pp!=0; i++) {
       while(!myisspace(*pp) && *pp!=0) pp++;
       while(myisspace(*pp)) pp++;
    }
    return i;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void words2items ( char *  p)

Definition at line 621 of file lines.c.

{   _spaces2_(p,',');       }

Here is the call graph for this function:

Here is the caller graph for this function:

void words2lines ( char *  p)

Definition at line 625 of file lines.c.

{   _spaces2_(p,'\n');      }

Here is the call graph for this function:

void* xmalloc ( size_t  n)

Definition at line 38 of file lines.c.

{
    void *p;
    p=malloc(n);
    if(p==NULL) {
       fprintf(stderr,"Malloc failure."); exit(1);
    }
    return p;
}

Variable Documentation

char* acctab = ""

Definition at line 656 of file lines.c.

char * deatab = "ceeeeuuuuaaaaaoooooiiiinyyCEEEEUUUUAAAAAOOOOOIIIINY"

Definition at line 657 of file lines.c.

char* reaccentab
Initial value:
"\
eiuyyyccccnnnn\
EIUYYYYCCCCNNNN"

Definition at line 672 of file lines.c.

char* reaccentl = "aeiouycnAEIOUYCN"

Definition at line 671 of file lines.c.

char* reaccents = "'`\"^~"

Definition at line 670 of file lines.c.