Turn owner and group parameters into (id . name) pairs

This commit is contained in:
Lassi Kortela 2019-12-28 01:57:57 +02:00
parent 75436f01fe
commit 7a65efb779
2 changed files with 10 additions and 10 deletions

View File

@ -1,10 +1,10 @@
;; Copyright 2019 Lassi Kortela
;; SPDX-License-Identifier: ISC
(define tar-unix-time (make-parameter 0))
(define tar-owner (make-parameter (cons 0 "root")))
(define tar-group (make-parameter (cons 0 "root")))
(define tar-unix-mode (make-parameter #o644))
(define tar-owner-name (make-parameter "root"))
(define tar-group-name (make-parameter "root"))
(define tar-unix-time (make-parameter 0))
(define nulls (make-bytevector 512 0))
(define blank-checksum (make-bytevector 7 (char->integer #\space)))
@ -40,8 +40,8 @@
(bytevector-append
(tar-string 100 fake-path)
(tar-octal 8 (tar-unix-mode))
(tar-octal 8 0)
(tar-octal 8 0)
(tar-octal 8 (car (tar-owner)))
(tar-octal 8 (car (tar-group)))
(tar-octal 12 nbyte)
(tar-octal 12 (tar-unix-time))))
(header-after-checksum
@ -50,8 +50,8 @@
(bytevector (char->integer #\0))
(tar-string 100 "")
(tar-string 8 "ustar ")
(tar-string 32 (tar-owner-name))
(tar-string 32 (tar-group-name))
(tar-string 32 (cdr (tar-owner)))
(tar-string 32 (cdr (tar-group)))
(make-bytevector 183 0)))
(checksum (tar-octal 7 (tar-checksum header-before-checksum
blank-checksum

View File

@ -1,8 +1,8 @@
(define-library (trivial-tar-writer)
(export tar-unix-time
(export tar-owner
tar-group
tar-unix-mode
tar-owner-name
tar-group-name
tar-unix-time
tar-write-file
tar-write-end)
(import (scheme base)