projects
/
rrq
/
newlisp
/
packnl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New version.
[rrq/newlisp/packnl.git]
/
incore.lsp
diff --git
a/incore.lsp
b/incore.lsp
index 6b0a02f5c73b82d0f834302140a67cd99e818894..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)
@@
-70,7
+74,7
@@
;; Discover and load an in-core archive by means of a marker row of 40
;; "x", and then a series of pathname\nsize\nbytes[size] members.
;; Discover and load an in-core archive by means of a marker row of 40
;; "x", and then a series of pathname\nsize\nbytes[size] members.
-(if (find (dup "x" 40) core nil 3
91704
)
+(if (find (dup "x" 40) core nil 3
00000
)
(let ((P (+ $it 41))) ; skip marker and newline
(constant 'incore P)
(while (regex "([^\n]+)\n([^\n]+)\n" core 0 P)
(let ((P (+ $it 41))) ; skip marker and newline
(constant 'incore P)
(while (regex "([^\n]+)\n([^\n]+)\n" core 0 P)