#!/bin/bash
#
# Script: /usr/local/bin/readconsole
#
# Author: deelkar@artena.deelkar.de
#
# Requires: setterm, Bash
#
# Public: yes 

# Copyright (C) 2002 "Dirk-Lueder Kreie" <deelkar@gmx.de>
#
# 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.





# hint on usage: there are more than 12 ttys but I thougt it
# not useful to put more than the 12 standard ttys in the
# case statement. If your system uses more, feel free to add 
# them into the case statement, to get rid of the hint msg



case "$1" in
    ""|1|2|3|4|5|6|7|8|9|10|11|12)
       setterm -dump $1 -file /tmp/readconsole.tmp
       cat /tmp/readconsole.tmp
    ;;
    *)
       setterm -dump $1 -file /tmp/readconsole.tmp
       cat /tmp/readconsole.tmp
       echo "hint: use \"readconsole X\" to read /dev/ttyX"
    ;;
esac

