Changeset 6634
- Timestamp:
- May 31, 2007, 5:09:33 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ccl/level-1/linux-files.lisp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/level-1/linux-files.lisp
r6496 r6634 344 344 (fd-set-flags fd (logandc2 old mask))))) 345 345 346 347 ;;; Assume that any quoting's been removed already. 348 (defun tilde-expand (namestring) 349 (let* ((len (length namestring))) 350 (if (or (zerop len) 351 (not (eql (schar namestring 0) #\~))) 352 namestring 353 (if (or (= len 1) 354 (eql (schar namestring 1) #\/)) 355 (concatenate 'string (get-user-home-dir (getuid)) (if (= len 1) "/" (subseq namestring 1))) 356 (let* ((slash-pos (position #\/ namestring)) 357 (user-name (subseq namestring 1 slash-pos)) 358 (uid (or (get-uid-from-name user-name) 359 (error "Unknown user ~s in namestring ~s" user-name namestring)))) 360 (concatenate 'string (get-user-home-dir uid) (if slash-pos (subseq namestring slash-pos) "/"))))))) 361 362 363 346 364 ;;; This doesn't seem to exist on VxWorks. It's a POSIX 347 365 ;;; function AFAIK, so the source should be somewhere ... … … 351 369 (setq namestring (current-directory-name))) 352 370 (%stack-block ((resultbuf #$PATH_MAX)) 353 (with-cstrs ((name namestring))371 (with-cstrs ((name (tilde-expand namestring))) 354 372 (let* ((result (#_realpath name resultbuf))) 355 373 (declare (dynamic-extent result)) … … 417 435 418 436 437 (defun get-uid-from-name (name) 438 (with-cstrs ((name name)) 439 (let* ((pwent (#_getpwnam name))) 440 (unless (%null-ptr-p pwent) 441 (pref pwent :passwd.pw_uid))))) 442 443 419 444 (defun isatty (fd) 420 445 (= 1 (#_isatty fd)))
Note:
See TracChangeset
for help on using the changeset viewer.
