Skip to content
Snippets Groups Projects
Unverified Commit 81afdbac authored by Ian Douglas Scott's avatar Ian Douglas Scott
Browse files

Recipe for sed

parent 53653625
No related branches found
No related tags found
No related merge requests found
VERSION=4.4
TAR=http://ftp.gnu.org/gnu/sed/sed-$VERSION.tar.xz
HOST=x86_64-elf-redox
function recipe_version {
echo "$VERSION"
skip=1
}
function recipe_update {
echo "skipping update"
skip=1
}
function recipe_build {
autoreconf
./configure --host=${HOST} --prefix=/
make
skip=1
}
function recipe_test {
echo "skipping test"
skip=1
}
function recipe_clean {
make clean
skip=1
}
function recipe_stage {
dest="$(realpath $1)"
make DESTDIR="$dest" install
skip=1
}
diff -ru source/lib/getprogname.c source-new/lib/getprogname.c
--- source/lib/getprogname.c 2017-01-16 21:36:00.000000000 -0800
+++ source-new/lib/getprogname.c 2017-07-13 16:13:35.966956860 -0700
@@ -43,13 +43,11 @@
# include <string.h>
#endif
-#ifdef __sgi
# include <string.h>
# include <unistd.h>
# include <stdio.h>
# include <fcntl.h>
-# include <sys/procfs.h>
-#endif
+# include <limits.h>
#include "dirname.h"
@@ -178,7 +176,16 @@
}
return NULL;
# else
-# error "getprogname module not ported to this OS"
+ char filename[PATH_MAX];
+ int fd = open ("sys:exe", O_RDONLY);
+ if (fd > 0) {
+ int len = read(fd, filename, PATH_MAX-1);
+ if (len > 0) {
+ filename[len] = '\0';
+ return strdup(filename);
+ }
+ }
+ return NULL;
# endif
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment