You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.8 KiB

# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# T2 SDE: package/.../embutils/xx-readlink.patch
# Copyright (C) 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- T2-COPYRIGHT-NOTE-END ---
A tiny readlink I need (advanced features of the installer).
- Rene Rebe <rene@exactcode.de>
diff -urN embutils-0.17/Makefile embutils-0.17-patched/Makefile
--- embutils-0.17/Makefile 2005-12-19 00:15:55.000000000 +0100
+++ embutils-0.17-patched/Makefile 2005-12-18 23:50:38.000000000 +0100
@@ -11,7 +11,7 @@
install sosrm soscp sosmv sosln soslns md5sum sleep2 allinone kill uniq \
dd tr mesg write touch du tail uuencode uudecode nohup nice cmp mktemp \
truncate test date mount printenv umount pivot_root insmod rmmod \
-lsmod free losetup switch_root
+lsmod free losetup switch_root readlink
OBJDIR:=bin
TARGETS=$(patsubst %,$(OBJDIR)/%,$(PRGS))
diff -urN embutils-0.17/readlink.c embutils-0.17-patched/readlink.c
--- embutils-0.17/readlink.c 1970-01-01 01:00:00.000000000 +0100
+++ embutils-0.17-patched/readlink.c 2005-12-19 00:13:23.000000000 +0100
@@ -0,0 +1,19 @@
+
+#include <unistd.h>
+#include <limits.h>
+
+int main(int argc,char *argv[]) {
+
+ char buf[PATH_MAX];
+ int i;
+
+ for (i=1; i<argc && i == 1; ++i) {
+ int n;
+ if (n = readlink(argv[i], buf, sizeof(buf))) {
+ write(1,buf,n);
+ write(1,"\n",1);
+ return 0;
+ }
+ }
+ return 11;
+}