bridge/class-master/depend/pari/src/language/es.c
/* expand tildes in filenames, return a malloc'ed buffer */
expand tildes in filenames, return a malloc'ed buffer
expand tildes in filenames return a malloc ' ed buffer
static char *
_path_expand(const char *s)
{
  const char *t;
  char *ret, *dir = NULL;
  if (*s != '~') return pari_strdup(s);
  s++; 
  t = s; while (*t && *t != '/') t++;
  if (t == s)
    dir = pari_get_homedir("");
  else
  {
    size_t len = t - s;
    char *user = (char*)pari_malloc(len+1);
    (void)memcpy(user,s,len); user[len] = 0;
    dir = pari_get_homedir(user);
    pari_free(user);
  }
  if (!dir) return pari_strdup(s);
  ret = (char*)pari_malloc(strlen(dir) + strlen(t) + 1);
  sprintf(ret,"%s%s",dir,t); return ret;
}
static char * _path_expand ( const char * s ) { const char * t ; char * ret , * dir = NULL ; if ( * s != ' ' ) return pari_strdup ( s ) ; s ++ ; t = s ; while ( * t && * t != ' ' ) t ++ ; if ( t == s ) dir = pari_get_homedir ( " " ) ; else { size_t len = t - s ; char * user = ( char * ) pari_malloc ( len + 1 ) ; ( void ) memcpy ( user , s , len ) ; user [ len ] = 0 ; dir = pari_get_homedir ( user ) ; pari_free ( user ) ; } if ( ! dir ) return pari_strdup ( s ) ; ret = ( char * ) pari_malloc ( strlen ( dir ) + strlen ( t ) + 1 ) ; sprintf ( ret , " " , dir , t ) ; return ret ; }
expand tildes in filenames, return a malloc'ed buffer
expand tildes in filenames return a malloc ' ed buffer
/* skip ~ */