#!/usr/local/bin/clisp -ansi -q -Kfull -E iso-8859-1 ;;;; -*- mode: lisp -*- ;;;;**************************************************************************** ;;;;FILE: columnify ;;;;LANGUAGE: text ;;;;SYSTEM: POSIX ;;;;USER-INTERFACE: NONE ;;;;DESCRIPTION ;;;; ;;;; Columnify the input. ;;;; ;;;; By default, columnify as much as possible given the line lengths ;;;; and the terminal width as given by the environment variable COLUMNS. ;;;; ;;;;AUTHORS ;;;; Pascal Bourguignon ;;;;MODIFICATIONS ;;;; 2007-04-19 ;;;;BUGS ;;;;LEGAL ;;;; GPL ;;;; ;;;; Copyright Pascal Bourguignon 2007 - 2007 ;;;; ;;;; This program is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU General Public License ;;;; as published by the Free Software Foundation; either version ;;;; 2 of the License, or (at your option) any later version. ;;;; ;;;; This program is distributed in the hope that it will be ;;;; useful, but WITHOUT ANY WARRANTY; without even the implied ;;;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;;;; PURPOSE. See the GNU General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public ;;;; License along with this program; if not, write to the Free ;;;; Software Foundation, Inc., 59 Temple Place, Suite 330, ;;;; Boston, MA 02111-1307 USA ;;;;**************************************************************************** (defparameter *width* (or (when (ext:getenv "COLUMNS") (parse-integer (ext:getenv "COLUMNS"))) (with-open-stream (stty (ext:run-shell-command "stty -a