Ejemplo n.º 1
0
uchar *next_field_ustr(uchar **pos) {
    uchar *pos2;

    *pos = ucschr(*pos,'|')+1;
    pos2 = ucschr(*pos,'|');
    return ucsndup(*pos,pos2-(*pos));
}
Ejemplo n.º 2
0
/** Check if input line contains a meta delimiter;
 * @return 1 if it does, 0 otherwise.
 */
static int ltermMetaInput(struct lterms *lts)
{
  struct LtermInput *lti = &(lts->ltermInput);
  UNICHAR *delimLoc, *ustr, *ustr2;

  LTERM_LOG(ltermMetaInput,40,("\n"));

  if (lts->options & LTERM_NOMETA_FLAG)
    return 0;

  /* Assert that there is at least one free character position in the buffer */
  assert(lti->inputChars < MAXCOL);

  /* Insert null character at the end of the input buffer */
  lti->inputLine[lti->inputChars] = U_NUL;

  /* Locate first occurrence of meta delimiter in input line */
  delimLoc = ucschr(lti->inputLine, ltermGlobal.metaDelimiter);

  if (delimLoc == NULL)
    return 0;

  for (ustr=lti->inputLine; ustr<delimLoc; ustr++)  /* skip spaces/TABs */
    if ((*ustr != U_SPACE) && (*ustr != U_TAB)) break;

  if (ustr == delimLoc) {
    /* Nameless meta command */
    LTERM_LOG(ltermMetaInput,41,("Nameless meta command\n"));
    return 1;
  }

  if (!IS_ASCII_LETTER(*ustr)) /* meta command must start with a letter */
    return 0;

  for (ustr2=ustr+1; ustr2<delimLoc; ustr2++)
    if (!IS_ASCII_LETTER(*ustr2) && !IS_ASCII_DIGIT(*ustr2))
      return 0;

  LTERM_LOG(ltermMetaInput,41,("Named meta command\n"));

  return 1;
}
Ejemplo n.º 3
0
int next_field_int(uchar **pos) {
    *pos = ucschr(*pos,'|')+1;
    return ucstoi(*pos);
}
Ejemplo n.º 4
0
double next_field_double(uchar **pos) {
    *pos = ucschr(*pos,'|')+1;
    return ucstof(*pos);
}