void printmsg(char *);
void printwarn(void);
void printerr(int, char *);
-char *mkpath(char *, char *, char *, size_t);
#undef dprintf
int
return 1;
}
+char *
+mkpath(char *dir, char *name, char *out, size_t n)
+{
+ /* Handle absolute path */
+ if (name[0] == '/') {
+ strlcpy(out, name, n);
+ } else {
+ /* Handle root case */
+ if (strcmp(dir, "/") == 0) {
+ strlcpy(out, "/", n);
+ strlcat(out, name, n);
+ } else {
+ strlcpy(out, dir, n);
+ strlcat(out, "/", n);
+ strlcat(out, name, n);
+ }
+ }
+ return out;
+}
+
void
printent(struct entry *ent, int active)
{
free(dents);
}
-char *
-mkpath(char *dir, char *name, char *out, size_t n)
-{
- /* Handle absolute path */
- if (name[0] == '/') {
- strlcpy(out, name, n);
- } else {
- /* Handle root case */
- if (strcmp(dir, "/") == 0) {
- strlcpy(out, "/", n);
- strlcat(out, name, n);
- } else {
- strlcpy(out, dir, n);
- strlcat(out, "/", n);
- strlcat(out, name, n);
- }
- }
- return out;
-}
-
/* Return the position of the matching entry or 0 otherwise */
int
dentfind(struct entry *dents, int n, char *cwd, char *path)