예제 #1
0
파일: T_bridge.c 프로젝트: cmccausl/mc
/*
 * Bridge:  parsekeyword
 */
c_t *
T_parsekeyword( c_t * p_key, c_t * p_s )
{
  c_t * s = 0;
  if ( 0 == p_s ) p_s = "";
  if ( 0 == p_key ) p_key = "";
  if ( strlen( p_s ) ) {
    c_t * key = Escher_strget();
    strcpy( key, p_key );
    strcat( key, ":" );
    s = strstr( p_s, key );
    if ( 0 != s ) {
      i_t i = 0;
      s = strstr( s, ":" );
      if ( 0 != s ) s++; /* increment past : */
      if ( 0 != *s ) {
        c_t * s2 = Escher_strget();
        strcpy( s2, s );
        s = s2;
        /* Skip past blanks but watch for end of line and and of string and string max.  */
        while ( ( i < ESCHER_SYS_MAX_STRING_LEN ) && ( ' ' == *s ) && ( 0 != *s ) && ( '\n' != *s ) ) {
          s++; i++;
        }
        while ( ( i < ESCHER_SYS_MAX_STRING_LEN ) && ( 0 != *(s+i) ) ) {
          if ( ( '\n' == *(s+i) ) || ( ' ' == *(s+i) ) ) { *(s+i) = 0; break; }
          i++;
        }
      }
    }
  }
  return ( 0 != s ) ? s : "";
}
예제 #2
0
/*
 * Add two strings.  Allocate a temporary memory variable to return the value.
 */
c_t *
Escher_stradd( const c_t * left, const c_t * right )
{
  s2_t i = ESCHER_SYS_MAX_STRING_LEN - 1;
  c_t * s = Escher_strget();
  c_t * dst = s;
  while ( ( i > 0 ) && ( *left != '\0' ) ) {
    --i;
    *dst++ = *left++;
  }
  while ( ( i > 0 ) && ( *right != '\0' ) ) {
    --i;
    *dst++ = *right++;
  }
  *dst = '\0';  /* Ensure delimiter.  */
  return s;
}
예제 #3
0
파일: sys_xtuml.c 프로젝트: yakashi/mc
/*
 * Add two strings.  Allocate a temporary memory variable to return the value.
 */
c_t *
Escher_stradd( const c_t * left, const c_t * right )
{
    i_t i = MAXRECORDLENGTH - 1;
    c_t * s = Escher_strget();
    c_t * dst = s;
    if ( 0 == left ) left = "";
    if ( 0 == right ) right = "";
    while ( ( i > 0 ) && ( *left != '\0' ) ) {
        --i;
        *dst++ = *left++;
    }
    while ( ( i > 0 ) && ( *right != '\0' ) ) {
        --i;
        *dst++ = *right++;
    }
    *dst = '\0';  /* Ensure delimiter.  */
    return s;
}