Introduce save versions of ->username and ->groupname that return the
UID as a string if the system does not know the corresponding name.
This commit is contained in:
parent
8cce1e5c77
commit
982a8aec9f
|
@ -65,13 +65,28 @@
|
|||
(else
|
||||
(number->string bytes)))))
|
||||
|
||||
(define (->username/save uid/name)
|
||||
(with-fatal-error-handler
|
||||
(lambda (condition more)
|
||||
(if (number? uid/name)
|
||||
(number->string uid/name)
|
||||
uid/name))
|
||||
(->username uid/name)))
|
||||
|
||||
(define (->groupname/save gid/name)
|
||||
(with-fatal-error-handler
|
||||
(lambda (condition more)
|
||||
(if (number? gid/name)
|
||||
(number->string gid/name)
|
||||
gid/name))
|
||||
(->groupname gid/name)))
|
||||
|
||||
(define (format-user/group fi)
|
||||
(fill-up-string 17
|
||||
(string-append
|
||||
(cut-to-size 8 (->username (file-info:uid fi)))
|
||||
(cut-to-size 8 (->username/save (file-info:uid fi)))
|
||||
":"
|
||||
(cut-to-size 8 (group-info:name
|
||||
(group-info (file-info:gid fi)))))))
|
||||
(cut-to-size 8 (->groupname/save (file-info:gid fi))))))
|
||||
|
||||
;; leave one line for the heading
|
||||
(define (calculate-number-of-lines result-buffer)
|
||||
|
|
Loading…
Reference in New Issue