diff -Nur buildpkg-0.0.2r28f/helpers/Makefile buildpkg-0.0.2r28f-mrice/helpers/Makefile --- buildpkg-0.0.2r28f/helpers/Makefile 1969-12-31 18:00:00.000000000 -0600 +++ buildpkg-0.0.2r28f-mrice/helpers/Makefile 2005-05-24 15:09:28.619402800 -0500 @@ -0,0 +1,17 @@ + +DIRS= geteuid lstat readlink rotopipe + +all: ${DIRS} + @for d in ${DIRS}; do \ + ( cd $${d} && ${MAKE} ${MAKEARGS} ) \ + done + +install: ${DIRS} + @for d in ${DIRS}; do \ + ( cd $${d} && ${MAKE} install ${MAKEARGS} ) \ + done + +clean: ${DIRS} + @for d in ${DIRS}; do \ + ( cd $${d} && ${MAKE} clean ${MAKEARGS} ) \ + done diff -Nur buildpkg-0.0.2r28f/helpers/readlink/Makefile buildpkg-0.0.2r28f-mrice/helpers/readlink/Makefile --- buildpkg-0.0.2r28f/helpers/readlink/Makefile 1969-12-31 18:00:00.000000000 -0600 +++ buildpkg-0.0.2r28f-mrice/helpers/readlink/Makefile 2005-05-24 14:02:15.906040800 -0500 @@ -0,0 +1,24 @@ +# +# $Id: Makefile,v 1.1 2003/05/10 10:43:38 dice Exp $ +# + +CC = gcc +STRIP = strip + +DESTDIR = +HELPERSDIR = /usr/lib/buildpkg/helpers + +all: readlink + +install: all + mkdir -p ${DESTDIR}${HELPERSDIR} + cp ./readlink ${DESTDIR}${HELPERSDIR} + chown 0:0 ${DESTDIR}${HELPERSDIR}/readlink + chmod 755 ${DESTDIR}${HELPERSDIR}/readlink + +clean: + rm -f *.o readlink + +readlink: readlink.c + $(CC) -o readlink readlink.c +# $(STRIP) --strip-debug readlink diff -Nur buildpkg-0.0.2r28f/helpers/readlink/readlink.c buildpkg-0.0.2r28f-mrice/helpers/readlink/readlink.c --- buildpkg-0.0.2r28f/helpers/readlink/readlink.c 1969-12-31 18:00:00.000000000 -0600 +++ buildpkg-0.0.2r28f-mrice/helpers/readlink/readlink.c 2005-05-24 15:02:58.632616200 -0500 @@ -0,0 +1,32 @@ +#include +#include +#include + +/* from http://www.quepublishing.com/articles/article.asp?p=23618&seqNum=12 */ + +int main (int argc, char* argv[]) +{ + char target_path[256]; + char* link_path = argv[1]; + + /* Attempt to read the target of the symbolic link. */ + int len = readlink (link_path, target_path, sizeof (target_path)); + + if (len == -1) { + /* The call failed. */ + if (errno == EINVAL) + /* It's not a symbolic link; report that. */ + fprintf (stderr, "%s is not a symbolic link\n", link_path); + else + /* Some other problem occurred; print the generic message. */ + perror ("readlink"); + return 1; + } + else { + /* NUL-terminate the target path. */ + target_path[len] = '\0'; + /* Print it. */ + printf ("%s\n", target_path); + return 0; + } +}