Beispiel #1
0
void twr_xchars (TABWRITE *twr, const char *recsep, const char *fldsep,
                                const char *blank,  const char *null)
{                               /* --- set characters of all classes */
  assert(twr);                  /* check the function arguments */
  if (recsep) twr->recsep = esc_decode(recsep, NULL);
  if (fldsep) twr->fldsep = esc_decode(fldsep, NULL);
  if (blank)  twr->blank  = esc_decode(blank,  NULL);
  if (null)   twr->null   = esc_decode(null,   NULL);
}  /* twr_xchars() */
Beispiel #2
0
int esc_decstr (char *dst, const char *src)
{                               /* --- decode a string */
  char *s = (char*)src;         /* to traverse the source */
  char *d = dst;                /* to traverse the destination */

  assert(dst && src);           /* check the function arguments */
  while (*s)                    /* decode the characters in src */
    *d++ = (char)esc_decode(s, &s);
  *d = '\0';                    /* terminate the destination */
  return d -dst;                /* return the destination length */
}  /* esc_decstr() */
Beispiel #3
0
void trd_chars (TABREAD *trd, int type, const char *chars)
{                               /* --- set characters of a class */
  int  c;                       /* loop variable, character */
  char *s;                      /* to traverse the characters */

  assert(trd);                  /* check the function arguments */
  if (!chars) return;           /* if no characters given, abort */
  if (!(type & TRD_ADD))        /* if to replace characters */
    for (c = 0; c < 256; c++)   /* traverse the characters and */
      trd->flags[c] &= ~type;   /* clear character flags in type */
  type &= ~TRD_ADD;             /* remove the flag for adding */
  for (s = (char*)chars; *s; )  /* set the character flags */
    trd->flags[esc_decode(s, &s)] |= type;
}  /* trd_chars() */
Beispiel #4
0
void twr_xochr (TABWRITE *twr, int id, const char *s)
{                               /* --- set other special character */
  assert(twr);                  /* check the function argument */
  twr->chars[id & 0x1f] = esc_decode(s, NULL);
}  /* twr_xochr() */