Back to index

wims  3.65+svn20090927
Functions
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.

Functions

char * getvar (char *p)
void setvar (char *p, char *v)
void error (char *p)
void bailout (int i1, int i2, char *msg)
char * find_tag_end (char *p)
char * find_name_end (char *p)
char * find_name_start (char *p)
void collapse_item (char *p, int n)
void string_modify2 (char *start, char *bad_beg, char *bad_end, char *good,...)
int _scmp (const void *p1, const void *p2)
char * substit (char *p)

Function Documentation

int _scmp ( const void *  p1,
const void *  p2 
)

Definition at line 108 of file lines.c.

{
    const char **s1,**s2;
    
    s1=(const char **) p1; s2=(const char **) p2;
    return strcmp(*s1,*s2);
}

Here is the caller graph for this function:

void bailout ( int  i1,
int  i2,
char *  msg 
)

Definition at line 31 of file lines.c.

{
    if(*msg) error(msg);
    printf("%d %d",i1,i2); exit(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void collapse_item ( char *  p,
int  n 
)

Definition at line 83 of file lines.c.

{
    int i;
    char *pp;
    if(n<1) return;
    for(i=1,pp=strchr(p,','); i<n && pp!=NULL; i++,pp=strchr(pp+1,','));
    if(pp==NULL) *p=0;
    else strcpy(p,pp+1);
}
void error ( char *  p)

Definition at line 26 of file lines.c.

{
    fprintf(stderr,"%s\n",p);
}
char* find_name_end ( char *  p)

Definition at line 68 of file lines.c.

{
    int i;
    for(i=0;isalnum(*p) && i<MAX_LINELEN; p++,i++);
    return p;
}
char* find_name_start ( char *  p)

Definition at line 76 of file lines.c.

{
    int i;
    for(i=0; !isalpha(*p) && i<MAX_LINELEN; p++,i++);
    return p;
}
char* find_tag_end ( char *  p)

Definition at line 38 of file lines.c.

{
    char *pp;
    
    p++; if(*p=='!') {
       if(*(p+1)=='-' && *(p+2)=='-') {
           pp=strstr(p,"-->"); if(pp==NULL) return p+strlen(p);
           else return p+2;
       }
    }
    /* else */ {
       pp=strchr(p,'>'); if(pp==NULL) return p+strlen(p); 
       else return pp;
    }
       /* Now the following is not executed. */
/*    for(pp=p;*pp;pp++) {
       switch(*pp) {
           case '>': return pp;
           case '"': {
              pp=strchr(++pp,'"'); if(pp==NULL) return p+strlen(p);
              break;
           }
           default: break;
       }
    }
    return pp;
*/
}
char* getvar ( char *  p)

Definition at line 23 of file lines.c.

{return NULL;}
void setvar ( char *  p,
char *  v 
)

Definition at line 24 of file lines.c.

{return;}
void string_modify2 ( char *  start,
char *  bad_beg,
char *  bad_end,
char *  good,
  ... 
)

Definition at line 94 of file lines.c.

{
    char buf[MAX_LINELEN+1];
    va_list vp;
    
    va_start(vp,good);
    vsnprintf(buf,sizeof(buf),good,vp); va_end(vp);
    if(strlen(start)-(bad_end-bad_beg)+strlen(buf)>=MAX_LINELEN)
      bailout(inlen,0,"string too long");
    strcat(buf,bad_end);
    strcpy(bad_beg,buf);
}

Here is the call graph for this function:

char* substit ( char *  p)

Definition at line 116 of file lines.c.

{
    char *pp;
    while((pp=strchr(p,'$'))!=NULL) *pp=' ';
    return p;
}