Return to tildexpand.c CVS log | Up to [local] / src / usr.bin / ssh |
version 1.8.2.5, 2001/09/27 00:15:43 | version 1.9, 2000/12/19 23:17:59 | ||
---|---|---|---|
|
|
||
RCSID("$OpenBSD$"); | RCSID("$OpenBSD$"); | ||
#include "xmalloc.h" | #include "xmalloc.h" | ||
#include "log.h" | #include "ssh.h" | ||
#include "tildexpand.h" | |||
/* | /* | ||
* Expands tildes in the file name. Returns data allocated by xmalloc. | * Expands tildes in the file name. Returns data allocated by xmalloc. | ||
|
|
||
if (len > MAXPATHLEN) | if (len > MAXPATHLEN) | ||
fatal("Home directory too long (%d > %d", len-1, MAXPATHLEN-1); | fatal("Home directory too long (%d > %d", len-1, MAXPATHLEN-1); | ||
expanded = xmalloc(len); | expanded = xmalloc(len); | ||
snprintf(expanded, len, "%s%s%s", pw->pw_dir, strcmp(pw->pw_dir, "/") ? "/" : "", cp + 1); | snprintf(expanded, len, "%s/%s", pw->pw_dir, cp + 1); | ||
return expanded; | return expanded; | ||
} | } |