#!/usr/bin/guile \ -e main -s !# ;;; Copyright 2005 Daniel Cer (daniel.cer@cs.colorado.edu) ;;; ;;; This work is licensed under the Creative Commons Attribution-NonCommercial- ;;; ShareAlike License. To view a copy of this license, visit ;;; http://creativecommons.org/licenses/by-nc-sa/2.5/ or send a letter to ;;; Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, ;;; 94105, USA. (define (display-dir dir-path) (display (string-append "Contents of \"" dir-path "\":\n")) (let ((dir-fh (opendir dir-path))) (do ((entry (readdir dir-fh) (readdir dir-fh))) ((eof-object? entry) '()) (display (string-append "\t" entry "\n"))))) (define (main args) (if (equal? (length args) 2) (display-dir (car (cdr args))) (display (string-append "Usage:\n\t" (car args) " (directory to list)\n"))))