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:
mainzelm 2006-04-05 07:38:50 +00:00
parent 8cce1e5c77
commit 982a8aec9f
1 changed files with 18 additions and 3 deletions

View File

@ -65,13 +65,28 @@
(else (else
(number->string bytes))))) (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) (define (format-user/group fi)
(fill-up-string 17 (fill-up-string 17
(string-append (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 (cut-to-size 8 (->groupname/save (file-info:gid fi))))))
(group-info (file-info:gid fi)))))))
;; leave one line for the heading ;; leave one line for the heading
(define (calculate-number-of-lines result-buffer) (define (calculate-number-of-lines result-buffer)