projects
/
rrq
/
newlisp
/
packnl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
7005e3b
)
Revised method for re-reading the executable as data.
master
0.2
author
Ralph Ronnquist
<rrq@rrq.au>
Wed, 7 Feb 2024 12:33:25 +0000
(23:33 +1100)
committer
Ralph Ronnquist
<rrq@rrq.au>
Wed, 7 Feb 2024 12:33:25 +0000
(23:33 +1100)
incore.lsp
patch
|
blob
|
history
incore.lsp.8.adoc
patch
|
blob
|
history
diff --git
a/incore.lsp
b/incore.lsp
index 7203047c0be43aefb1b97d0fc694df61b2878ccf..658972a367292a3334169cc30d98507e80a189f8 100644
(file)
--- a/
incore.lsp
+++ b/
incore.lsp
@@
-22,14
+22,18
@@
;; This is a hashmap of loaded files
(new Tree 'archives)
;; This is a hashmap of loaded files
(new Tree 'archives)
-;; A copy of the executable
-(define core:core (read-file "/proc/self/exe"))
+;; A copy of the executable (file descriptor 3)
+(define core:core
+ (letn ((FD 3) (SZ (seek FD)) (BUFFER (dup "" SZ)))
+ (seek FD 0) (read FD BUFFER SZ) BUFFER))
+(map delete '(FD SZ BUFFER GNU GNU))
(context 'archive)
(context 'archive)
-
(setf main nil)
(setf main nil)
-
-(constant 'AR "/usr/bin/ar" 'TAR "/bin/tar" 'FILE "/usr/bin/file")
+(constant
+ 'AR "/usr/bin/ar"
+ 'TAR (exists file? '("/bin/tar" "/usr/bin/tar"))
+ 'FILE "/usr/bin/file" )
(define (tar-able PATH)
(when (file? FILE)
(define (tar-able PATH)
(when (file? FILE)
diff --git
a/incore.lsp.8.adoc
b/incore.lsp.8.adoc
index e7acf946e2ad25860b3884fad7afae86732b09ec..1783adf563266db1696c6d715004b62361257a0b 100644
(file)
--- a/
incore.lsp.8.adoc
+++ b/
incore.lsp.8.adoc
@@
-59,10
+59,11
@@
referring to scripts within _ar_ aor _tar_ archive files.
*core:core*::
*core:core*::
-This is a data reference functor that gets set up by reading
-"/proc/self/exe". This is only useful for an embedded binary where it
-will contain application's inc-core archive. Any other use case will
-need to redefine *core:core* for its in-core archive, if any.
+This is a data reference functor that gets set up by re-reading the
+executable as data block. This is only useful for an embedded binary
+where it will contain application's in-core archive. Any other use
+case will need to redefine *core:core* for its in-core archive
+if any.
(*archives* _FILENAME_ _ARCHIVE_)::
(*archives* _FILENAME_ _ARCHIVE_)::