add a do_realpath() implementation replacing the use of the external

libc function realpath(3) which may not be available on the target
system; compile the realpath builtin unconditionally

looks fine to me, but review is appreciated; this is (very) lightly
based upon MirBSD libc’s realpath(3) and pdksh’s get_phys_path()
This commit is contained in:
tg
2009-08-30 13:22:39 +00:00
parent 75a7eb63e1
commit 31e02e59f7
3 changed files with 151 additions and 35 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.422 2009/08/28 17:37:47 tg Exp $'
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.423 2009/08/30 13:22:37 tg Exp $'
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Thorsten Glaser <tg@mirbsd.org>
@ -919,7 +919,6 @@ if ac_ifcpp 'ifdef MKSH_SMALL' isset_MKSH_SMALL '' \
fi
: ${HAVE_MKNOD=0}
: ${HAVE_REALPATH=0}
: ${HAVE_REVOKE=0}
: ${HAVE_PERSISTENT_HISTORY=0}
check_categories=$check_categories,smksh
@ -1168,23 +1167,6 @@ ac_test nice <<-'EOF'
int main(void) { return (nice(4)); }
EOF
ac_test realpath <<-'EOF'
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <stdlib.h>
#include <unistd.h>
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
char *res, dst[PATH_MAX];
const char src[] = ".";
int main(void) {
res = realpath(src, dst);
return (res == NULL ? 1 : 0);
}
EOF
ac_test revoke <<-'EOF'
#include <sys/types.h>
#if HAVE_LIBUTIL_H