
Linux Gazette... making Linux just a little more fun!

      Copyright &copy; 1996-97 Specialized Systems Consultants, Inc. linux@ssc.com
      
   
   
   
     ______________________________________________________________________________________
   
   
   
Welcome to Linux Gazette! (tm)

   
   
   Linux Gazette, a member of the Linux Documentation Project, is an on-line WWW publication
   that is dedicated to two simple ideas:
     * Making Linux just a little more fun
     * Sharing ideas and discoveries
       
   
   
   The basic idea behind these two concepts is that Linux is one cool OS, whose price for
   admission is a willingness to read, learn, tinker (aka, hack!), and then share your
   experiences. The Gazette is a compilation of basic tips, tricks, suggestions, ideas and
   short articles about Linux designed to make using Linux fun and easy. LG began as a
   personal project of John M. Fisk, and grew to include contributions freely provided by a
   growing number of authors. Linux Journal is now publishing the Gazette using material
   contributed by outside authors (note to potential authors). Without these authors there
   would not be a Gazette, and I thank them all. Drop a note to the author of anything that
   you find helpful or instructive--the author's e-mail address is included for this very
   purpose.
   
   Linux Gazette is a non-commercial publication and will remain that way. A tar, gzip file
   containing all issues of Linux Gazette and one containing the current issue can be found at
   ftp://ftp.ssc.com/pub/lg/
   
   Thanks to Matt Welsh, coordinator of the Linux Documentation Project, for graciously
   bringing the Linux Gazette under the auspices of the LDP. The material included in these
   documents is covered by a designedly liberal copyright. For information regarding copying
   and distribution of this material read the Copying License.
   
   A new table of contents will appear with each issue that will allow you to easily find
   articles of interest. A search engine is also provided to allow you to search all issues
   for items relating to a particular subject.
   
   Have fun!
   
   
     ______________________________________________________________________________________
   
   
   
     * Table of Contents Issue #14
     * Table of Contents Issue #13
     * Table of Contents Issue #12
     * Table of Contents Issue #11
     * Table of Contents Issue #10
     * Table of Contents Issue #9
     * Table of Contents Issues #1-#8
     * Index of All Issues
       
   
     ______________________________________________________________________________________
   
   Search In: [Linux Gazette (TM).......]
   Search For: ______________________________ ______
   
   
   
   
     ______________________________________________________________________________________
   
   
   
Linux Gazette WWW & FTP Mirror Sites

   
   
    For those readers who are accessing Linux Gazette from outside the U.S. or are having
   problems with slow connections at a particular site, mirror sites are available worldwide.
   Thanks to all of the people who have kindly offered the use of their WWW and FTP sites in
   order to make this possible!
   
   
     ______________________________________________________________________________________
   
   
   
   [ Hot Linux News! ] [ Linux Resources ] 
   
     
     
     Two SSC links that you might find useful. The first is to Linux Journal 's "Hot Linux
     News" page, and the second is to SSC's Linux Resources page.
     
   
   
   
     ______________________________________________________________________________________
   
   
   
  LINUX GAZETTE IS PUBLISHED BY:
  
SSC - Publishers of Linux Journal (tm)

   
   
   
     ______________________________________________________________________________________
   
   
   
   Got any great ideas for improvements! Send your comments, criticisms, suggestions and
   ideas.
   
   Linux Gazette, http://www.ssc.com/lg/
   This page written and maintained by the Editor of Linux Gazette, gazette@ssc.com
   
   [IMAGE]
   
    "Linux Gazette...making Linux just a little more lovable!" [IMAGE]
    
   
     ______________________________________________________________________________________
   
The Mailbag!

   Write the Gazette at gazette@ssc.com
   
  CONTENTS:
     * Help Wanted -- Article Ideas
     * General Mail
       
   
   
   [IMAGE]
   
   
     ______________________________________________________________________________________
   
   
   
  HELP WANTED -- ARTICLE IDEAS
  
   
   
   
     ______________________________________________________________________________________
   
   
   
   Date: Mon, 20 Jan 97 13:22:54 EST
   Subject: Linux on Compaq 
   From: afarnsworth@S1.DRC.COM
   
   Hi,
   I just received a brand spanking new Compaq Deskpro 6000 with Adaptec 2940U SCSI card and
   Compaq Netflex III ethernet card. I think I have the SCSI card problem whipped, but how do
   I find drivers for the Netflex III card? I have check the usual places, does it even exist?
   
   
   The Compaq Deskpro 6000 is a fairly new system out, though Compaq has been building
   Deskpro's for many years. The only problem I have had with them is their proprietary
   hardware. This is usually either their Network cards or their Hard drive controllers
   (usually RAID controllers). Other than that, it's pretty standard.
   
   Please reply to my email address : afarnsworth@s1.drc.com for I don't have the ability to
   check the gazette often. Thanks.
   
   Andy Farnsworth, Dynamics Research Corporation
   
   
   
     ______________________________________________________________________________________
   
   
   
   Date: Sat, 18 Jan 1997 12:38:45 +0200 (EET)
   Subject: Office-tools From: J.Hernetkoski, jjjj@zenith.yok.utu.fi
   
   Hi! Could you write an article about these two office-package for Linux:
     * Applixware
     * StarOffice
       
   Thanks
   Jukka Hernetkoski
   
     (An article about StarOffice by Dwight Johnson appeared in issue 9 of Linux Gazette. An
     article about Applixware will be in the April issue of Linux Journal. I can probably get
     permission to run it in LG also, but not until that issue of LJ is on the stands. Which
     means it would also be the April issue of LG. Anyone want to do one sooner?--Editor) 
     
   
   
   
     ______________________________________________________________________________________
   
   
   
   Date: Tue, 21 Jan 1997 09:43:58 -0500
   Subject: Linux samba win95 
   From: nravin@cs.fit.edu
   
   -I am a system administrator....manages 20 PC's....all running windows95
   
   -We were running Windows NT server(4.0) in the lab for some time Then we realised we had
   only 10 client access licenses and so were forced tp SWITCH to Linux.
   
   -Linux emulates NT, as you may know
   
   -I had the CONFIG.POL working perfectly with the NT network. -But when I switched to Linux
   I lost that control. No longer are the clients able to access the CONFIG.POL file even
   though I have kept it in the NETLOGON share.
   
   -Now whosoever uses the PC's(most are novices) play around with the settings( of client)
   and is giving me nightmares, since I cannot lock them out.
   
   -Is there a way out? How can I make the clients read the system policies from the
   CONFIG.POL using Linux server?
   
   Please help.
   
   Thanks
   Neal
   
   
     ______________________________________________________________________________________
   
   
   
   Date: Tue, 21 Jan 1997 15:03:07 +0000
   Subject: dbms connectivity 
   From: Mike Lewis, mlewis@burly.com
   
   Hi. I love linux but most of the projects I work on preclude it because of a lack of dbms
   connectivity. None of the major dbms players (Oracle, Sybase, Informix, etc.) or 3rd party
   developers (Intersolv, Visigenic, etc.) offer access from a linux client. I've tried a
   middleware solution from Openlink and I guess you could run SCO drivers with emulation,
   assuming you can get your hands on the low-level libraries.
   
   This seems to be the only thing standing in the way of Linux getting business worthy
   respect. Could you put together a piece on this issue and explore the future availability
   of dbms connectivity from linux?
   
   Thanks.
   Mike
   
   
     ______________________________________________________________________________________
   
   
   
   Date: Wed, 22 Jan 1997 18:21:57 -0800
   Subject: X Windows & Unix 
   From: Nestor Villalobos, n.villalobos@codetel.net.do
   
   Hi there! I just got Linux from RedHat and I have been wondering how to do Animations in
   XWindows. I would like a little picture box on the lower right hand corner of the screen on
   startup to start an animation. Is this possible? If it is, please email me back with
   instructions!!! Thanks for the help.
   
   One Unix man to the other,
   Nestor Villalobos 
   
   [IMAGE]
   
   
     ______________________________________________________________________________________
   
   
   
  GENERAL MAIL
  
   
   
   
     ______________________________________________________________________________________
   
   
   
   Date: Fri, 24 Jan 1997 15:24:16 -0700
   Subject: Update web link in my article 
   From: Henry Lu, honglu@rt66.com 
   
   I have changed my web page (email is unchanged). Can you update my web page in the #10
   issue, article "setting up a Dynamic web server"?
   
   http://www.tc.umn.edu/nlhome/g625/luxx0024/ 
   
   I got couple of email inquiry about the bad link.
   
   Henry
   
     (Be happy to fix it up. We like to stay up to date. --Editor) 
     
   
   
   
     ______________________________________________________________________________________
   
   
   
   Date: Tue, 21 Jan 1997 13:20:49 -0700
   Subject: C++ Programming w/ Linux 
   From: James Cannon, cannonj@jads.kirtland.af.mil
   
   Hi,
   About a month ago I asked about help with C++ programming on Linux. I am currently using
   the Walnut Creek Slackware, kernel 1.3.20. I had a hard time getting a simple "Hello World"
   program to compile. "cc" couldn't find the ".h" files like "stdio.h", which are normally in
   /usr/include. I had to create a "$INCLUDE" variable in my ".profile". So, when compiling, I
   used "g++ -I $INCLUDE -o hello hello.c" to compile.
   
   Well, I received help via e-mail pointing me to this page:
   phttp://www.cuug.ab.ca:8001/~barkers/slackware-fixes/3.0-fixes.html 
   Look for the section titled: Problem Using G++.
   
   Great mag!
   
   James Cannon, http://www.jads.abq.com/
   
   
     ______________________________________________________________________________________
   
   
   
   Date: Thu, 23 Jan 1997 20:36:39 -0800
   Subject: Color Depths in X 
   From: Chris Spiegel, matrix@wolfenet.com
   
   (RE: Color depths in X)
   
   Well, I know this isn't really a fix, and it's not that great, but I have 2 scripts. startx
   which starts me in 16 bit color and start8, which starts in 8 bit. As I said, not a
   solution, but a pretty painless alternative...
   
   
     ______________________________________________________________________________________
   
   
   
   Date: Fri, 3 Jan 1997 17:14:19 -0500 (EST)
   Subject: Further note about the spiral notebook page design.
   From: Ben Boule, bouleb@rpi.edu
   
   Someone else noted that his web browser didn't correctly show the spiral notebook
   background. I use Netscape, so that isn't a problem for me, but I do have another problem
   with the background. It's very hard to look at on an interlaced display. I can always
   switch to a non-interlaced mode in XFree86, but I'd bet some people can't. I know that the
   interlaced mode that I use looks fine on 99.99% of web pages, so it usually isn't a problem
   for me.
   
   Thanks,
   Ben Boule
   
   
     ______________________________________________________________________________________
   
   
   
   Date: Mon, 06 Jan 1997 13:42:25 -0600
   Subject: RE: Linux networking problem with VINES 
   From: Jack N. Gallemore, jgallemore@okokc.ang.af.mil
   To: Stephen, Tauche%fbm%mfh@mfhdvzis.mfh-iserlohn.de
   
   
   Unfortunately, Banyan is a pretty tight (read: won't work with much) OS, so you are pretty
   limited. There is a way for Linux to sign onto Banyan, but you have to use DOSEMU.60.1. The
   later versions will not work. (Disclaimer: I have not used the patch for dosemu.60.4). If
   you have not used DOSEMU, the setup is fairly straightforward.
   
   As for using Linux as a resource, you will have to use IP stuff (ftp, telnet, etc) to do
   so. There are no ports for LinuxBanyan stuff.
   
   BTW, Jon is still doing Linux and Banyan. His site (http://www.netmind.com) is running
   Linux! Check it out!
   
   Jack N. Gallemore jgallemore@okokc.ang.af.mil
   
   
     ______________________________________________________________________________________
   
   
   
   Date: Mon, 20 Jan 97 16:12:00 PST
   Subject: Vines IP and TCP/IP 
   From: Denis Dimick, ddimick@irvine.ddddf.com
   
   Back on Dec 5, 1996 Stefan wrote wanting help with Vines.
   **************************************************************
   
   Stefan the problem you're having sounds like the Vines Servers are not passing TCP/IP.. By
   default Banyan Vines doesn't pass route TCP/IP thru the servers. You have to have the
   TCP/IP option installed on all the servers your going to route thru. This option cost $$$
   about $1200.00 US if I remember correctly. So there's p[robally a good chance your school
   didn't buy this option...
   
   Vines doesn't have anything that will cause IP to tunnel via Vines IP.. So your only chance
   might be to get access to the same segment that the internet is running off of... But it
   sounds like your sysadmin is using the Banyan Server as the gateway to the internet, if
   this is the case your out of luck...
   
   Since I've worked with Banyan Vines for the last 7 years, I'm sorry to say you might not be
   able to set up the Linux Box on the internet routing thru your Banyan Servers...
   
   Denis, dgdimick@sure.net
   
   
     ______________________________________________________________________________________
   
   
   
   Date: Sat, 11 Jan 1997 11:49:18 -0700
   Subject: Linux Applications and Utilities Page 
   From: David Puryear, dayear@market1.com
   
   Hi,
   I came across Linux Applications and Utilities Page while I was learning about linux. It
   helped me get the feel for what is able in linux.
   
   http://www.xnet.com/%7Eblatura/linapps.shtml
   
   The guy that maintains it is Bill Latura. I hope people will get good use out of it and
   maybe help it become even more complete:)
   
   David
   
     (We found it too; see News Bytes. --Editor) 
     
   
   
   
     ______________________________________________________________________________________
   
   
   
   Date: Tue, 14 Jan 1997 06:06:09 -0800
   Subject: isssue 8 & ftp server 
   From: Rick Lim, rick_lim@bc.sympatico.ca
   
   
   Hi there,
   thanks for hosting the gazette. Is there a way of just downloading the text of each issue?
   I have downloaded LinuxGazette_jan97.tar.gz and it seems that issue8.txt is missing. also I
   have tried to ftp LinuxGazette_dec96.tar.gz but after 1770k of 2751k the server seemingly
   goes into ignore mode, this has happened about 5 times.
   
   Thanks again
   rick
   
     (Don't know why you are having trouble ftp'ing LinuxGazette_dec96.tar.gz, but can tell
     you that you have LinuxGazette_jan97.tar.gz you have everything that is in dec96. We
     took over LG for issue 9, so there is no file issue8.txt or 1 to 7 either. We use Lynx
     to save the HTML as text. Perhaps we'll do it for 1-8 one day when we have time.
     --Editor) 
     
   
   
   
     ______________________________________________________________________________________
   
   
   
   Date: Sun, 26 Jan 1997 17:00:35 -0600
   Subject: suggestion 
   From: dave Stephens, ts@fuzzy4u.com
   
   can you put some thing in each week for the new linux ueser the newbe things
   
   thank you
   Dave
   
     (LG is posted once a month not weekly. All the material in LG is contributed to me by
     outside authors. I take whatever I get. A lot of it is geared toward the newbee, and
     this month we have a new column called "Clueless At the Prompt" by Mike List that is
     designed for the newbee. Sounds like just what you are looking for. --Editor) 
     
   
   
   
     ______________________________________________________________________________________
   
   
   
   [ TABLE OF CONTENTS ] [ FRONT PAGE ] Next 
   
      This page written and maintained by the Editor of Linux Gazette, gazette@ssc.com
      Copyright &copy; 1997 Specialized Systems Consultants, Inc.
      
   
   
   [IMAGE]
   
    "Linux Gazette...making Linux just a little more lovable!" [IMAGE]
    
   
   
   
     ______________________________________________________________________________________
   
   
   
                                          MORE 2 TIPS!
                                                  
   
   Send Linux Tips and Tricks to gazette@ssc.com 
   
   
     ______________________________________________________________________________________
   
   
   
  CONTENTS:
     * Backquote Warning
     * Browser Background Tip
     * Even Better Lowercasing of Filenames
     * Filtering Advertisements from WWW Tip
     * Getting Less to View gzipped Files 
     * Help for Help on the Bash Shell
     * Lower Your Caps
     * Making Linux Boot Floppies
     * More on Xterm Titlebar
     * Remind Tip
     * Script to Call Your Editor
     * Tip for Your Web Page
     * Titlebar Tip
     * 2 Bit Tip -- Heartbeat
     * 2 Cent Tip for xdm
     * Two 2 Cent Tips -- syslog & X Color Depth
     * X Windows Depth
       
   
   
   
     ______________________________________________________________________________________
   
   
   
   
   
   [IMAGE]
   
  BACKQUOTES WARNING
  
   
   
   Date: Tue, 14 Jan 1997 00:40:21 -0800 From: alan bailward
   
   In the $0.02 tip for using the script 'swaplogs' the commands : cp /var/adm/messages
   /var/adm/messages.'date +%d' uses the wrong quotes. The backquote not the forward quote has
   to be used here, to make the *output* of the command part of the filename.
   
   alan
   
     (Actually, the backquote is in the html. It's just that some Browser fonts wont print a
     backquote -- in fact, mine doesn't. I'm not sure how to get around this other than to
     warn people who are reading online. If you print LG out, the quotes will be in the right
     direction. --Editor) 
     
   
   
   
     ______________________________________________________________________________________
   
   
   
   
   
   [IMAGE]
   
  WWW BACKGROUND TIP
  
   
   
   Date: Wed, 8 Jan 1997 12:23:03 -0500 (EST)
   From: Kurt M. Hockenbury, kmh@linux.stevens-tech.edu
   
   
   I noticed people complaining about backgrounds making text unreadable. Personally, I got
   tired of unreadable backgrounds, as well as large image downloads, so I turned them off. I
   also turned off those annoying blink tags.
   
   How? Add these two lines to your ~/.Xdefaults file.
   
   Netscape*documentColorsHavePriority: False
   Netscape*blinkingEnabled: False
   
   In LG #13, Eje Gustafsson, gne@ffa.se writes:

>>          1.mv /var/adm/messages /var/adm/messages.prev
>>          2.touch /var/adm/messages
>>          3.kill -1 pid-of-syslogd
>>
>>       This should work on a decent Unix(like) system, and I know Linux
>>is one of them.
>
>This is NOT an proper way of truncate /var/adm/messages.
>
>It is better to do:
>
>  1.cp /var/adm/messages /var/adm/messages.prev
>  2.>/var/adm/messages or cp /dev/null /var/adm/messages (both of them makes
>the file empty).
>  3.No more.

   I'm sorry, but (at least on Linux) this is flat out _wrong_. The first method (mv & HUP) is
   the correct method of truncating syslog files (such as /var/adm/messages).
   
   Your method looses any messages that get syslog'd between steps 1 and 2; anything that
   comes in after the first cp gets overwritten when the second cp happens.

>The problem is that when you remove the /var/adm/messages syslogd gets
>confused and unhappy and you have to give syslogd a HUPSIG but if you
>just sets the file length to zero without removing the file syslogd
>don't complain. And if you are really unlucky your system will go down
>because you didn't create /var/adm/messages quick enough or forgot it.

   Not so. mv'ing /var/adm/messages doesn't bother syslogd at all, as long as you stay on the
   same partition. In fact, you can 'mv /var/adm/messages /var/adm/fish', and until syslogd is
   HUP'd or otherwise restarted, it will keep logging in the file fish. Try it if you don't
   believe me - it's true! That is because once syslogd has open()d the file, it will keep
   writing to that file until it close()s it - and a file in the Unix world is an inode, not a
   filename. (As an aside, this is how you can have the 100% full empty partition. Even though
   you unlink or rm a file, the file doesn't actually go away until all programs that have it
   open close it.)
   
   syslogd doesn't get confused at all. You can even rm /var/adm/messages, and syslogd won't
   crash your system, though eventually the partition may fill up with syslog messages you
   can't easily read since there isn't a filename associated with the log file anymore.
   
   Kurt Hockenbury, Distributed Systems Administrator
   Stevens Institute of Technology
   
   
     ______________________________________________________________________________________
   
   
   
   
   
   [IMAGE]
   
  EVEN BETTER LOWERCASING OF FILENAMES
  
   
   
    Date: Sun, 5 Jan 1997 19:17:16 -0800 (PST) From: Greg Badros, gjb@cs.washington.edu 
   
   It's even easier with zsh (3.0.x) to convert filenames to all-lowercase:

for i in *(.); mv $i ${i:l}

   The *(.) uses a modifier on the wildcard to mean "only regular files" (i.e., not
   directories). And the ${i:l} converts the variable to lowercase, so we don't have to use
   tr.
   
   This is not only shorter to type, but doesn't exec multiple programs (test + mv + tr) for
   each file, and looks at fewer files since the shell implicitly does the first test.
   
   Greg
   
   
     ______________________________________________________________________________________
   
   
   
   
   
   [IMAGE]
   
  FILTERING ADVERTISEMENTS FROM WEB PAGES USING WEBFILTER
  
   Date: Thu, 16 Jan 97 20:28:50 PST
   From: Axel Boldt, boldt@cardinal.math.ucsb.edu 
   
   Hi, In last month's Gazette, David Rudder wrote an article about how to filter
   advertisements from web pages using IPFWADM, the idea being that many ads come from the
   same site and it is easy to configure a Linux firewall to refuse all connections from such
   a site.
   
   This approach has two disadvantages: you have to be root in order to use the IPFWADM tool,
   and it allows you only to block entire sites. Very often, you want to filter out only a
   specific ad residing on a site, without blocking the rest of that site's material.
   Moreover, different users of the Linux box might have different tastes when it comes to
   ads.
   
   I believe that my tool WebFilter a.k.a. NoShit addresses these issues and is better suited
   for filtering ads from specific web sites. The idea is the following: the user runs
   WebFilter as a personal filtering proxy server, and the browser contacts this proxy
   whenever it wants to fetch a web document. The proxy then actually goes out and downloads
   the page, checks whether any filterscripts apply to this page, and if yes, pipes it through
   those scripts and returns the output to the browser. The mapping between URL and
   filterscript has to be provided by the user in advance. A filterscript can be an arbitrary
   program that reads the original document from standard input and produces the filtered
   version on standard output. In practice, filterscripts are most often short sed, awk, or
   perl scripts.
   
   If you often use sites such as Yahoo or Infoseek, you can easily write filterscripts that
   excise the ads from their pages. This saves time, money, and bandwidth.
   
   More information about WebFilter can be gotten from its homepage. There you'll also find
   links to other programs implementing the same idea.
   
   Have fun,
   Axel
   
   
     ______________________________________________________________________________________
   
   
   
   
   
   [IMAGE]
   
  GETTING LESS TO VIEW GZIPPED FILES
  
   Date: 09 Jan 1997 20:18:58 -0600
   From: Alan Shutko, ats@wydo125.wustl.edu 
   
   A little known ability of less is the ability to define filters when it opens and closes
   files. This excerpt from the man page deserves broader attention, since it can easily be
   extended to other types.
   
   For example, on many Unix systems, these two scripts will allow you to keep files in
   compressed format, but still let less view them directly:

       lessopen.sh:
            #! /bin/sh
            case "$1" in
            *.Z) uncompress -c $1  >/tmp/less.$$  2>/dev/null
                 if [ -s /tmp/less.$$ ]; then
                      echo /tmp/less.$$
                 else
                      rm -f /tmp/less.$$
                 fi
                 ;;

                      Version 321: 18 Jul 96                   16

            esac

       lessclose.sh:
            #! /bin/sh
            rm $2

   To use these scripts, put them both where they can be exe- cuted and set
   LESSOPEN="lessopen.sh %s", and LESSCLOSE="lessclose.sh %s %s". More complex LESSOPEN and
   LESSCLOSE scripts may be written to accept other types of compressed files, and so on.
   
   Alan Shutko
   
   
     ______________________________________________________________________________________
   
   
   
   
   
   [IMAGE]
   
  HELP FOR HELP ON THE BASH SHELL
  
   Date: Tue, 14 Jan 1997 15:36:50 +0100 (NFT)
   From: mailto:fk5a005@math.uni-hamburg.de 
   
   you did hear about help for the bash. if you invoke help for then you will get some help
   about for.
   
   Okay, you know that one. But did you know you can see all the helps at once? I did not know
   it. Then I tried help "$*" and what happend was: every help was shown! Of course too much
   for one screen. so I piped it to less: help "$*" |less is quite good. But then I thought
   about having a search command with less. possible? yes, just do a less -p word file to see
   it.
   
   So I put everything together and like I do often I created an alias:

alias helpall="help '$*' | less -p "

   and tried it: beautiful, I might not need man bash all the times. Try it yourself.
   
   Perhaps try helpall " let " to see a result.
   
   Have a nice and bright Linux-year!
   
   Matthias
   
   
     ______________________________________________________________________________________
   
   
   
   
   
   [IMAGE]
   
  LOWER YOUR CAPS
  
   Date: Sat, 25 Jan 1997 20:44:42 -0800 (PST)
   From: Peat Bakke, pb@europa.com
   
   One of those little things that gets to me is unzipping DOS pkzipped files. All of the
   filenames are in all caps. I'm not sure why it bugs me, but it does. Anyhow, here's a quick
   script that I've found useful to convert all the caps in a directory into lower case
   (rather nice when you've got one of those big, 200 file zips):

        #!/bin/tcsh
        foreach i (*)
        mv $1 `echo $1 | tr '[A-Z]' '[a-z]'`

   A word to the wise -- this lowers ALL caps, so be careful with those Makefiles and such.
   
   -Peat
   
   
     ______________________________________________________________________________________
   
   
   
   
   
   [IMAGE]
   
  MAKING LINUX BOOT FLOPPIES
  
   Date: Sun, 5 Jan 1997 18:40:49 -0800 (PST)
   From: Andy Kahn, kahn@vivian.cs.ucla.edu 
   
   
   After reading Bill Duncan's excellent article in issue #13 on using and managing floppies
   in Linux, I figured I'd toss in a 2-cent tip.
   
   Here is a script I use to make emergency boot floppies on my system (kernel v2.0.27). The
   need arose when I installed RedHat 4.0 for the first time and noticed that the installation
   procedure doesn't automatically prompt you to create boot floppies (Slackware does, and
   chances are that RedHat will also in the next version).
   

#!/bin/csh -f
#
# makebootfloppy v0.2
#
# DESCRIPTION:
# User friendly script (with lots of verbose messages) used to make
# Linux boot floppies, using the 2.x kernels.
#
# Formats, creates the file system, mounts the floppy, installs the Linux
# kernel, installs LILO, umounts floppy, and cleans up.
#
stty intr 
set PATH=(/usr/sbin /sbin /bin /usr/bin)

# the generic floppy device (usually auto-detected)
set GENFLOPPY=/dev/fd0

# the low-level floppy device, used with fdformat.  this might be obsoleted
# on your system
set LLFLOPPY=/dev/fd0H1440

# a temporary mount point for your floppy.  make sure it has enough space
# to copy the kernel into
set MOUNTPOINT=/tmp/floppy

# boot
set BOOT=/boot/boot.b
set KERNEL=/boot/vmlinuz

# LILO label
set LABEL=linux


# here we go!
#############
echo -n Insert a blank floppy into the drive and hit return...
set FOO=$& /dev/null
mount $GENFLOPPY $MOUNTPOINT

# Copy the kernel to the floppy
cp $BOOT $MOUNTPOINT
cp $KERNEL $MOUNTPOINT

# Install lilo
echo image=$MOUNTPOINT/`basename $KERNEL` label=$LABEL | \
    lilo -C - -b $GENFLOPPY -i $MOUNTPOINT/boot.b -c -m $MOUNTPOINT/map

sync

# Unmount floppy
umount $MOUNTPOINT

# Deleting temporary mount point
rm -rf $MOUNTPOINT

echo All done.


   
   
   
     ______________________________________________________________________________________
   
   
   
   There's currently no error handling, so if one command fails, the remaining commands will
   fail as well. Other than that, feel free to modify and use it as you like. If you have
   suggestions on better ways to do something, I'd love to hear them.
   --Andy, kahn@cs.ucla.edu
   
   
   
     ______________________________________________________________________________________
   
   
   
   
   
   [IMAGE]
   
  MORE ON XTERM TITLEBAR TIP
  
   Date: Wed, 15 Jan 1997 23:33:34 -0700 (MST)
   From: Michael J. Hammel, mjhammel@csn.net 
   
   I got a lot of email about my tip, most confused by the use of escape/control characters
   in the script. Here is my response.

> > Date: Sat, 21 Dec 1996 15:18:01 -0600
> > From: Roger Booth
> > To: Linux Journal Editor
> >
> > The Jan97 Issue 33 of Linux Journal contained the "Linux Gazette Two Cent Tips".
> > I was interested in the tip "X Term Titlebar Function". Although
> > the text of the tip stated that the tip would work in ksh-based
> > systems, I could not get it to work as shown. I think there are
> > three problems. First, I think there are a few transcription
> > errors in the script. Second, I believe the author is using


   I don't think there were transcription problems. I'm pretty sure it was the way I sent it,
   however....

> > embedded control characters and it was not obvious to me which
> > character sequences are representations of control characters
> > and which characters should be typed verbatim. Third, the


   Yes, there were control and escape characters in the file. This was a problem and many
   people wrote me to ask about it. In the following lines:

   ilabel () { echo -n "^[]1;$*^G"; }
   label () { echo -n "^[]2;$*^G"; }


   the characters "^[" are an escape character and the characters "^G" are a CONTROL-G
   character. In order to add these to your file (when you type it in by hand) using vi you
   would type:
   
   ^VESC - which means CTRL-SHIFT-V followed by the ESCAPE key
   
   and
   
   ^V^G - which means CTRL-SHIFT-V followed by CTRL-SHIFT-G
   
   Note that in *this* email I didn't actually include the control or escape characters - I
   simply used their ASCII equivalents. Hopefully this isn't too confusing.

> > author uses a command-line option to the echo command which
> > is not available on all Unix platforms.


   This is also a problem. See below.

> > I finally used the following script:
> >
> >     if [ ${SHELL##/*/} = "ksh" ] ; then
> >         if [[ $TERM = x"term" ]] ; then
> >             HOSTNAME=`uname -n`
> >             label () { echo "\\033]2;$*\\007\\c"; }
> >             alias stripe='label $LOGNAME on $HOSTNAME - ${PWD#$HOME/}'
> >             cds () { "cd" $*; eval stripe; }
> >             alias cd=cds
> >             eval stripe
> >         fi
> >     fi
> > I don't use vi, so I left out that functionality.


   I tried this and various similar responses that were mailed directly to me. It should work
   using the octal versions of the escape sequences, but I couldn't get it to work. My
   problem is that I use the label() function from the command line at times to simply set
   the title bar to some arbitrary value and using the octal sequences didn't seem to work
   for me. I'm not sure why, however. I do believe that, sometime in the distant past, I too
   used octal sequences to set the xterm title bar. I've long forgotten why I switched.

> > The functional changes I made are all in the arguments to the
> > echo command. The changes are to use \\033 rather than what
> > was shown in the original tip as ^[, to use \\007 rather than
> > ^G, and to terminate the string with \\c rather than use the
> > option -n.


   All of these should work just fine in ksh. Your observation that not all shells accept
   "echo -n" is correct. I often have to check which works and then manually set the echo
   line to either use "-n" or to print a \c. One or the other will always work, depending on
   if the echo is a shell builtin or an actual Unix command.

> > On AIX 4.1, the command "echo -n hi" echoes "-n hi"; in other
> > words, -n is not a portable command-line option to the echo
> > command. I tested the above script on AIX 3.2, AIX 4.1,
> > HPUX 9.0, HPUX 10.0, Solaris 2.4 and Solaris 2.5. I'm still
> > trying to get Linux and my Wintel box mutually configured,
> > so I haven't tested it on Linux.


   I don't use X on the AIX or HPUX boxes at work. I just rlogin from my Sun boxes. However,
   both Solaris and Linux should work with the -n option if you're using the echo shell
   builtin. If not, the \c will probably be required. On my Linux box I type

   bash% type echo


   which reports

   echo is a shell builtin


   so I know which one I'm using. Knowing this you can provide alternatives within your
   .bashrc or .kshrc to determine which version of the echo line to use. This is true of any
   Unix platform on which you use ksh or bash (I believe).

> > I have noticed a problem with this script. I use the rlogin
> > command to log in to a remote box. When I exit from the
> > remote box, the caption is not updated, and still shows the
> > hostname and path that was valid just before I exited. I tried
> > adding
> >
> >     exits () { "exit" $*; eval stripe; }
> >     alias exit=exits
> >
> > and
> >
> >     rlogins () { "rlogin" $*; eval stripe; }
> >     alias rlogin=rlogins
> >
> > Neither addition updated the caption to the host/path
> > returned to. Any suggestions?


   Add this right after the alias for cd in the original script:

   rlogins () { "rlogin" $*; cds . }
       alias rlogin=rlogins


   Its a hack, but it works. You have to use "cds" instead of the alias "cd" or else the real
   cd gets used and the title bar won't change. In case anyone is wondering, the reason you
   enclose "rlogin" (or "cd" or "vi") in double quotes in this script is so the function
   rlogins() will run the real rlogin and not get stuck recursively calling itself. Neat, eh?
   
   
   Boy, this stuff could get confusing fast. Maybe it wasn't such a good tip after all.
   
   Michael J. Hammel
   
   
     ______________________________________________________________________________________
   
   
   
   
   
   [IMAGE]
   
  REMIND TIP
  
   
   
   Date: Mon, 20 Jan 97 15:42:04 PST
   From: jmy@gim.net 
   
   This is a nice little script wich I have made, it places reminders to ~/.tcshrc or
   whatever. I think it's very useful. To use it first place at THE END OF ~/.tcshrc:

\echo
echo "--------------------( R E M I N D E R S )--------------------"
echo "-------------------------------------------------------------";\echo


   Then use this script:

------------------------------c-u-t--h-e-r-e-------------------------------
#!/bin/tcsh
# Nice little scipt that places reminders to the end of ~/.tcshrc or
whatever.
# Made by jmy@gim.net email if you like it!

echo Remind 1.0 by jmy@gim.net
if ($#argv == 0) then
echo Use like \'remind \ \\'
echo Option is \'a\' for add , \'u\' for undo and \'r\' for remove, pretty
easy
huh..:\)
\echo
echo NOTE: IF YOU REMOVED A LINE YOU DIDN\'T MEAN TO REMOVE, USE UNDO\!
\echo
exit 666
endif
if ($argv[1] == a) then
cat ~/.tcshrc | awk '\!/-------\";\\echo/ { print }' >! /tmp/remind.$user
echo echo $argv[2-] >> /tmp/remind.$user
echo 'echo "-------------------------------------------------------------";\echo'
>> /tmp/remind.$user
cp ~/.tcshrc ~/.tcshrc.remind
rm -f ~/.tcshrc
mv /tmp/remind.$user ~/.tcshrc
echo Added reminder: $argv[2-]
else if ($argv[1] == r) then
cat ~/.tcshrc | grep -v "echo $argv[2-]" >! /tmp/remind.$user
cp ~/.tcshrc ~/.tcshrc.remind
rm -f ~/.tcshrc
mv /tmp/remind.$user ~/.tcshrc
echo Removed Reminders:
diff ~/.tcshrc ~/.tcshrc.remind | awk '$2 ~ /echo/ { print$3,$4,$5,$6,$7,$8,$9,
$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25 }'
else if ($argv[1] == u) then
if (-e ~/.tcshrc.remind) then
mv ~/.tcshrc ~/.tcshrc.remtemp
mv ~/.tcshrc.remind ~/.tcshrc
mv ~/.tcshrc.remtemp ~/.tcshrc.remind
echo Undo completed
else
echo No undo file was found \(~/.tcshrc\)
endif
else
echo Error: invalid argument\(s\) run it with no argument for a short help
\echo
exit 666
endif
\echo
---------------------c-u-t--h-e-r-e--a-l-s-o------------------------------


   Dont forget to do a 'chmod a+x remind' And NEVER place any new lines after the lines you
   placed in ~/.tcshrc If you wan't to use it with some other shell it should just be like
   changing the paths in the script. And yes, it maybe should have been alot easier to put
   the reminders in a separat file, but i like this solution i'ts alot cooler...and maybe it
   can show someone how awk works.
   
   
     ______________________________________________________________________________________
   
   
   
   
   
   [IMAGE]
   
  SCRIPT TO CALL YOUR EDITOR
  
   Date: Thu, 16 Jan 97 15:21:34 PST
   From: Gary Chambers, geecee@gwi.net
   
   I just found the Linux Gazette... Thankfully! It has truly made using Linux more fun.
   
   I use the Linux version of Marko Macek's FTE editor. Since it is comprised of a separate X
   and console version, I began to get frustrated with having to manually specify a default
   editor. Now, wherever I can specify it (e.g. Pine), I use my edit script. It also provides
   similar functionality at the command line.
   
   I'm new to Linux, so there may be better ways of doing this. I submitted this for
   inclusion in your 2-cent tips (my favorite section).

#!/bin/bash

# Determine whether we're in X Windows and call the proper editor
#

if [ "$WINDOWID" = "" ]; then
       fte $1 $2 $3 $4 $5
else
       xfte $1 $2 $3 $4 $5
fi


   GeeCee, Gary Chambers
   
   
     ______________________________________________________________________________________
   
   
   
   
   
   [IMAGE]
   
  TIP FOR YOUR WEB PAGE
  
   Date: Fri, 3 Jan 1997 17:26:14 -0500 (EST)
   From: Ben Boule, bouleb@rpi.edu
   
   
   One cool tip that I have found useful is the following. If you are running your web page
   on your own machine or have the directory on NFS, put the following in your .profile :
   
   cp ~/.netscape/bookmarks.html ~/public_html/bookmarks.html
   cp ~/lynx_bookmarks.html ~/public_html/bookmarks2.html
   
   Change for different browsers and server setups.
   
   Then you can link them on your web page, and they get updated every time you log in, start
   a new xterm, etc...
   
   Of course, this assumes you don't care about other people looking at your bookmarks.
   
   Later,
   Ben Boule
   
   
     ______________________________________________________________________________________
   
   
   
   
   
   [IMAGE]
   
  RE: TITLEBAR TIP
  
   Date: Mon, 20 Jan 1997 18:40:38 +0200 (SAT)
   From: Christopher Gordon, chris@bayes.agric.za 
   
   Roger Booth sent in a corrected version of the Titlebar script. I found that in order to
   get this working on a Slackware distribution of Linux, using the bash shell, further
   modifications were neccesary. The control characters need one \ as opposed to \\. The
   "echo" command required an -e switch. The "if" statement only needed one [] not two.
   Finally, the script needed to check if "bash" was running or not. I also added a command
   to simplify the prompt. Here is the corrected script. It can be run using the source
   command.

if [ ${SHELL##/*/} = "bash" ] ; then
         if [ $TERM = x"term" ] ; then
             HOSTNAME=`uname -n`
             label () { echo -e "\033]2;$*\007\c"; }
             alias stripe='label $LOGNAME on $HOSTNAME - ${PWD#$HOME/}'
             cds () { "cd" $*; eval stripe; }
             alias cd=cds
             eval stripe
             export PS1='\$ '
         fi
     fi


   Standard disclaimers apply.
   
   Regards,
   Christopher Gordon,
   Remote Sensing, Inst. for Soil, Climate and Water
   Pretoria, South Africa
   
   
     ______________________________________________________________________________________
   
   
   
   
   
   [IMAGE]
   
  TWO BIT TIP -- HEARTBEAT
  
   Date: Wed, 22 Jan 1997 22:29:06 -0800 (PST)
   From: Kragen Sittler, kragen@netcom.com


      #!/bin/sh # This is a shell archive (produced by GNU sharutils 4.1). # To extract the files
      from this archive, save it to some FILE, remove # everything before the `!/bin/sh' line
      above, then type `sh FILE'. # # Made on 1997-01-22 22:11 PST by . # Source directory was
      `/usr/local/heartbeat'. # # Existing files will *not* be overwritten unless `-c' is
      specified. # # This shar contains: # length mode name # ------ ----------
      ------------------------------------------ # 2222 -rw-r--r-- README # 102 -rw-r--r-- crontab
      # 371 -rwxr-xr-x heartbeat # 142 -r-xr-xr-x rc.heartbeat # 1045 -rwxr-xr-x update.sessionid #
      touch -am 1231235999 $$.touch >/dev/null 2>&1 if test ! -f 1231235999 && test -f $$.touch;
      then shar_touch=touch else shar_touch=: echo echo 'WARNING: not restoring timestamps.
      Consider getting and' echo "installing GNU \`touch', distributed in GNU File Utilities..."
      echo fi rm -f 1231235999 $$.touch # # ============= README ============== if test -f 'README'
      && test X"$1" != X"-c"; then echo 'x - skipping README (file already exists)' else echo 'x -
      extracting README (text)' sed 's/^X//' 'README' && Heartbeat package X My computer seems to
      crash often -- about once every ten days. I've been wanting to know when this happens, but
      since the computer is busily crashing, it doesn't have time to tell me. (I suspect this
      happens because of power outages.) X So I wrote a simple heartbeat package, which would keep
      a record in the filesystem when it was alive. That way, I could look at this record when the
      machine crashed and tell when and how long it had crashed. X So I wrote a few scripts and
      created a new user. I named the heartbeat user 'heartbeat'. (I know it's not really kosher to
      have a nine-letter username, but the only thing that has problems with it so far is ls.) X
      heartbeat is the first script; it updates a file in /var/log/heartbeat. X Here's the meat of
      heartbeat. X X #!/bin/sh X touch /var/log/heartbeat/"`cat /var/run/heartbeat.sid`" X
      /var/log/heartbeat should be writable and executable by the heartbeat user; you may want to
      use root. heartbeat gets run once a minute on my system, from the heartbeat's crontab: X * *
      * * * /usr/local/heartbeat/heartbeat X (For some reason, my crond does not like whitespace
      before crontab entries.) X The name of the file it updates is taken from
      /var/run/heartbeat.sid. (I'm not sure /var/run is really an appropriate place to put this,
      but I couldn't find a better place.) This file should be readable and writable by the
      heartbeat user. X heartbeat.sid is updated at boot time by a Perl script called
      update.sessionid. update.sessionid also puts some information in the file that heartbeat
      updates. X I run update.sessionid (as the heartbeat user) from /etc/rc.d/rc.M, just before
      cron is started. X Here's the section from my rc.M: X X.... # # Update heartbeat sessionid. #
      This helps us find out when there was a crash. [ -x /etc/rc.d/rc.heartbeat ] &&
      /etc/rc.d/rc.heartbeat X # Start crond (Dillon's crond): X.... X and here's
      /etc/rc.d/rc.heartbeat: X #!/bin/sh # Update the heartbeat sessionid. # This should be done
      before starting cron. su heartbeat -c /usr/local/heartbeat/update.sessionid X Now, when I
      want to know when the machine crashed, I can look in /var/log/heartbeat for the times of
      system shutdowns -- planned or otherwise. SHAR_EOF $shar_touch -am 0122221197 'README' &&
      chmod 0644 'README' || echo 'restore of README failed' shar_count="`wc -c 'crontab' && # MIN
      HOUR DAY MONTH DAYOFWEEK COMMAND * * * * * /usr/local/heartbeat/heartbeat SHAR_EOF
      $shar_touch -am 0122221197 'crontab' && chmod 0644 'crontab' || echo 'restore of crontab
      failed' shar_count="`wc -c 'heartbeat' && #!/bin/sh # script to continually update a file's
      timestamp, except when the machine # is down # # This should be put in a crontab to be run
      every minute, or five minutes, # or whatever. # # /var/run/heartbeat.sid contains a sessionid
      that is incremented at each # bootup, and is suitable for use as a filename. X touch
      /var/log/heartbeat/"`cat /var/run/heartbeat.sid`" SHAR_EOF $shar_touch -am 0122210097
      'heartbeat' && chmod 0755 'heartbeat' || echo 'restore of heartbeat failed' shar_count="`wc
      -c 'rc.heartbeat' && #!/bin/sh # Update the heartbeat sessionid. # This should be done before
      starting cron. su heartbeat -c /usr/local/heartbeat/update.sessionid SHAR_EOF $shar_touch -am
      0122221197 'rc.heartbeat' && chmod 0555 'rc.heartbeat' || echo 'restore of rc.heartbeat
      failed' shar_count="`wc -c 'update.sessionid' && #!/usr/bin/perl # Update sessionid for
      heartbeat, creating new sessionid file. # This should be run at boot time. X my
      $sessionidfile = "/var/run/heartbeat.sid"; my $heartbeatdir = "/var/log/heartbeat"; X open
      SESSIONIDFILE, $sessionidfile or X die "Couldn't open for read"; X my $sessionid = ; close
      SESSIONIDFILE; chomp $sessionid; X if ($sessionid !~ /^[a-zA-Z]*[0-9]{4,}$/) { $sessionid =
      "boot0000"; } X $sessionid ++; X open SESSIONIDFILE, ">$sessionidfile" or X die "Couldn't
      open for write"; X print SESSIONIDFILE "$sessionid\n"; close SESSIONIDFILE; X my
      $heartbeatfile = "$heartbeatdir/$sessionid"; X open HEARTBEATFILE, ">$heartbeatfile" or X die
      "Couldn't open for write"; X my $message = failed after open; fs full? stopped"; X close
      HEARTBEATFILE; X Xexit 0; SHAR_EOF $shar_touch -am 0122211997 'update.sessionid' && chmod
      0755 'update.sessionid' || echo 'restore of update.sessionid failed' shar_count="`wc -c
      
   
   
   
     ______________________________________________________________________________________
   
   
   
   
   
   [IMAGE]
   
  2 CENT TIP FOR XDM
  
   Date: Sun, 5 Jan 1997 21:28:02 -0600 (CST)
   From: Andrew Dyer, adyer@Mcs.Net
   
   here are several ways you can dress up an xdm login screen:
   
    1. use the 'Xbanner' program available on sunsite
    2. run a program like xearth or xfishtank that writes to the X login screen background
    3. use a static image display program like 'xv' to put up a simple bitmap
       
   I use xv to put up an image - to do this add a line like the following to the file
   /usr/X11R6/lib/X11/xdm/Xsetup_0 (at least that's where is is in my system (Caldera)):
   
   /usr/X11R6/bin/xv -rmode 1 -nc 64 -quit /home/adyer/pics/arcade.bmp
   
   This line will run 'xv' to put the image file at the end of the command line onto the
   background window in 'root tiled' mode, dithers the image to only use 64 colors (to
   preserve colormap slots on my 256 color display), and tells xv to exit after doing this.
   
   Note that if you run a program like xearth it will continue to run after you have started
   the session and will contiinue to run by default until the session is exited. See the
   'xdm' man page for more details.
   
   !!!!!!!!!!!!! !! WARNING !! !!!!!!!!!!!!!
   
   programs run by xdm are usually run as root, and so pose a potential security risk if they
   are not specifically designed for this. You have been warned :-)
   
   Andrew M. Dyer
   
   
     ______________________________________________________________________________________
   
   
   
   
   
   [IMAGE]
   
  TWO 2 CENT TIPS -- SYSLOG & X COLOR DEPTH
  
   Date: 13 Jan 1997 10:33:29 +0100
   From: Marco Melgazzi, marco@techie.com 
   
   Dear sirs
   
   Here's two 2c tips for your wonderful Linux Gazette. Note that all the lines ending with \
   have to be joined on one line.
   
   1. :::: Syslog fun (oh no, not again) :::::
   
   Everybody seem to like to put a line like the following in their syslog:

       *.*  /dev/ttyx


   this way every message is printed on an unused tty and the curious ( or worried ) user can
   switch to it and see what's going on. This approach has a big advantage ( it doesn't use
   any system resource ) and a couple of disadvantages ( notably you have to switch to text
   mode to read the messages and then you don't have scrollback ). So I have this little
   workaround: in /etc/syslog.conf put something like

       *.*                     /var/adm/current_session_log


   In rc.local or whatever file is called before starting syslog

       /bin/cat /dev/null > /var/adm/current_session_log


   In fvwm you can add something like this:

Style "tail" NoTitle, NoHandles, Sticky, WindowListSkip
Style "tail" StaysOnTop, CirculateSkip

*GoodStuff             S-Log   telnet-sm.xpm           Exec "rxvt" \
                       rxvt -geometry 132x45-0+0 -sl 1200 -font fixed \
                       -e tail -n 1200 -f /var/adm/current_session_log &


   So when you press the goodstuff button named 'S-log' you get a big rxvt with a nice
   scrollback buffer that displays exactly what's going on in the system. If your linux
   system stays up for weeks at a time you'll probably have to set up a CRON entry that trims
   this file every once in a while but this is left as an exercise for the reader ;-)
   
   To pop down the rxvt a simple Ctrl-C is more than enough. By the way, this approach will
   surely save a lot of stress to the monitor electronics: in fact switching from text mode
   to hires a) takes time b) involves quite a lot of non-trivial adjustments in the monitor
   circuitry so it could likely acceelerate its ageing process.
   
   2. ::::: How to use X with more than one color depth ::::::
   
   I normally use X in 8bit ( since my board is not VRAM based 1152x864 at 70Hz slows down
   things considerably ) but, since when I hacked my XF86_S3 to let me use higher clocks in
   16bit mode :), occasionally I need to switch to the 16bits depth (notably when using the
   oh-so-amazing 'The Gimp').
   
   Since leaving two servers up and running all the time via xdm seemed a waste of memory, by
   tinkering with manual pages and articles from the net I came up with a viable alternative.
   
   
   Let me first tell you one thing: in this way, when the second server is running, you get
   both :0 (in 8bit) that is managed by xdm and :1 that has been started on-demand. Since I
   don't usually use :1 while I'm online I didn't took the time to provide MIT-MAGIC-COOKIE
   authorization for it: this is a thing you -should- do if you plan to use this on the net.
   
   Here there are a couple of my scripts:

::: ----------------------------------------------------------------
:::/usr/local/bin/1open16
::: ----------------------------------------------------------------
xinit ~/.x_rc_for_1_16  -- /usr/X11/bin/X16 :1 vt8 &

::: ----------------------------------------------------------------
:::/usr/X11/bin/X16
::: ----------------------------------------------------------------
#!/bin/sh
exec XF86_S3.new -bpp 16 ${@+"$@"}

::: ----------------------------------------------------------------
:::~/.x_rc_for_1_16
::: ----------------------------------------------------------------
#!/bin/sh
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $

userresources=$HOME/.Xresources_for_1_16
usermodmap=$HOME/.Xmodmap
sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap

export PATH= .... path ....

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    xrdb -merge -display :1 $sysresources &
fi

if [ -f $sysmodmap ]; then
    xmodmap -display :1  $sysmodmap &
fi

if [ -f $userresources ]; then
    xrdb -merge -display :1  $userresources &
fi

if [ -f $usermodmap ]; then
    xmodmap -display :1  $usermodmap &
fi

....
misc other variables
....

exec fvwm -f .fvwmrc_for_1_16

::: ----------------------------------------------------------------
::: in ~/.fvwmrc_for_1_16 I have this: I'm not sure this duplication
::: is necessary but in my configuration it is. YMMV
::: ----------------------------------------------------------------
Function "InitFunction"
    Exec    "I"     xrdb -display :1 -merge ~/.Xresources &
    Exec    "I"     xmodmap -display :1 ~/.Xmodmap &
       Module  "I"             GoodStuff
       Exec    "I"         emacs &
EndFunction


   In this way when you execute the 1open16 script you will get a 16bit screen on :1 at the
   default resolution you put in your system XF86Config for 16bit depth.
   
   Things get a little more hairy if you want to open the new screen with a different set of
   resolutions: unluckily ( I guess for security reasons ) XFree lets you use a new
   XF86Config -only- if you are root. So to play Quake on :1 you have to do the following...

::: ----------------------------------------------------------------
::: in ~/.fvwmrc ( this is nice for password requests, I use it all the
::: time, just put the word 'Password' in the rxvt that you need and use
::: the supplied style. I use it for going online, to access netscape &
::: other net stuff ( I'm paranoid so I created a user named -net- that
::: I use for all internet related stuff, I hate live-data trojans etc.)
::: you get the point.)
::: ----------------------------------------------------------------
Style "*Password" NoTitle, NoHandles, Sticky, WindowListSkip,StaysOnTop

::: in a menu entry
Exec   "Quake (normal)"                exec rxvt -fn \
       "-b&h-lucidatypewriter-medium-r-*-*-*-180-75-75-*-*-*-*" \
       -geometry 40x1+1-1 -T \"Quake Password" -e \
       su root -c "/home/marco/bin/qk" &

::: ----------------------------------------------------------------
::: /home/marco/bin/qk. The redundant su is needed if you plan to launch
::: this file from the command line too.
::: ----------------------------------------------------------------
cd /home/marco/quake
su -c "xinit ./xf86quake  -- /usr/X11/bin/X -bpp 8 :1 vt8 -xf86config \
       /home/marco/lib/XF86Config.quake"


   Of course /home/marco/lib/XF86Config.quake will contain only the resolution that I usually
   play quake at ( that is 400x300 or 512x384 ). In this way you can play quake without
   hassless even if you usually run at 1000-or-so x 800-or-so at whatever depth. Now if only
   Linus released the updated 1.06 xf86quake ;-) (in 1.01 you can't use a custom heap, you
   have the fixed 8mb one :( ).
   
   Hope you'll like these tips!
   
   Marco Melgazzi
   
   
     ______________________________________________________________________________________
   
   
   
   
   
   [IMAGE]
   
  X WINDOWS COLOR DEPTH
  
   Date: Fri, 17 Jan 1997 08:38:20 -0500 (EST)
   From: Aaron B. Dossett, aarond@ewl.uky.edu 


      >I have recently been messing with my x-server, and have managed >to get a depth of 16, ie
      2^16 colors. This works >really nice with Netscape, but some programs (doom, abuse, and
      >other games) wont work with this many colors. Do >you know of a fix? I have tried to get X
      to support multiple >depths--to no avail. The man-page suggests that some >video cards
      support multiple depths and some don't. How do I know >if mine does.
      
   Well, if your video card has enough RAM and you've got enough modes defined in your
   XF86Config file then you can specify the bit depth from the command line. If you have a
   link called X to the server then the command

  X -bpp 8 or X -bpp 16 or X -bpp 24


   can be used. I like to alias the commands X8, X16, and X24 to the above. For this to work
   best you should have your XF86Config file setup so that each mode uses the maximum
   resolution possible.
   
   Aaron Dossett, aarond@ewl.uky.edu
   
   
     ______________________________________________________________________________________
   
   
   
   [ TABLE OF CONTENTS ] [ FRONT PAGE ] Back Next 
   
   
     ______________________________________________________________________________________
   
   
   
   
   
      This page maintained by the Editor of Linux Gazette, gazette@ssc.com
      Copyright &copy; 1997 Specialized Systems Consultants, Inc.
      
   
   
   [IMAGE]
   
    "Linux Gazette...making Linux just a little more lovable!" [IMAGE]
    
   
     ______________________________________________________________________________________
   
   News Bytes
   
  CONTENTS:
     * News in General
     * Software Announcements
       
   
   
   [IMAGE]
   
   
     ______________________________________________________________________________________
   
   
   
  NEWS IN GENERAL
  
   
   
   
     ______________________________________________________________________________________
   
   
   
  LINUX GAZETTE ITALIAN EDITION
  
   
   
   Date: Fri, 10 Jan 1997 14:42:52 +0100
   The first issue of the Italian Edition of the Linux Gazette, is now available on our site,
   www.media.it/LUGBari/lgtp/index.html. It is in the spirit of helping italian Linux users
   and, naturally, this italian edition is under the copying license of your original Linux
   Gazette.
   
   Bye (and many many thanks!)
   Francesco De Carlo, fdecarlo@sole.media.it 
   CICCIO-X, LUGBari Coordinator
   
   
     ______________________________________________________________________________________
   
   
   
  LINUX ADVOCACY MINI-HOWTO
  
   
   
   Date: Sat, 11 Jan 1997 11:53:19 +0100 (MET)
   This is the Linux Advocacy HOWTO and is intended to provide guidelines and ideas to assist
   with your Linux advocacy efforts. -- authored by Paul L. Rogers, Paul.L.Rogers@li.org 
   
   Related Links:
   Lars Wirzenius also has some thoughts about Linux advocacy.
   
   The Linux Advocacy Project's goal is to encourage commercial application developers to
   provide native Linux versions of their software.
   
   
     ______________________________________________________________________________________
   
   
   
  LINUX IN THE NEWS
  
   
   
   Linux was chosen by PC Week as part of its list for the top ten products of 1996. See the
   December 16, 1996 issue. The same issue has a related article about Linux and the Internet.
   
   
   
     ______________________________________________________________________________________
   
   
   
  LINUX SITES TO CHECK OUT
  
   
   
   http://www.m-tech.ab.ca/linux-biz
   This site contains anecdotal references about the commercial applications of Linux. Example
   uses of Linux in various industries, fulfulling various tasks are listed. Includes form /
   CGI script that visitors can use to enter data about their own commercial Linux sites.
   -- Idan Shoham, idan@m-tech.ab.ca
   
   http://www.xnet.com/~blatura/linapps.shtml 
   The Linux Applications and Utilities List is an organized collection of pointers to the WWW
   home pages of over 600 different Linux compatible application programs, system admin tools,
   utilities, device drivers, games, servers, programming tools, file, disk and desktop
   managers, internet apps, and more. The January 8 edition has added links to over 80 new
   programs, as well as corrections to numerous existing listings. -- Bill Latura,
   blatura@xnet.com
   
   http://www.linuxware.com
   This site is a Linux Support, Information, and general purpose Linuxer Hangout Site -- a
   meeting place for people interested in learning more about Linux, providing help to other
   Linuxers, and promoting Linux!!! -- Peter Lazecky, peter@linuxware.com 
   
   
     ______________________________________________________________________________________
   
   
   
  PNG ARTICLE (SEE ISSUE13) UPDATE
  
   
   
   Apparently Netscape has finally committed to supporting PNG in Navigator and actually made
   public statements to that effect at its Internet Developers' Conference last October,
   although there's no indication of it anywhere on their web site. The only question is when:
   Navigator 4.0 has a fixed release date, and PNG support may not be ready by then.
   -- Greg Roelofs, newt@pobox.com 
   
   
     ______________________________________________________________________________________
   
   
   
  ROCHESTER, REVISED OS SEMINAR SERIES SCHEDULE
  
   
   
   Date: Sun, 12 Jan 1997 02:36:18 GMT
   Computer Science House at Rochester Institute of Technology Presents: an Operating System
   Seminar Series Wednesday evenings at 8:00PM. Attendance is free of charge and is open to
   the public.
     * February 5: The Inferno Operating System for Everything From Embedded Systems To
       Network Operating Systems. - David Bort (Student, RIT)
     * February 12: Sun Microsystems new JAVA Based Network Computers - Jeff Rice (Sun
       Microsystems)
     * February 19: ShagOS -- An experimental Object Oriented Micro kernel. - Frank Barrus
       (Xerox)
     * February 26: Solaris - Geordie Klueber (Sun Microsystems)
       
   
   
   For additional information, directions, comments or if you would like to be a guest
   speaker, e-mail tad@csh.rit.edu.
   Computer Science House, cshouse@csh.rit.edu,
   http://www.csh.rit.edu/os-seminars
   
   
     ______________________________________________________________________________________
   
   
   
  LINUX CD GIVEAWAY LIST
  
   
   
   Date: Mon, 13 Jan 1997 05:16:52 GMT
   If you have a spare Linux CD to give away, you can list your email address at
   
   http://emile.math.ucsb.edu:8000/giveaway.html
   
   Interested parties will contact you, then send in a self-adressed stamped envelope and you
   send them the CD.
   
   If you would rather (or in addition) lend a Linux CD locally, you can now specify that as
   well.
   
   For additional information:
   Axel Boldt, boldt@math.ucsb.edu, http://www.math.ucsb.edu/%7Eboldt/ 
   Univ of California at Santa Barbara, Dept of Mathematics
   
   
     ______________________________________________________________________________________
   
   
   
  LINUX BROWSER PROJECT - A NEW WWW BROWSER FOR LINUX
  
   
   
   Date: Tue, 14 Jan 1997 06:34:56 GMT
   Announcing the Linux Browser Project -- a group of developers developing a world wide web
   browser for Linux and other platforms. The goal of this project is to develop a web browser
   which consists of a modular program architecture based around a small, fast kernel which
   would load necessary modules on demand.
   
   The project is in its early stages, and we are announcing the project at the moment to make
   ourselves known to the rest of the Linux community. If anyone would be interested in
   helping us out in any way, please feel free to join the mailing lists or visit the web site
   and let us know that you are willing to help. For additional information:
   See the Linux Browser Project home page at http://www.tjhsst.edu/LBP/.
   Jason A. Miller, Project Coordinator, jasonm@trib.com,
   The Linux Browser Project Team 
   
   [IMAGE]
   
   
     ______________________________________________________________________________________
   
   
   
  SOFTWARE ANNOUNCEMENTS
  
   
   
   
     ______________________________________________________________________________________
   
   
   
  XFMAIL 1.0 - MAIL PROGRAM FOR X
  
   
   
   Date: Sun, 05 Jan 1997 00:59:12 GMT
   Xfmail 1.0 is finally out! XFMail is an X-Windows application for sending and receiving
   electronic mail. It uses the XForms GUI library toolkit by T.C. Zhao and Mark Overmars.
   
   It has a user-friendly interface and online help to make it easy to use. It implements most
   of the mail functionality in one program and it does not require any additional tools.
   
   You can ftp XFMail at:
   
   ftp://ftp.x.org/contrib/applications/xfmail-1.0.tar.gz
   ftp://Burka.NetVision.net.il/pub/xfmail/xfmail-1.0.tar.gz
   
   For additional information:
   http://Burka.NetVision.net.il/xfmail/xfmail.html 
   Jacek Bochenek, jacek@coig.katowice.pl 
   Organization: COIG S.A.
   
   
     ______________________________________________________________________________________
   
   
   
  IMAGEMAGICK 3.7.9 ELF BINARIES - GENERAL IMAGE MANIPULATION TOOL
  
   
   
   Date: Sun, 05 Jan 1997 00:59:19 GMT
   ImageMagick (TM), version 3.7.9, is a package for display and interactive manipulation of
   images for the X Window System.
   
   ImageMagick supports also the Drag-and-Drop protocol form the OffiX package and many of the
   more popular image formats including JPEG, MPEG, PNG, TIFF, Photo CD, etc.
   
   You will also need the package libIMPlugIn-1.0-elf to get it working. Here are the
   locations you can get the packages from:

      Site: sunsite.unc.edu /pub/Linux/X11/xapps/graphics 942k ImageMagick-3.7.9-elf.tgz 1k
      ImageMagick-3.7.9-elf.lsm 886k libIMPlugIn-1.0-elf.tgz 1k libIMPlugIn-1.0-elf.lsm
      
   For additional information:
   Alexander Zimmermann, Alexander.Zimmermann@FMI.Uni-Passau.de,
   http://www.uni-passau.de/~zimmerma 
   Organization: Universitt Passau
   
   
     ______________________________________________________________________________________
   
   
   
  VISUAL TCL 1.07 BETA
  
   
   
   Date: Sat, 11 Jan 1997 02:42:27 GMT
   Visual Tcl 1.07b is a quality application development environment for UNIX, Windows and
   Macintosh platforms. Visual Tcl is written entirely in Tcl/Tk and covered by the GNU
   General Public License.
   
   Please choose the location nearest you since my connection can become saturated at peak
   times.

      Home Site: http://www.neuron.com/stewart/vtcl/ Australia:
      http://holmes.ccs.deakin.edu.au/vtcl/ United Kingdom: http://www.jessikat.demon.co.uk/vtcl/
      Germany: http://www.ifconnection.de/~rjs/vtcl/ US East:
      http://www.ultra.net/~eugene/mirror/vtcl/ US Mid: http://chaos.uark.edu/vtcl/
      
   For additional information:
   Stewart Allen, stewart@neuron.com 
   
   
     ______________________________________________________________________________________
   
   
   
  NEXS 1.3-BETA X-WINDOWS SPREADSHEET NOW AVAILABLE
  
   
   
   Date: Mon, 13 Jan 1997 05:16:23 GMT
   X Engineering Software Systems (XESS Corp.) announces the immediate availability of the
   BETA version of the NExS 1.3 spreadsheet for Linux and UNIX workstations.
   
   NExS, the Network Extensible Spreadsheet, is a full-featured, graphical spreadsheet
   developed specifically for UNIX and the X Window System. NExS has more than 237 built-in
   business and scientific functions, allows user-customized functions, displays data using 2
   and 3 dimensional graphs, and imports and exports data in a wide variety of formats
   (including HTML tables).
   
   Demonstration copies and additional conNExions plug-ins may be downloaded from
   http://www.xess.com. NExS is priced at $149 for the Personal Edition, and $249 if a
   floating license is desired. For addtional information:
   xess@vnet.net 
   Vnet Internet Access, Inc. - Charlotte, NC.
   
   
     ______________________________________________________________________________________
   
   
   
  PHT RELEASES RED HAT 4.0
  
   
   
   Date: Tue, 14 Jan 1997 06:35:52 GMT
   Pacific HiTech is proud to announce the release of our newest Linux product for the i386
   architecture:
   
   Turbo Linux: Red Hat 4.0
   
   It features a modular 2.0.18 kernel, better networking, more packages, and, of course, the
   floppy-less install. The second CD contains the entire contrib/ directory from
   ftp.redhat.com (the Live Filesystem was scrapped in order to put the contrib/ directory on,
   which we felt would be more useful for more people).
   
   The 2 CD set is only $19.95 plus s/h. If you want more details on the product, visit
   http://www.pht.com/linux.
   
   For additional information:
   Scott M. Stone, sstone@pht.com
   Chief Linux Developer/UNIX SysAdmin for Pacific HiTech, Inc. http://www.pht.com/ 
   
   
     ______________________________________________________________________________________
   
   
   
  PHT RELEASES MKLINUX DR2
  
   
   
   Date: Tue, 14 Jan 1997 06:35:56 GMT
   Pacific HiTech is proud to announce our newest Linux offering for the PPC architecture:
   
   MkLinux DR2 is the latest pre-release version of MkLinux, and it is MUCH MUCH better than
   DR1 - more stable, more hardware support, and a much smoother installation. It was
   uncompressed from the FTP distribution and burned as a Macintosh HFS format CD - you don't
   need to decompress the files onto your hard drive, you can just put in the CD and GO.
   
   It's only $19.95 plus s/h. See http://www.pht.com for ordering information, or email
   sales@pht.com.
   
   For additional information:
   Scott M. Stone, sstone@pht.com
   Chief Linux Developer/UNIX SysAdmin for Pacific HiTech, Inc. http://www.pht.com/ 
   
   
     ______________________________________________________________________________________
   
   
   
   [ TABLE OF CONTENTS ] [ FRONT PAGE ] Back Next 
   
   
     ______________________________________________________________________________________
   
   
   
      This page written and maintained by the Editor of Linux Gazette, gazette@ssc.com
      Copyright &copy; 1997 Specialized Systems Consultants, Inc.
      
   
   
    "Linux Gazette...making Linux just a little more lovable!" [IMAGE]
    
   
   
   
     ______________________________________________________________________________________
   
   
   
                                         THE ANSWER GUY 
                                                  
   
    By James T. Dennis, jimd@starshine.org
    
   
   
   
     ______________________________________________________________________________________
   
   
   
  CONTENTS:
     * Netscape Mail Block
     * Dealing with e-mail on a pop3 server
     * Security Problem
     * More on Security Problem
     * Dial-up Problem
     * X Window Problem
       
   
   
   
     ______________________________________________________________________________________
   
   
   
   
   
  NETSCAPE MAIL BLOCK
  
   
   
   Date: Sun, 15 Dec 1996 23:16:10 -0800 (PST)
   
   hi... mitch here in mobile, alabama...
   i need to refuse to accept email from a particular person... how can i configure netscape
   and/or cnd1.0 to bounce the person's mail back to them? 
   
   I'd use procmail. CND uses procmail as your "local delivery agent" (by default). This means
   that sendmail passes any mail to a local account to procmail and lets procmail due the
   final delivery to your mail box (/var/spool/mail/$YOUR_LOGIN_NAME).
   
   However, when procmail does this, it checks for a .procmailrc file in your home directory
   (and does some ownership and permissions checks on it for you).
   
   procmail is a little programming language specifically for processing mail.
   
   Your .procmailrc file can have a variety of settings and clauses (which are called
   "recipes" by the author). You can also modularize this by using a variety of INCLUDE
   directives. Here's a simple example that should get you started.

:0 hr
* ^From.*spammer.you.despise@spamhaven.com
* !^FROM_MAILER
* !^FROM_DAEMON
* !^X-Loop: ${USERNAME}@`hostname`"
| (formail -r -A"X-Loop: ${USERNAME}@`hostname`" \
   -A"Precedence: junk" ;\
   echo "Your mail is not welcome here."
   echo "Please don't mail me again."
   echo
   cat ~/your.signature.or.flame
   )

   The :0 marks this as a new recipe (so each new recipe starts with a :0 line). The 'h' on
   that line is one of several flags to procmail about what parts of the message to hand to
   your action line (which comes up later). 'h' says: give me the header 'r' says: treat the
   incoming data as "raw" (so his failure to put a blank line at the end of his message won't
   cause your response to fail).
   
   The four "star" lines after that are conditions -- the first specifies that the header
   indicates that the message be "from" your spammer (or unwanted sender). This will actually
   match any "from" or "From:" line that contains your targets e-mail address. The next two
   lines try to ensure that you don't respond to daemons and mailers (mailing lists). The next
   one (which you should fill in with your username and hostname) makes sure that your don't
   respond to your own response.
   
   Those three conditions are to protect your script from being tricked into doing bad things.
   Consider them to be the minimum overhead on any autoresponders that you write.
   
   The next line (starting with a "|" pipe character) is the action to take.
   
   In procmail there are three types of actions. A filename simply specifies an mbox (elm,
   pine, or mailx compatible) folder to file this away in. A directory name specifies an mh or
   mmdf folder to store the message in (mh and mmdf use different naming schemes for the
   messages in their folder directories -- you don't need to worry about this unless you use
   on of these mail user agents). A '!' (bang) line specifies an e-mail address to which to
   bounce the message. A '|' (pipe) line specifies that the message should be filtered through
   a local program.
   
   formail is a program that comes with the procmail package. It "formats mail headers." This
   particular formail command formats a "reply" (-r) header and adds two additional header
   lines -- a standard "Precedence: junk" line and a personal "X-" line (which the RFC822 spec
   allows you to use to embed custom information into a header). This is where your message
   adds the line that would prevent an attack by routing your response back into your script
   (a mail loop).
   
   The echo and cat statements after the formail line just provide output that is appended
   after the mail header. This becomes the body of your response. You can add additional echo
   lines -- or you can create a file and just 'cat' it here.
   
   If you are new to procmail (which is almost certain given your question -- autoresponders
   are some of the first things procmail'ers learn) you may be nervous about 'breaking'
   something and losing some of your mail. So -- to protect yourself from that you might want
   start your .procmailrc with the following simple recipe:

        :0 c
        fallback

   Which (if it is the *first* recipe) simply appends a copy of every incoming message to a
   file (in your ~/Mail directory by default) named fallback. You can compare the contents of
   that folder to your inbox until you're confident that things are working as you expect.
   
   Please read the procmail and procmailex (examples) man pages for more details. The author
   Stephen van der Berg, has also written an automated mail list management package called
   SmartList -- which is highly regarded among people who've tried it. I like SmartList *much*
   more than majordomo.
   
   --Jim
   
   
     ______________________________________________________________________________________
   
   
   
   
   
  DEALING WITH E-MAIL ON A POP3 SERVER
  
   Date: Tue, 28 Jan 1997 04:02:06 -0800 (PST)
   
   From Moe Green:
   
   Is there any way (or any program out there) which will not only get my email from a pop3
   server off of one account, then distribute it to multiple users on my system by either the
   from: or subject: lines???
   
   Example: Perhaps popclient could get the mail and save to temp, then is there a program
   which would go through and say, hmmm...this mail is from johndoe@linux.org and it goes to
   root...then the next message is from mike@canoe.net and it goes to dave???
   
   Thanks for your time, keep up the good work.
   -Moe Green, starved@ix.netcom.com 
   
   It is possible to write procmail scripts that can do this sort of thing. However I don't
   recommend this approach at all.
   
   The current version of 'popclient' is called 'fetchmail' (because it supports IMAP and some
   other mail store and forward protocols).
   
   It's default is to fetch the mail from your POP or IMAP server and feed it to the smtpd
   (sendmail) on your local host. This means that any special processing that would be done by
   the aliases or .forward files (especially any processing through procmail scripts) will be
   done automatically.
   
   It is possible to over-ride that feature and feed the messages through a pipe or into a
   file. It is also possible, using procmail or any scripting language, to parse and dispatch
   the file. Using anything other than procmail would require that you know *alot* about
   RFC822 (the standard for internet mail headers) and about e-mail in general.
   
   I did write an article on procmail this month -- but may have submitted it too late for
   inclusion into this month's Linux Gazette. The gist of it is available on my own mail
   server (send mail to info@starshine.org with a subject of ``procmail'' or ``mailbot'').
   
   The reason I don't recommend all of this is that it violates the intentions and design of
   internet e-mail. A better solution is to find a provider of UUCP services (or at least
   SMTP/MX services). UUCP is the *right* way to provide e-mail to disconnected (dial-up)
   hosts and networks. It was designed and implemented over 25 years ago and all of the mail
   systems on the Internet know how to gateway to UUCP sites.
   
   As for SMTP/MX services for disconnected hosts/networks. Various ways of hacking sendmail
   and DNS configurations have been developed in the last few years -- with a variety of shell
   scripts and custom programs to support them. All of these provide essentially the same
   services as mail via UUCP over TCP -- but without conforming to any standard (meaning that
   whatever you learn and configure with one ISP probably won't work with the next one).
   
   Glad I could help. I hope that article on procmail helps.
   
   --Jim
   
   
     ______________________________________________________________________________________
   
   
   
   
   
  SECURITY PROBLEM
  
   Date: Tue, 28 Jan 1997 04:02:06 -0800 (PST)
   
   From Jay:
   
   Recently a cracker got into my linux system on the internet. He didn't do a lot of damage
   but he did turn off system logging. I guess so I couldn't see what he'd done. Now I can't
   get it working again....
   
    1. I've made sure that the syslogd program is running using 'ps'
    2. I've read the syslogd.conf file to make sure it's logging everything, and where it's
       going to.
    3. I've checked permissions on the log file
    4. I did a 'kill -HUP' on the syslogd process and it writes 'restart' to the log
    5. 'logger' does nothing when I run it (no log entry, no error)
    6. All my C programs that wrote to syslog don't anymore
       
   Anyone have any good ideas what to do from here?
   
   Thanks
   --Jay, jay@shadow.ashpool.com
   
   
   I do but they are rather too involved for me to type up tonight.
   
   I really recommend that you reinstall the OS and all binaries from scratch whenever you
   think that root has been compromised on a system. I realize that this is a time-consuming
   proposition -- but it is the only way to really be sure.
   
   I also recommend tripwire (ftp.cs.perdue.edu in the COAST archive -- and it's mirrors).
   
   Please feel free to write me if you continue to have system security problems.
   jimd@starshine.org
   
   Sorry to take so long to respond. I've been literally swamped all month.
   
   --Jim
   
   
     ______________________________________________________________________________________
   
   
   
   
   
  MORE ON SECURITY PROBLEM
  
   Date: Tue, 28 Jan 1997 18:56:22 -0800 (PST)
   
   From Jay:
   
   >>> Recently a cracker got into my linux system on the internet.
   >>
   >> Did you restart the whole system?
   >> I would consider replacing syslog from your CD's and
   >> restarting your system.
   >
   I found that the cracker had replaced my syslogd with a packet sniffer. I think he had
   copied the syslogd code and replaced parts of it with his sniffer. It seemed to have some
   functionality but not a lot...
   
   I also found a SUID version of bash in my /tmp directory. My thought is that this is how
   he originally got root access. 
   
   Not too surprising. He was probably using a 'rootkit.' However he obviously didn't do a
   very good job of covering his tracks.
   
   You should consider all passwords for all of the systems on the local net to be
   compromised. Force password changes across the board and consider installing ssh or stelnet
   (secure, encrypted replacements to rlogin/rsh and telnet respectively).
   
   He probably got in through the "Leshka" sendmail bug (allowing any shell user to create a
   root owned SUID shell in /tmp/ on any system with an SUID root copy of sendmail (version
   ~8.6.x to 8.7.x ???) using a bug in sendmail's handling of ARGV[0] and it's subsequent
   SIGHUP handling.
   
   Everyone using earlier versions of sendmail should upgrade to 8.8.3 or later
   (www.sendmail.org for details).
   
   How important are this system and the other systems on the same LAN segment to your
   business?
   
   I'd seriously consider hiring a qualified consultant for a full day risk assessment and
   audit. Unfortunately you'll probably pay at least $125/hr for anyone that's worth talking
   to and many of the "security consultants" out there are snake oil salesmen.
   
   I personally trust Peter Shipley (www.dis.org) and Brent Chapman (www.greatcircle.com)
   (co-author of the O'Reilly Firewalls book) Strat Rose (www.virtual.net) and Dan Farmer
   (www.trouble.org) (co-author of SATAN). Most of them are live in the SF Bay Area (silicon
   valley) and most of them aren't available most of the time (Brent is working on a large
   project to integrate the SGI and Cray WAN's; Strata has accepted a full-time position at
   synopsis.com, etc).
   
   I only consider myself to be a student, at best an apprentice, at data security. I'm
   willing to help -- but I can offer a list of satisfied clients for RASA services and I have
   no official "credentials."
   
   --Jim
   
   
     ______________________________________________________________________________________
   
   
   
   
   
  DIAL-UP PROBLEM
  
   Date: Tue, 28 Jan 1997 22:56:35 -0800 (PST)
   
   From Seth Vidal:
   
   I was reading your answer in LG(#13) to the individual who had slow rate problems with
   ppp. Something which he did not mention that might be of help is the MTU. Some isp's set
   the mtu or have ppp do the negotiation. NOT all. Some of the newer ones have not quite
   figured out that a 14.4 or 28.8 is not going to get a packet size over 576 very often. If
   he sets his mtu to 576 (or even 296 for a 14.4) he may be able to force the provider's
   setting down. I have found that in a standard (slackware or redhat) linux distribution
   that the mtu defaults to 1500 which will result in slow downs and problems if your modem
   encounters errors frequently. I know what ppp is "supposed to do" when set up correctly.
   But he cannot control the ignorance of his ISP and therefore it would be to his behest to
   give that a try. If you'd like to pass the information along to the individual who wrote
   the message feel free. I hope this helps him and any others.
   
   cheers,
   Seth Vidal, skvidal@terminus.ehc.edu 
   
   
     ______________________________________________________________________________________
   
   
   
   
   
  X WINDOW PROBLEM
  
   Date: Tue, 28 Jan 1997 04:02:06 -0800 (PST)
   
   From: Chris Lee, techno@usa.net
   
   1.) X Windows I got a Cirrus 5434 1mb video card, whenin 640x480x8bit the video is *fine*
   not great, I get little specs once in awhile on the screen, they go away with a simple
   [refresh] but still... When in 800x600x8bit I get lines, not specs anymore, alomst allways
   horizontial, and about 3pixels high, and allways croos the entire screen, not the virtual
   screen though, and they also go away with a simple [refresh] thses line occur alot more
   then the specs did. My vid card works fine in DOS/Windows. Any suggestions ? 
   
   You can look for the SuperProbe utility that comes with most recent distributions. This
   will provide info that can be autodetected about your video card.
   
   Frankly XWindows configuration under XFree86 is black magic. A few people are really good
   at it and mere mortals (such as I) just plug along and hope for the best.
   
   The new XFree86 3.1.2 release seems to be better about this but I'm sure that I'm not
   getting the optimal color and clock settings from my various X installations either.
   
   2.)Is there any Linux or X-Windows mailing-lists ? would help alot for me. 
   
   There are many Linux mailing lists -- and some of them and some independent ones cover
   XFree86 (which is used by Linux, FreeBSD and the rest of the free BSD derivatives (NetBSD
   and OpenBSD).
   
   The three best web sites for information about Linux seem to be:
     * http://www.li.org/, Linux International
     * http://www.ch4549.org/lust/, L.U.S.T. (Linux User's Support Team)
     * http://www.ssc.com/linux/, SSC Inc.
       
   
   
   I don't know much about X Windows and the XFree86 project but I think they maintain a web
   site -- probably at www.xfree86.org.
   
   It's an often overlooked fact that there are competitors to Linux in the field of freely
   available Unix for PC's. You can look at www.freebsd.org, www.netbsd.org and
   www.openbsd.org for some of those.
   
   Thanks for your time :)
   Chris Lee, Computer Science
   P.S. Damn you Linux people are great, so much out there, so many people helping you,
   nothing like this for DOS/Windows 
   
   DOS heralded the "sharing" of software (shareware) while Linux and the GNU project has
   promoted a *giving* of software -- and support.
   
   I think one is largely and extension of the other.
   
   Personally some of the best news I've heard for die hard PC users in the last year is the
   announcement that Caldera purchased DR-DOS and intends to release the sources as soon as
   the clean up the code enough to compile cleanly in a sane production environment. Look at
   www.caldera.com for details about that.
   
   OpenDOS will be one of the final pieces in the puzzle of how we (PC users, IS managers, and
   others) can truly protect the investment we've made in our legacy software. (Currently,
   with dosemu -- the BIOS emulator, you have to install a copy of DOS unto your system in
   addition to installing and configuring the Linux interface to your DOS programs -- which is
   want dosemu provides).
   
   -- Jim
   
   
     ______________________________________________________________________________________
   
   
   
      Copyright &copy; 1997, James T. Dennis
      Published in Issue 14 of the Linux Gazette
      
   
   
   
     ______________________________________________________________________________________
   
   
   
   [ TABLE OF CONTENTS ] [ FRONT PAGE ] Back Next 
   
    "Linux Gazette...making Linux just a little more lovable!" [IMAGE]
    
   
   
   
     ______________________________________________________________________________________
   
   
   
CLUELESS at the Prompt: A New Column for New Users

    By Mike List, troll@net-link.net
    
   
   
   
     ______________________________________________________________________________________
   
   
   
   I'm sure you've heard it before, but Welcome to Linux! You've heard the stories, your
   friends told you "Don't do it" but the allure of an operating system with at least the
   power of NT that can run on 4 MB of RAM on the same disk, even on the same partition with
   your DOS/Windows installation, was too big to be ignored. So you went on a FTP spree or
   bought a Red Hat or Slackware CD, installed it and you are confused, things don't work the
   way you expected, the man pages seem to be written in another language, and the people on
   the USENET keep telling you to RTFM and belittling you.
   
   That's why I decided to ask if I could write this column, it happened to me. Actually, when
   I got into computers (less than a year ago,) my friend Trippy told me to learn DOS before
   trying Windows. Thanks Trippy, you saved me a lot of trouble. So when I read about Linux, I
   thought -WHOA COOL!!, and downloaded the mini-linux distribution from Sunsite."HEY!Wait a
   minute, how come the keyboard doesn't work right?" Turns out the key table is Portuguese
   and requires file editing to be usable by us Yanks. Thanks to SGK from the Debian group, I
   got that squared away, so I decided to go with Debian, but with my small disk and no
   CD-ROM, Debian's Compatibility/Conflict Resolution was too much for me. So I got a second
   disk, 100 MB but it was still too small. So I decided to give Slackware a try. That's what
   I'm running now.
   
   The point is, I'm not a college educated computer expert but I still ended up(for now) with
   a running linux box. You can too, if you are willing to tinker (hack later, tinker now).I
   made every possible mistake, I thought until I saw some of the questions in the news
   groups.
   
   But enough about me, what do you think about me?;-)
   
   The first things you need to know after you install Linux are the most common commands.
   Here I'm going to assume that you have at least some DOS background. The following list
   will attempt to correlate Linux commands:
   
     
     
     LinuxDOS ls /directory/namecd\directory\name -- dir ls /directory | more
     ls " " | lessdir | more cat /filetype \file cat " " | more
     less /file" " | more cp /file /file /tocopy \file \to cd /directorycd\directory mkdir
     /directorymkdir \directory rm /filedel \file
     
   This list is not nearly complete, there are many more commands in both OS but these are
   very likely the most commonly used ones. For command help in DOS type: help :in linux type:
   man (command, substitute the command name): Both of these help utilities give options or
   switches that change the nature of the command. You can see that there are similarities in
   the command line operation of both OS, historically they share a common ancestry. In fact,
   to use a oversimplified view, at the command line linux could be thought of as SUPERDOS. In
   fact this SUPERDOS can actually be used to run MS Windows - check into WINE and WABI home
   pages on the Internet.(More on those later, maybe.)
   
   One of the next things you will need to do is find out how to write or change file contents
   with an editor.I used to think elvis was the easiest editor, until Konrad Rokicki told me
   about pico, which comes with the pine mail server. If you used MS Write or Notepad, you'll
   find it very easy to use. Save Emacs for another day unless you are a good typist, I found
   the keyboard commands to be confusing for my two-fingered style. If you don't have pico
   installed, try elvis in the input mode, by typing: input filename, it's pretty easy too,
   except watch out for command mode and input mode (type: man elvis :and read the page.If you
   have a CD version of Linux, you either have pico installed or can have it if you choose.
   
   If you're like me one of your priority projects will be to to do is use an Internet
   protocol to connect to your Internet Service Provider. My ISP uses PPP so that's what I
   used, and the following descriptions are for PPP.
   
   The first thing you will need to confirm is that your kernel supports PPP, either in the
   kernel or by loadable modules. Type: pppd :and hit enter. If your kernel doesn't support
   PPP, you'll get a negative message, if you get a prompt you can assume for now that it's
   supported.
   
   Next you will need to type: ls /usr/sbin | more :and hit enter. Look for files called
   ppp-on and ppp-off. Next, type: ls /etc | more : and hit enter. Here you will be looking
   for a file called resolv.conf. Then type: ls /etc/ppp : you can skip the: | more :this
   time, since it's a small directory,and hit enter. You'll be looking for files called
   options and ppp-on-dialer.
   
   Edit your /etc/resolv.conf to look something like:

domain net-link.net
nameserver 205.207.6.2
nameserver 205.217.6.3
gateway 205.217.6.10

   Naturally you will have to change the name and numeric to match that of your ISP .
   
   Next, edit your /etc/ppp/options file to look something like this:

/dev/modem
38400       # at this line you could substitute 19200, 57600, 115200
defaultroute
noipdefault
debug
crtscts
lock
modem


   
   
   These two files are necessary to either of the methods I am going to describe.
   
   Now you can use minicom to dial up your ISP. Type: minicom :, and when it loads, type:
   ATDTYOURISPNUMBER :hit enter. When the remote modem answers you will be prompted for your
   username and password. When you have responded with this information, a string of garbage
   characters will run across the screen. Type: ctrl(key)a :then: Q :which will let you out of
   minicom without hanging up the modem. Then immediately type: pppd :then hit enter. Type:
   ping YOURISP'SNUMERIC :you will get a message that will inform you if you are connected. If
   you get a message that says in part "network not reached" try again. If no luck after a
   couple more tries, check to see that the files you edited have the correct information. Try
   changing your connection speed in /etc/ppp/options to 19200 and try again. If you connect
   this time, then one at a time try the faster speeds until you can't connect, then drop back
   to the fastest speed that worked.
   
   There is an easier method using the script /usr/sbin/ppp-on, that involves editing that
   file to give your ISPdialup number, username, and password and optionally your connection
   speed. It is commented to help you figure out how to change those lines that you need to
   change. When that is done correctly, you can dial up by typing: ppp-on : Pretty cool, huh?
   If these methods don't work for you, start by reading the PPP_HOWTO in your
   /usr/doc/faq/howto directory, then respond by e-mail to troll@net-link.net, telling me any
   error messages, and I'll try to square you away.
   
   There is another method using the chat program, but I haven't had much luck there, yet.
   Future installments, if any will fill you in on that if it seems that it's wanted.
   Personally, ppp-on is just fine for me so far.
   
   you will want to get an e-mail program and a browser, if you don't already. I recommend
   lynx. It's fast and you don't need X installed to use it. There probably is a lynx binary
   in your distribution, but if not you can get one from sunsite or other ftp.Pine is a good
   mail program, and it includes the pico editor, as noted above.
   
   NOTE TO LINUX EXPERTS- I would be glad to accept reasonable criticism of this article and
   the information therein. I don't really want to put up with heavy fire, if you can help the
   new user better than me, write an article yourself, there are plenty of avenues where such
   information would be of great service.
   
  NEXT TIME- E-MAILTROLL@NET-LINK.NET ME AND ASK, OTHERWISE I'LL JUST WRITE ABOUT WHAT GAVE ME
  TROUBLE AND HOW I GOT PAST IT.
  
   
   
    TTYL, Mike List
   
   
     ______________________________________________________________________________________
   
   
   
      Copyright &copy; 1997, Mike List
      Published in Issue 14 of the Linux Gazette
      
   
   
   
     ______________________________________________________________________________________
   
   
   
   [ TABLE OF CONTENTS ] [ FRONT PAGE ] Back Next 
   
   
     ______________________________________________________________________________________
   
   
   
    "Linux Gazette...making Linux just a little more lovable!" [IMAGE]
    
   
   
   
     ______________________________________________________________________________________
   
   
   
The Cracraft and Lijewski DIRED Programs

    By Grant B. Gustafson gustafso@math.utah.edu
    
   
   
   
     ______________________________________________________________________________________
   
   
   
   The directory navigator and program launcher called "DIRED" in the original incarnations of
   EMACS has two stand-alone Unix clones. Mike Lijewski's "dired" 2.2 is written in C++
   (1996). The original "dired" was written in C by Stuart Cracraft (1980), available as
   version 3.05 (1997).
   
   Historically, shortly after emacs "dired" appeared in the TECO implementation, a
   stand-alone version was written by Stuart Cracraft (1980). The emacs version and the C
   version have not kept up with one another.
   
   Lijewski wrote "dired" in 1990, while at Cornell University Theory Center, without any
   knowledge of Cracraft's "dired". The Theory Center ran on IBM VM/CMS, under which there is
   a utility call "file manager". This program manages the flat VM/CMS file system and
   represents the main user interface into files. The creation of "dired" eased the transition
   from VM/CMS to Unix.
   
   Lijewski's "dired" has the advantage of hindsight and C++ program development so it
   promises to be written in modern syntax and very maintainable. Cracraft's "dired" was
   rewritten in 1996 in ANSI C. It suffers with flaws in both design and readability, but the
   features are there.
   
   
     ______________________________________________________________________________________
   
   
   
  COMMON FEATURES OF CRACRAFT'S AND LIJEWSKI'S "DIRED"
     * Copy current file
     * Hard link current file to another file.
     * Symbolic link current file to another file.
     * Unzip current file (gunzip).
     * Zip current file (gzip).
     * Rename current file.
     * Display help.
     * Cursor up one.
     * Cursor down one.
     * Back one page.
     * Forward one page.
     * Go to first file.
     * Go to last file.
     * Do shell command /w filename substitution.
     * Search forward for file matching regular expression.
     * Search reverse for file matching regular expression.
     * Launch EDITOR on a file or DIRED on a directory.
     * Recognize new window size and refresh screen.
     * Delete current file
     * Prompt for and edit a directory.
     * Change the mode of the current file.
     * Launch PAGER on this file.
     * Sort the file list.
     * Print file contents.
     * Reload directory.
     * Abort DIRED.
     * Suspend DIRED.
     * Exit immediately.
     * Setup by command line, resource file or environment variable.
       
   Minor differences exist in the implementation of these features. Cracraft's dired supports
   split screen. Lijewski's dired supports scrolling by half-page. Deletes in Cracraft's dired
   are done in batch whereas Lijewski's dired does them immediately.
   
   Curiously, the common features of the two direds also account for the most often used dired
   commands.
   
   The differences between Lijewski's "dired" and Cracraft's "dired" in 1997 appear below.
   Many features commonly exist in both versions, so only the superficial differences are
   discussed. Strengths and weaknesses of each are also listed.
   
   
     ______________________________________________________________________________________
   
   
   
  UNIQUE FEATURES OF LIJEWSKI'S "DIRED"
     * Compress current file.
     * Uncompress current file.
     * Change the group of the current file.
     * View only files matching a regular expression.
       
   Strengths:
     * Excellent for persons with minimal Unix knowledge.
     * Has a full complement of basic commands for file maintenance.
     * Key configuration in resource file "~/.diredrc".
       
   Weaknesses:
     * Does file maintenance one file at a time with prompts.
     * Fixed full screen format.
     * No ANSI colorization to match color-ls.
       
   
   
   
     ______________________________________________________________________________________
   
   
   
  UNIQUE FEATURES OF CRACRAFT'S DIRED 3.05
     * Manual page display, DIRED 3.05 in detail.
     * Key Tutor. Describe key. Execute key.
     * Tag files for later processing.
     * Dynamic format setup for the screen and shell commands.
     * Toggle colorization of file names (4 color tables).
     * Undo search and page move.
     * Bookmarks.
     * Abort or suspend DIRED and PUSHD to the displayed directory.
     * Groff current file as a manual page.
     * Type current text or binary file on terminal with pause.
     * Write the formatted file list to a unique file in /tmp.
     * Aliased shell commands, interactive or in resource ~/.diredset.
     * Setup for shell commands attached to internal variables.
       
   Strengths:
     * Favors use by seasoned Unix people.
     * Configurable screen format.
     * Keys are fixed to give uniformity across different hosts.
       
   Weaknesses:
     * Key configuration is compiled into "dired" and can't be changed.
       
   
   
   
     ______________________________________________________________________________________
   
   
   
  MISFEATURES OF BOTH VERSIONS OF "DIRED"
  
   
   
   The program tends to be used for browsing and deleting files; users find the other features
   too obtuse for daily use. Too many commands. Its hard to remember what key does which
   command.
   
   
     ______________________________________________________________________________________
   
   
   
  HOW TO GET DIRED
  
   
   
   Find dired305.zip at http://sunsite.unc.edu/pub/Linux/. Or email to gustafson@math.utah.edu
   for location of recent version.
   
   Find Lijewski's c++ dired by sending email to lijewski@mothra.lbl.gov for location of the
   recent version. If you want to see it on sunsite, then let Mike hear about it!
   
   
     ______________________________________________________________________________________
   
   
   
      Copyright &copy; 1997, Grant B. Gustafson
      Published in Issue 14 of the Linux Gazette
      
   
   
   
     ______________________________________________________________________________________
   
   
   
   [ TABLE OF CONTENTS ] [ FRONT PAGE ] Back Next 
   
   
     ______________________________________________________________________________________
   
   
   
    "Linux Gazette...making Linux just a little more lovable!" [IMAGE]
    
   
   
   
     ______________________________________________________________________________________
   
   
   
Directory Trees in Outline Format

    By James T. Dennis jim@starshine.org
    
   
   
   
     ______________________________________________________________________________________
   
   
   
   Since I frequently post messages to various Unix and Linux newsgroups and mailing lists I
   often get technical questions mailed to me ``out of the blue.''
   
   I recently received a request for a script to produce the following sort of output:

        dir/
           file1
           file2
        file
        dir/
           dir/
              file

        (etc)

   Here was my quick and dirty solution:

        find . | awk -F/ '{for (x=1;x<NF;x++) { printf "\t"}; print $NF}'

   
   
   ... which only does about 80% of the job. The only problem is that the directory entries
   don't end with the ``/'' to indicate their file type. It was late -- so that's what I sent
   him.
   
   Here's how that works:
   
   find . just prints a list of full paths (using GNU find). Some non-Linux users may have to
   using 'find . -print' to accomplish this (or update to the GNU version on their systems).
   
   awk is a text processing language/utility.
   
   The -F (capital ``f'') sets a field separator to the '/' (slash character). Awk defaults to
   parsing it's input into records (lines) of fields (whitespace delimited). Using the -F
   allows me to tell awk to treat each record (still just lines) as a group of fields that are
   separated by slashes -- allowing me to deal with each directory element as a separate
   element very easily.
   
   The next parameter to awk is a short program -- a for loop (like the C for() construct). It
   iterates from 1 to NF.
   
   NF in awk is the ``number of fields'' for each record. This, among many other values, is
   preset by awk as it parses its input.
   
   Awk defaults to reading it's input from a pipe or from each file listed after it's script
   on the command line. We're supplying it with input through the pipe, of course.
   
   In the body of my awk 'for' loop I simply print a tab for each directory named in that
   line. This has the appearance of "wiping out" all of the leading directory names and
   indenting my line as desired.
   
   Finally, after the end of the for loop I simply print the last field ($NF). Note how the
   printf takes a string similar to C's printf -- and it doesn't assume a newline. I could put
   C-like format specifiers like %s and %f in there -- and I'd have to supply additional
   parameters to the printf call if I did.
   
   By contrast the awk print command (no trailing ``f'') does add an ORS (output record
   separator) character to the end of its line and doesn't treat its first argument as a
   format specification.
   
   This evening I happened to be cleaning up my home directory (while procrastinating on doing
   paying work and cleaning the house) I happened across a copy of this and decided to fix it.

                find . | { while read i ;
                        do
                           [ -d $i ] \
                           && echo $i/  \
                           || echo $i
                           done } \
                           | awk -F/ '
                                /\/$/ { for (x = 1; x
        
        Note that the original script: 'find ....| awk -F/ ...'
        is mostly still there.  But the script has gone from
        one line to eleven -- all to get that silly little slash
        character on the end of each directory name.



        (If anyone as a shorter program -- I'd like to see it
        -- there's probably a fairly quick way to do this using
        perl and find2perl)



        The main thing I've added is the while loop which works
        like this:



                find's output is piped into a group of commands
                (that's what the braces are for).

                That group of commands starts with a bash "while...
                do" loop.  The bash "while...do" loop works like this:

                        'while'
                                some command returns no error
                                'do'
                                some commands
                                'done'

                Note that, unlike C or Pascal programming the
                ``condition'' for the while loop is actually any
                command (or group of commands -- enclosed in
                braces or parentheses).  The fact that programs
                return values (called errorlevels in DOS and
                some Mainframe OS) makes all commands implicitly
                ``conditions.''  (Actually C allows a variety of
                function calls within conditionals -- but we
                won't go into that).



                Note that some commands might not return values that
                make any sense -- so those would not be suitable
                for use with any of the conditional contexts in any
                shell.



                The command I'm using is bash' internal ``read''
                command which just takes a variable name as an
                argument.  Note that I don't say ``read $i'' --
                the shell would then fill the value of $i into
                the command (i.e it would ``dereference'' it) and
                the read command would have no arguments.  If you
                give the read command no argument it simply reads
                a value and throws it away (no error).



                When you set values in bash (or Bourne shell, or zsh
                etc) you also don't ``dereference'' it.  $i=foo would be
                an error unless you actually wanted to set the
                value of some variable -- whose name was currently stored
                in $i to be set to foo.



                Back to our script.  When the find command stops printing
                filenames into the pipe, the 'read i' command will fail
                to get any value -- so the body of the do loop will be
                skipped.



                The 'do' keyword just marks the end of the list of
                commands in the conditional section and the beginning
                of the body of the loop (big surprise -- huh?).



                The next three lines of the script are another common
                shell construct --
    1. [ is really an alias for or link to the 'test' command.
       
    2. -d is a parameter to 'test' that is true if the next parameter ($i) is a directory.
       
    3. That line ends with a ``\'' (backslash) to mark a continuation character. This causes
       the shell to treat the next line as an extension of this one.



                        I could certainly have put all of this one line.
                        However, for readability I broke it up and formatted
                        it with leading tabs -- otherwise *I* couldn't read
                        it, much less expect anyone else to do so.



                        The next line (continuation) starts with the '&&'
                        operator.  In bash and related shells you have things
                        like the familiar ``|'' (pipe) and ``;'' semicolon which are
                        called operators.  This operator means ``if that last command
                        was O.K. -- returned no error -- then ...''



                        You can think of the '&&' operator as do this ``and''
                        to that (in the *conditional* sense of the the word
                        and).



                        The next line uses the '||' operator -- which is,
                        as you might expect, similar to the '&&' operator except
                        it means -- ``if the last command executed returned an
                        error then ...''  This is roughly analogous to the English
                        ``or'' (again, it the conditional sense).



                        Of course I could have wrapped this in an 'if ....;
                        then ....; else...'  construct -- but I'm used to the '&&'
                        and '||' as are most shell programmers.



                        So far all we've done is added a ``/'' character to the end
                        of each directory.



        Now I'm left with a print out of full paths with directories ending in
        ``/'' (slashes) and other files printed normally -- back to replacing all
        but the last thing with tabs -- so we pipe the 'while' loop's output
        into the same awk script we were using before.



        Ooops!  Well, almost the same script -- it turns out that awk -F is
        happy to consider the trailing slash as a blank field on the end of a
        line.  Hmm.  O.K.  we add an extra condition to the awk script.



                An awk script consists of condition-action pairs.  The most
                common awk ``conditions'' are patterns. That is so say that they
                are regular expressions (like the things you use grep to search
                for).  A pattern is usually delimited by slashes (a mnemonic to
                the users of ed, later upgraded ex, later upgraded to vi) although
                you can also ``match'' against strings that are enclosed in quotes.



                Actions in awk are enclosed in braces.



                Awk is an extremely forgiving language.  If you leave out the
                ``condition'' or ``pattern'' it will execute the action on that
                line for every record (line) that it comes across.  That's
                what my first script did.



                If you leave off the action (i.e. if you have a line that
                consists just of a condition) then awk will simply print
                the record.  In other words the default action is {print}.



                When I was a regular in the comp.lang.awk newsgroup (and
                alt.lang.awk that preceded it) I used to enjoy pointing out
                that the shorted awk programs in the work are:

                        1

                        and

                        .

                (The first one just prints every line it sees since ``1'' is
                a ``true'' condition; the second program (a dot) prints every
                line that has at least one character -- since that is the
                regular expression for ``any character''.  The second program
                actually does filter out blank lines since awk doesn't count
                the record separator as part of the line).



                So, the modification of my awk script for this purpose is
                to add a condition that handles any record that *ends* with a
                slash.  In those cases I convert all *but* the next-to-last field
                to a tab, and print that ``next-to-last'' field.  I also have to
                add the ``/'' character to the end of that since awk doesn't consider
                the field separator to be part of any field.



                Finally I add a 'next' command which tells awk not to look
                for any more pattern-action pairs with *this* record.  If I
                didn't do that than awk would execute the action for each
                ``directory'' line -- and also execute the other action for it
                (i.e. it would print a blank line after printing each directory
                line).




        Is the extra 10 lines of code worth it just to add a slash to the end
        of the directory names in our outline?  Depends on how much your customer
        is willing to pay -- or how much grief it causes you, your boss or your
        users.



        Mostly I decided to work on this as a training example.  I think there are
        some neat constructs that every budding shell programmer might benefit
        from learning.



        The ``find .... | {while read i .... do ... done}'' construct is well worth
        remember for other cases.  It allows you to do complex operations on
        large numbers of files without resorting to writing a temporary file and
        having to clean up after it.



        When you write scripts that explicitly create temporary files you suddenly
        have a host of new concerns -- what do I name it? where do I put it?
        don't forget to remove it! do I have enough space for it? what if my
        script gets interrupted? etc.



        To be sure there are answers to each of these.  For example I
        suggest ~/tmp/$0.`date +%Y%m%d`.$$ for a generic temporary filename
        for any script -- it gives the name of your script, the date in
        YYYYMMDD format and the process ID of the current instance of your
        script as the filename.  It puts that into the temporary directory
        under your home (which no one else should have access to).  There is
        virtually no chance of a name collision using this scheme (particularly
        if you change the date format to +%s which is the total number of seconds
        since midnight on Jan. 1, 1970).  You can use the 'trap' command to
        ensure that your temp files are cleaned in all but the most extreme
        cases etc.



        However, as I've said, it's worth understanding how to avoid temporary
        files -- and usually your scripts will execute faster as a result.



        The [ ... ] && ... || ... construct is absolutely essential to
        any Unix sysadmin.  Many of legacy scripts (particularly those in
        /etc/rc.d/ -- or it's local equivalent) rely on these operators and
        the test or '[' command.



        Finally there is 'awk'.  I've heard it argued that awk is a dinosaur
        and that we should convert all the awk code to perl (and presumably most
        of the Bourne shell and sed code with it).  I won't argue that point
        here.  Suffice it to say that anything you learn how to do in awk will
        just make learning perl that much easier when you get to it.  awk is a
        much simpler language and is phenomenally easy to integrate into shell scripts
        (as you can see here).



Jim Dennis, Starshine Technical Services





  _______________________________________________________________________________________________




      Copyright &copy; 1997, James T. Dennis
      Published in Issue 14 of the Linux Gazette
      
      



  _______________________________________________________________________________________________




 [ TABLE OF CONTENTS ] 
 [ FRONT PAGE ] 
 Back  
 Next  



  _______________________________________________________________________________________________






    "Linux Gazette...making Linux just a little more lovable!"
    



  _______________________________________________________________________________________________


















        

                
                 Welcom to the Graphics Muse

        
                
                
                        
                                
                                Set your browser to the width of the line below for best viewing.
                                
                                
                                

                                &copy 1996 by
                                mjh
                                
                        
                


        
        
                
  _______________________________________________________________________________________________


                




        
                -->
        
                 Button Bar


        
                -->
        
                
                muse:
                    1. v; to become absorbed in thought
    2. n; [ fr. Any of the nine sister goddesses of learning and the arts in Greek Mythology
       ]: a source of inspiration
       
        W elcome
       
       to the Graphics Muse!  Why a "muse"?
       
       Well, except for the sisters aspect, the above definitions are
       
       pretty much the way I'd describe my own interest in computer graphics:
       
       it keeps me deep in thought and it is a daily source of inspiration.
   
       
       
       



                
                
                [Graphics Mews]
                [Musings]
                [Resources]
                
                





        
         indent
         T his
        column is dedicated to the use, creation, distribution, and dissussion of
        computer graphics tools for Linux systems.

        

        
        Last month I had promised to do a review of Keith Rule's new book on
        3D File Formats this month.  I'll also said there would be a section
        on adding fonts on Linux in last months colums.  Ok, I'm a liar.
        First, I decided that although Keith's book deserves some examination
        I felt that another
        book, Mark Kilgard's OpenGL text, had a more direct bearing on Linux
        users.  I'll consider taking a look at Keith's book some time in the
        future.

        

        
        Second, I had quite a bit of other material for January's column so
        had decided to move the font discussion to February's column.  However,
        I forgot to update the introduction in January's column to reflect
        this change.  My apologies.

        

        
        Now for the bad news:  I had a major system crash on the 16th of
        January which first of all caused me over a week of grief trying
        to recover and second caused the loss of a large number of files.
        No, I wasn't doing backups.  So shoot me.  I managed to recover an
        earlier copy of this months Muse column from a laptop I have, but
        I lost a good portion of what I'd already done.  Now, as I write this,
   I have 3 days to get the column done and uploaded.  The result is
        that the book review and a number of other items will have to be put
   off till another time.

        

        
        So, does anyone have a decent tape backup system that can run on
        ftape drives?


        

        
        In this months column I'll be covering, along with how to add fonts to
        your system:
             * a GIF Animations update: the MultiGIF program
     * some Printer info I gathered in the past month
     * tkPOV V2.0 - a graphical front end to POV-Ray 3.0
   
    


        NOTE:
        I lost all my old email and mail aliases when my system went down.  If
        you have been in touch with me in the past and want to stay in touch
        please send me some email
       (mjhammel@csn.net)!  I'm particularly interested in hearing from
        Paul Sargent, who was helping me with my look into BMRT.  I lost
        your email address Paul, along with all the messages we'd exchanged on
        the BMRT article series!  Write me (or if you know Paul, please have
        him contact me)!
        
        








 Graphics Mews








        
        

        
                Disclaimer:
                Before I get too far into this I should note that any of the news items I
                post in this section are just that - news.  Either I happened to run
                across
                them via some mailing list I was on, via some Usenet newsgroup, or via
                email from someone.  I'm not necessarily endorsing these products (some of
                which may be commercial), I'm just letting you know I'd heard about
                them in the past month.

        
                    xfig 3.2.0 Beta available
    
    
    
    
    
    Xfig is a menu-driven tool that allows the user to draw
    
    
    and manipulate objects interactively in an X window.  The
    
    
    resulting pictures can be saved, printed on postscript
    
    
    printers or converted to a variety of other formats (e.g. to
    
    
    allow inclusion in LaTeX documents).
    
    


                
                xfig is available on ftp.x.org in
                
               /contrib/applications/drawing_tools/xfig.
                You also need a JPEG library, which can be found in /contrib/libraries.
                and TransFig version 3.2.0-beta1.  TransFig contains the postprocessor
                needed by xfig to convert fig files to one of several output formats,
                such as PostScript, pic, LaTeX etc.  The TransFig package is in the
                directory
                
               /contrib/applications/drawing_tools/transfig.
                


        
                 indent
        
                 indent

        
                    Alexander Zimmermann has uploaded another update to his ImageMagick package.
    
    
    
    
    
    ImageMagick (TM), version 3.7.9, is a package for display and
    
    
    interactive manipulation of images for the X Window System.
    
    
    The package has been uploaded to sunsite.unc.edu:/pub/Linux/Incoming
    
    
    as:
    
    
     * ImageMagick-3.7.9-elf.lsm
     * ImageMagick-3.7.9-elf.tgz
   
       


                
                ImageMagick supports also the Drag-and-Drop protocol form the
                OffiX package and many of the more popular image formats including
                JPEG, MPEG, PNG, TIFF, Photo CD, etc.

                

                
                You will also need the package libIMPlugIn-1.0-elf to get it working.
                These can be retrieved from
                
               ftp.wizards.dupont.com



                       /pub/ImageMagick/binaries.

                


        
                 indent


        
                    World Movers, the first VRML 2.0 Developer Conference
    
    
    
    
    
    I received the following information via email (unsolicited, but
    
    
    its probably the first time I got something I found really
    
    
    interesting via a blind email post).  Note that I have nothing
    
    
    to do with this conference, other than I wish they'd invite me to go -
    
    
    expenses paid, of course:
    
    
    



                
                World Movers, the first VRML 2.0 Developer Conference, will be held on
                January 30 and 31 at the ANA Hotel in San Francisco, CA.

                
                At World Movers you will:
                
                     * Select from sessions in three key tracks over two days
          + Content Creation
          + Business Applications of VRML
          + Future Directions and Current Technologies
     * Learn how to create great VRML 2.0 content and applications
     * See and learn about real applications that use VRML
     * Find out about the latest tools for VRML 2.0
   
       



                With a pan-industry advisory board and a wide array of hosts and
                participants, World Movers will give you a complete picture of VRML 2.0
                content and applications from all perspectives.

                


                Register by calling (800)488-2883 or (415)578-6900, or go online at
                
               http://www.worldmovers.org.

                


        
                 indent


        
                    PNG Magick Plug-in 0.8
    
    
    
    
    
    There is a new plug-in for Unix/Linux versions of Netscape called
    
    
    PNG Magick Plug-in 0.8.  This plug-in supports
    
    
    the following file formats:
    
    
    PNG, XPM, TIFF, MIFF, TGA, BMP, PBM, PGM, PPM, PNM, PCX,
    
    
    FITS, XWD, GIF, JPEG, WAV and MPEG-1.  It is reported to support
    
    
    Drag and Drop capabilities as well.
    
    
    


                
                For MPEG-1 support you need the Xew library which doesn't seem
                to work well with the Linux version of this plug-in.

                

                
                PNG Magick Plug-in 0.8
                is published under the GNU General public License and is available at
                
               http://home.pages.de/~rasca/pngplugin/.
                

        
                 indent
        
                 indent

        
                    TkFont v1.1
    
    
    
    
    
    There is a new tool for viewing fonts on Linux.  I haven't tried
    
    
    this yet so I don't know how well it works.  It has been uploaded
    
    
    to

               tsx-11.mit.edu in the /incoming directory.
                The file-name is `tkfont-1.1.tar.gz'.
                


        
                 indent


        
                    Version 0.1.8 of Lib3d is now available from Sunsite.
    
    
    
    
    
    Lib3d is a high performance 3d C++ library distributed under the GNU
    
    
    LGPL.  Lib3d implements sub-affine texture mapping, Gouraud shading
    
    
    and Z-buffer rasterization, with support for X11, DGA, SvgaLib and DOS.
    
    


                
                Lib3d is available from
                
               ftp://sunsite.unc.edu/pub/Linux/Incoming/lib3d-0.1.8.tar.gz
               
                

                
                For more information:
                
               http://www.ozemail.com.au/~keithw
               
                


        
                 indent


        
                    CFP: ACM SIGGRAPH 97 Sketches Program
    
    
    Deadline: April 16, 1997
    
    


                
                The following was posted in a number of places.  I got it via a
                friend on the Gimp User mailing list.  I have no association with
                SIGGRAPH (unfortunately) so can offer no other details than the
                following:
                


                
                SKETCHES are live, 15 minute presentations that provide a forum for
                unique, interesting ideas and techniques in computer graphics.
                Sketches allow the presentation of late-breaking results, works in
                progress, art, design, and innovative uses and applications of
                graphics techniques and technology. Sketch abstracts will be published
                in the Visual Proceedings.
                

                
                Sketches are a fun, educational, high-profile way to show your work
                and creations. We are seeking submissions in four areas:

                     * Animations
     * Applications
     * Art and Design
     * Technical
       
       
       
       For more information, see the SIGGRAPH 97 Call for Participation, send
       
       email to
       

               sketches.s97@siggraph.org,
                or for the latest, most
                comprehensive information on how to submit to Sketches and other
                SIGGRAPH 97 programs, including supplemental documents, please go to:
                
               http://www.siggraph.org/s97/.

                



                
                
                        To request a copy of the Call for Participation, contact:
                        

  SIGGRAPH 97 Conference Management

  Smith, Bucklin & Associates, Inc.

  401 North Michigan Avenue

  Chicago, Illinois 60611 USA

  +1.312.321.6830

  +1.312.321.6876 fax


                               
                              siggraph97@siggraph.org
                       
                        

DEADLINES:
                                
      16 April 1997
                                
      5 pm Eastern Daylight Time
                                
      Final Sketch proposals
                        
                
                        To discuss your concepts and ideas for Sketches, contact:
                        

  David S. Ebert

  SIGGRAPH 97 Sketches Chair

  University of Maryland Baltimore County

  CSEE Department ECS-210

  1000 Hilltop Circle

  Baltimore, Maryland 21250 USA

  +1.410.455.3541

  +1.410.455.3969 fax


                               
                              sketches.s97@siggraph.org
                       
                        
                

        



        
         indent

        
                 indent

        
         indent


        
                    Did You Know?
    
    
    
    
    
    The
    
    

               VRML 2.0 Specification, Moving Worlds
                from SGI, provides for
                "spatial audio"?  This is a definition of how sound is played
                in relationship to your point in space and distance from an object
                which has a sound attached to it.  The O2 system from SGI has
                a VRML browser which was demonstrated on Part 2 of PC-TV's series
                on Unix which covered commercial Unix options.  Part 3 of this
                series started airing at the end of January and is devoted to
                our favorite OS - Linux!

                


                
                There is a wonderful description on using color palettes with
                Web pages at
                
               http://www.adobe.com/newsfeatures/palette/main.html.  The page
                is a reprinted article by Lisa Lopuck from Adobe Magazine and is
                quite detailed.  Check it out!

                


                
                Have you been thinking about using POV-Ray 3.0's new caustics
                feature?  Are you unsure exactly what it does?  Want to learn all
                about it?  Then check out
                
               The Caustic Tutorial for POV.  This is a very detailed
                explanation on what caustics are and how to use them.
                Briefly,
                
     caustics are formed when light is either focused or dispersed due to passing through
     media with different indices of refraction. Bright spots in the shadows are where light
     is focused and dark spots are where the light has been dispersed.
                Thanks to
           
               Paul R. Rotering for this description (taken from the IRTC-L
                mailing list).

                

Q and A
                


                Q: What is displacement mapping?
                


                A: Displacement mapping is not only the perturbing of the surface
                normal of an object, like a bump maps do, but in fact a distorting
                of the object itself.  You can think of it
                as a height field over an arbitrary surface.  The latest version of
                
               BMRT is reported to support displacement maps.  Few other
                publicly available renderers provide this feature.

                


                Q:
               I have just downloaded the complete batch of plug-ins from the
               "Plug-in Registry", and noticed that the "interpolate",
               "lightest" and "darkest" plug-ins appear to do the same thing
               as the "blend",
               "add" and "multiply" channel ops respectively. Is this correct, or is
               there some difference under certain circumstances?
               
                


                A:
                Not exactly.  Blend uses integer values and restricts you to
                interpolation.  Interpolate/Extrapolate uses floating point values and
                does not restrict the range of the blending value --- you can do
                extrapolation, too (look at my home page for some examples):
                

                
        
        http://www.nuclecu.unam.mx/~federico/gimp
                

                Lightest and Darkest pick the lightest and darkest pixels from two
                images.  It is not the same as add and multiply except for bilevel
                images.

                


                Both of these questions were answered by Mena Quintero Federico,
                aka Quartic, on the Gimp User mailing list.

                


        
         indent

        
                 indent

        
         indent











 Musings








        
                    GIF animations update: MultiGIF
    
    
    
    
    
    After my first column (Linux Gazette, issue 12),
    
    
Greg Roelofs
                wrote me to tell me about another tool for creating animated
                GIF images.  Andy Wardley's
                MultiGIF
                allows the use of sprite images as part of the animation.  Sprite
                images are like small sections of an image.  Instead of
                creating a series of GIF images that are all the same size and simply
                appending each one at the end of the other (as WhirlGIF does) the user can
                create an initial image along with a series of smaller images that are
                positioned at offsets from the upper left corner of the full image.

                

                
                By using sprites (I'm not completely sure what a sprite
                really is, but Greg used this term and it appears similar to other
                uses I've seen - someone correct me if its not the correct use of
                the term) the GIF animator can reduce the file size anywhere from
                a factor of two to a factor of 20 in size.  As proof, Greg offered
                his animated
                
               PNG-balls, which went from 577k to 233k in size.
                Another animation, a small horizontally oscillating "Cylon eyes"
                (referring to the old Battlestar Gallatica metal menace), provided
                a savings of a factor of 20.

                

                
                MultiGIF comes with C source code and is shareware.  Andy only asks
                that you provide a donation if you find you are using it frequently.
                There is also a utility called gifinfo which can be used to identify
                GIF files, including multiframe GIF animations.

                

                
                Both WhirlGIF and MultiGIF come with fairly decent documentation
                describing how to use the various command line options.  About the
                only thing that might be missing is why you would use one option over or in
                conjunction with another, but thats a minor point.  I find the use of
                sprites with MultiGIF and its smaller output files more useful to me.
                However, new users who are not quite familiar with how to create sprites
                (including transparency) with tools like the Gimp might prefer the simpler
                WhirlGIF.
                

        
                 indent





        
                    Adding Fonts to your system 
    
    
    
    
    
    Fonts are used extensively for creating graphics images.
    
    
    Many of the graphics on my Web pages and in the
    
    
    Graphics Muse use fonts I've installed from
    
    
    collections of fonts on commercial CDs.
    
    
    Fonts are also used for ordinary text in X applications, from
    
    
    the fonts in your xterm to the title bars provided by your
    
    
    window manager to the pages displayed by xman.
    
    
    The difference is hard to distinguish, but
    
    
    whether used for ordinary text or to create
    
    
    outrageous graphics, adding fonts to your system and letting
    
    
    your X server know about them is the first step .
    
    
    


                
                Just so you know:  nearly all X applications accept the "-fn"
                and/or "-font" command line arguments.   This is a feature built into
                the X Windows API.  How this is used depends on the application.  For
                xterms, just use "-fn " to specify the font used in the
                xterm window.  This does not specify what font to use for the xterm
                title bar.  That is controlled by the window managers X resources.

                

                
                To know what fonts are available on your system you can look
                under the font directories for fonts.alias files.  There is supposed to be
                one of these in each directory under
                
               /usr/X11R6/lib/X11/fonts,
                but whether there is or not depends on the distribution you're using.
                The name to use is the
                name on the left.  For example, under
                
               /usr/X11R6/lib/X11/fonts/misc,
                in the file fonts.alias there is the following line:
                
                
                        
                        
                               5x7
                       
                        
                        
                               -misc-fixed-medium-r-normal-

                                     -7-70-75-75-c-50-iso8859-1
                       
                
                To use this font with xterms I would do:
                

                
                
                       xterm -fn 5x7
               
                

                You can actually use the string on the right, but unless you understand
                how fonts are defined you probably don't want to do this.

                

                
                I don't want this to turn into an X Windows column.  There are other
                places for such discussions, and I'm sure LG could use a regular
                columnist for X.  But this column is about computer graphics so
                this is all I'm going to say about using fonts in X applications
                from the X resources standpoint.  In any case, since the X server
                is being used to handle the fonts, adding fonts to
                your system is the same whether you use them for graphics or as
                X resources.

                

                
                Suppose you had a font called westerngoofy that you
                wanted to use in the Gimp as the start
                of some neat title graphic for a Web page.
                By default there isn't an entry in any of the fonts.alias files
                for westerngoofy, so when you use the text tool in the Gimp
                it won't show up in the list of available fonts.
                There are 3 steps to making this font available for use with the
                Gimp:
                     * Grab the fonts and place them in a local directory
     * Configure that directory for use as a font directory
     * Tell the X server about this new font directory
   
       
       
       
       The first part is simple - grab a copy of the font file and put it
       
       in some directory.  Make sure you've uncompressed it if the archive
       
       you retrieved the file from compresses the fonts.  Most X servers
       
       don't understand compressed fonts (some do, but all understand
       
       uncompressed fonts).  The directory can be owned by anyone.  It does
       
       not have to be a directory under the system fonts directories
       
       (generally these are under
       

               /usr/X11R6/lib/X11/fonts). On my system I have a "src/X11"

                


                
                -Top of next column-
                
                

        
                 indent
        
                 indent
        
                 indent


        
        
        
                
                           More Musings... 
     * Printer Info - my journey into color printing
     * tkPOV V2.0 - a graphical front end to POV-Ray 3.0
       
       
        indent
       
       
   
       
       
       
       
        indent
   
       
       
       
       
        indent
       


                directory under my home directory.  Under this I created a "fonts"
                directory where I put new fonts that I find.  If you are the owner
                of your system and have root access you might want to put the fonts
                under /usr/local/fonts or someplace similar.

                

                
                Note that since TrueType fonts are not supported by default by most
                X servers we won't concern ourselves with how to use them here.  The
                font format you should be using are Type1 fonts.  There are plenty
                of places to get these, including numerous CD-ROMs available from
                any decent computer software stores.  Some online resources are
                listed in the
                
               Linux Graphics mini-Howto under the "Other Topics" section.

                

                
                Next you need to configure your new fonts directory so that the
                X server can provide you FontName-to-File mappings.  To do this you
                need to get hold of a little Perl script called
                
               type1inst,
                which is short for "Type 1 Install".  This script is easy to use and comes
                with documentation explaining what you about to do.  Basically,
                you run the script to create a couple of files, fonts.alias and
                fonts.dir, which the X server uses to associate a fonts name to
                the font file.  You can also use mkfontdir, but I like
                type1inst
                better.  mkfontdir doesn't always seem to be available
                on all platforms and finding a binary version (or even source)
                has never been easy for me (I think its buried in the X11 source
                tree, which I really don't want to download just for one program).
                
                

                
                The last step is to let the X server know about the new font
                directory.  The xset command allows a user to configure
                a number of options for the X server.  One of these options is
                the paths to search for font files.  The format of the command
                is as follows:
                


                
                
               xset fp+ &ltpath&gt
               
                


                The fp option is used to modify the font path.  The plus
                sign is used to add a font path.  Because the plus sign is after
                the fp the font path specified will be appended to the
                current list of paths, if any.  Using +fp would prepend
                the new path to the front of the current list.  There are other
                possibilities.  Running
                


                
                
               xset -?
               
                


                will provide a thorough list of options.  The man page for xset
                also contains good descriptions of the options.

                

                
                Now that the server knows where to look, it has to be told to
                go ahead and check for fonts in the new directories.  The
                rehash option to xset does this.  Simply run
                


                
                
               xset rehash
               
                


                and your new fonts are ready for use!

                

                
                Of course, once you've installed the fonts in a directory and
                run type1inst you can put the xset commands in your
                .xinitrc file so they are run every time you start up your X
                environment (such as with the startx script).  This is what
                I do so that I always have access to the set of fonts I've installed
                from CD-ROMs or from font archives from the net.

                

                
                Thats all there is to it.  You should now be able to use your fonts
                with tools like the Gimp or XPaint in order to create lots of
                interesting logos for Web pages.  Enjoy!

                
        
        













 Resources






The following links are just starting points for finding more information
about computer graphics and multimedia in general for Linux systems.  If
you have some application specific information for me, I'll add them to my
other pages or you can contact the maintainer of some other web site.  I'll
consider adding other general references here, but application or site
specific information needs to go into one of the following general
references and not listed here.








Linux Graphics mini-Howto





Unix Graphics Utilities





Linux Multimedia Page





Some of the Mailing Lists and Newsgroups I keep an eye on and where I get alot
of the information in this column:



 
               The Gimp User and Gimp Developer Mailing Lists.

 The IRTC-L discussion list (I'll get an address next month).

 
               comp.graphics.rendering.raytracing

 
               comp.graphics.rendering.renderman

 
               comp.os.linux.announce











Future Directions



Next month:
     * BMRT Part I: An Introduction - creating a simple scene and rendering it
     * Scanner Info
     * Height Fields with HF-Lab
     * Review: TkPOV - a POV-Ray scene file editor
     * Book Review: OpenGL Programming for the X Window System



Let me know what you'd like to hear about!






  _______________________________________________________________________________________________




      Copyright &copy; 1997, Michael J. Hammel
      Published in Issue 14 of the Linux Gazette
      
      



  _______________________________________________________________________________________________




 [ TABLE OF CONTENTS ] 
 [ FRONT PAGE ] 
 Back  
 Next  



  _______________________________________________________________________________________________





    "Linux Gazette...making Linux just a little more lovable!" [IMAGE]
    



  _______________________________________________________________________________________________







Linus Torvalds to Receive Annual UniForum Award

    By Richard Shippee, dick@uniforum.org
    



  _______________________________________________________________________________________________





Fri, 31 Jan 1997

Linus Torvalds, considered the "Father of the LINUX Operating System",
has been selected by the UniForum Board of Directors to receive The UniForum
Award. The Award will be presented to Torvalds on Thursday, March 13th, as
part of the morning Keynote Session at UniForum '97, being held at the Moscone
Convention Center in San Francisco.





The UniForum Award, presented annually since 1983, goes to individuals or
groups whose work has significantly advanced the cause of open systems over
time, or has had an immediate and positive impact on the industry with long
term ramifications. The UniForum Board of Directors considered a number of
nominees for this year's awards, and voted unanimously in their selection of
Linus Torvalds for his breakthrough work on the LINUX kernel and for his
pioneering efforts in making his work available at little or no cost to anyone
wishing to develop on it.



Linus Torvalds is the creator and chief architect of the Linux operating
system.  At the University of Helsinki in the spring of 1991, frustrated
with the price of
Unix operating systems, Torvalds began writing some software code to handle
certain computing chores on the 386.
"I noticed that this was starting to be an operating system," he
says.
Since then, he has traveled all over the world promoting Linux.
Although developing Linux has been almost a full-time job for him,
he recently accepted a job at Transmeta in Santa Clara, California.
He and Tovi Monni recently celebrated the birth of their baby daughter,
Patricia Miranda Torvalds.




The UniForum Board also selected a second Award winner this year: James
Gosling of JavaSoft, and his development team, for their work on Java. Gosling
will receive his Award at the Wednesday, March 12th Keynote session at
UniForum '97.



The Award presentation to Linus Torvalds, at the Thursday Keynote session, is
open to all free of charge but requires attendees to register for UniForum
'97. Registrants may also visit the exhibits floor which features booths from
a number of LINUX vendors including Comtrol, LINUX International; SSC,
publishers of Linux Journal; Red Hat Software and Work Group Solutions. To
view the entire UniForum '97 Conference and Trade Show brochure, and to
register on-line, please go to 
http://www.uniforum97.com/.



For additional information contact:

Richard Shippee, Director of Communications, UniForum
408-986-8840, ext 17, dick@uniforum.org






  _______________________________________________________________________________________________




      Copyright &copy; 1997, Richard Shippee
      Published in Issue 14 of the Linux Gazette
      
      



  _______________________________________________________________________________________________




 [ TABLE OF CONTENTS ] 
 [ FRONT PAGE ] 
 Back  
 Next  



  _______________________________________________________________________________________________





    "Linux Gazette...making Linux just a little more lovable!" [IMAGE]
    



  _______________________________________________________________________________________________







Linux Security 101

    By Marsala, mars@loeffel.txdirect.net
    



  _______________________________________________________________________________________________





You can jump down to the section on tcpd 

Or take a peek at the other stuff you need to keep an
eye on.




  _______________________________________________________________________________________________





Ok.  You've got Linux beat.  You finally got AfterStep set up the way you want
it,  you've managed to set up ip masquerading for your home LAN, you've managed
to set up a cool issue for people to see when they log in, you managed to
convert a couple over to the One True OS, and chicks really dig you because,
as we all know, Linux geeks are sexy.



One night as you're peeking at /var/adm/messages, you notice that
someone from some place you've never heard of before tried to make 5 ftp
connections, 6 telnets, and even an nntp connection.  What's up with that?



Well, Linux (and all Unix type OS's in general) were designed to be a
programmer's paradise.  The same qualities that makes Linux such a wonderful
networking and hacking operating system also expose a few security holes.
There are a few programs that you probably rely on or use daily that can be
used to gain root access (which is a Bad Thing).  What's worse, the commercial
distributions that many Linux users depend on have these programs with
security holes inside packages that are installed as part of the base
system.



That's the bad news.  The good news is that we can make it tougher for the
Bad Guys to do their dirty deeds.  By checking the
 Linux ALERTS 
page, you can find out what the holes we know about are, and how to
temporarily plug them up or even fix them up for good.  There is also a nice
little tool that is probably on your system that we can use to keep them
from even having access to our machine.



And that's what I'm going to focus on.  My belief here is that if we can
keep the Remote Bad Guys (people who don't have legitimate access to our
machines) out, then we only have to worry about the Local Bad Guys (if any).
Plus it gives us a chance to fix anything on our machine that is a security
hole the RBG's can use.




  _______________________________________________________________________________________________


tcpd


  _______________________________________________________________________________________________





There's a daemon that's probably been installed on your machine that you don't
know about.  Or at least, you're not aware of what it can do.  It's called
tcpd, and it's how we shut off access to some of the basic services
that the Bad Guys can use to get on our system.



Since tcpd can be pretty complex, I'm not going to go into all the
details and tell you how to do the fancy stuff.  The goal here is to keep the
mischievous gibbons from knocking down what it took so long for use to set
up.



tcpd is called into action from another daemon, inetd, whenever
someone tries to access a service like in.telnetd, wu.ftpd, in.fingerd,
in.rshd, etc.  tcpd's job is to look at two files and determine if
the person who is trying to access the service has permission or not.



The files are /etc/hosts.allow and /etc/hosts.deny.  Here's
how it all works:



    1. Someone tries to use a service that tcpd is monitoring.
    2. tcpd wakes up, and makes a note of the attempt to the syslog.
    3. tcpd then looks hosts.allow
          + if it finds a match, tcpd goes back to sleep and lets the user access the service.
    4. tcpd now takes a look at hosts.deny
          + if it finds a match, tcpd closes the user's connection
    5. If it can't find a match in either file, or if both files are empty, tcpd shrugs,
       guesses it's OK to let the user on, and goes back to sleep.



Now, there are a couple of things to note here.  First, if you haven't edited
hosts.allow or hosts.deny since you installed Linux, then
tcpd assumes that you want to let everyone have access to your machine.
The second thing to note is that if tcpd finds a match in
hosts.allow, it stops looking.  In other words, we can put an entry
in hosts.deny and deny access to all services from all machines, and
then list ``friendly'' machines in the hosts.allow file.



Let's take a look at the man page.  You'll find the info you need by typing
man 5 hosts_access (don't forget the 5 and the underscore).




       daemon_list : client_list

       daemon_list is a list of one or more daemon process  names
         or wildcards

       client_list  is  a  list  of  one or more host names, host
         addresses, patterns or wildcards  that will  be matched
         against the remote host name or address.

       List elements should be separated by blanks and/or commas.




Now, if you go take a look at the man page, you'll notice that I didn't show
you everything that was in there.  The reason for that is because the extra
option (the shell_command) can be used to do some neat stuff, but *most
Linux distributions have not enabled the use of this option in their tcpd
binaries*.  We'll save how to do this for an article on tcpd itself.



If you absolutely have to have this option, get the source from

here and recompile.



Back to business.  What the above section from the hosts_access man
page was trying to say is that the format of
hosts.[allow|deny] is made up of a list of services and
a list of host name patterns, separated by a ``:''



You'll find the name of the services you can use by looking in your
/etc/inetd.conf...they'll be the ones with /usr/sbin/tcpd
set as the server path.



The rules for determining host patterns are pretty simple, too:



     * if you want to match all hosts in a domain, put a ``.'' at the front.
          + Ex: .bar.com will match "foo.bar.com", "sailors.bar.com", "blue.oyster.bar.com",
            etc.
   
       
     * if you want to match all IPs in a domain, put a "." at the end.
          + Ex: 192.168.1. will match "192.168.1.1", "192.168.1.2", "192.168.1.3", etc.



And finally, there are some wildcards you can use:
     * ALL matches everything. If in daemon_list, matches all daemons; if in client_list, it
       matches all host names.
          + Ex: ALL : ALL would match any machine trying to get to any service.
   
       
     * LOCAL matches host names that don't have a dot in them.
          + Ex: ALL : LOCAL would match any machine that is inside the domain or search
            aliases given in your /etc/resolv.conf
   
       
     * except isn't really a wildcard, but it comes in useful. It excludes a pattern from the
       list.
          + Ex: ALL : ALL except .leetin-haxor.org would match all services to anyone who is
            not from ``*.leetin-haxor.org''



Ok.  Enough technical stuff.  Let's get to some examples.



Let's pretend we have a home LAN, and a computer for each member of the family.



Our home network looks like this:




    linux.home.net      192.168.1.1
    dad.home.net        192.168.1.2
    mom.home.net        192.168.1.3
    sis.home.net        192.168.1.4
    bro.home.net        192.168.1.5




Now, since no one in the family is likely to try and ``hack root,'' we can
assume they're all friendly.  But....we're not so sure about the rest of
the people on the Internet.  Here's how we go about setting things up so
people on home.net have full access to our machine, but no one else does.



In /etc/hosts.allow:




# /etc/hosts.allow for linux.home.net

ALL: .home.net




And in /etc/hosts.deny




# /etc/hosts.deny for linux.home.net

ALL : ALL




Since tcpd looks at hosts.allow first, we can safely deny
access to all services for everybody.  If tcpd can't match the machine
sending the request to ``*.home.net'', the connection gets refused.



Now, let's pretend that Mom has been reading up on how Unix stuff works,
and she's started doing some unfriendly stuff on our machine.  In order
to deny her access to our machine, we simply change the line in 
hosts.allow to:




ALL: .home.net except mom.home.net




Now, let's pretend a friend from....uh....friend.com wants to get something
off our ftp server.  No problem, just edit hosts.allow again:




# /etc/hosts.allow for linux.home.net

ALL: .home.net except mom.home.net
wu.ftpd: .friend.com




Things are looking good.  The only problem is that the name server for
home.net is sometimes down, and the only way we can identify someone as
being on home.net is through their IP address.  Not a problem:




# /etc/hosts.allow for linux.home.net

ALL: .home.net except mom.home.net
ALL: 192.168.1. except 192.168.1.3
ALL: .friend.com




And so on....



I have found that's it's easier to deny everybody access, and list your
friends in hosts.allow than it is to allow everybody access, and
deny only the people who you know are RBG's.  If you are running a private
machine, this won't really be a problem, and you can rest easy.



However, if you're trying to run a public service (like an ftp archive of
Tetris games for different OS's) and you can't afford to be this paranoid,
then you need shouldn't put anything in hosts.allow, and just put
all of the people you don't want touching your machine in hosts.deny



You might also want to take a look at the next section.




  _______________________________________________________________________________________________


Other things to keep in mind


  _______________________________________________________________________________________________





    Security holes in software



Like I said earlier, a lot of the software that comes standard in CD-ROMs have
security holes in them which could let local or even remote users execute
commands as root on your system.  Keep an eye on
 Linux ALERTS
to find out about problems we know about and how to fix them.



    What services you offer



Check to make sure that the services you have running on your machine are
what you really want to offer.  For example, most of us don't have a need
to run in.nntpd, yet it's got an entry in /etc/inetd.conf.
Do you really want everyone on the Internet to have access to
in.fingerd?  Do you really need to let everyone on the Internet have
access to your ftp server?



Find what you don't need (or don't want to offer to any passing stranger who
might happen across your machine) and either shut it down or deny outside
access to it.



    Passwords



Yeah, yeah, yeah.  Everyone's heard the speech about passwords, but they
are pretty important.  Especially if you're not restricting access to your
machine.  Remember, if they can get to your machine, they can get on your
machine.  And if they can get on your machine, they can get root access.



In case you haven't heard the speech, here's the condensed version:
    1. Make the passwords at least 8 characters long.
    2. Mix the case of the passwords.
    3. Use at least one numeral.
    4. Use at least one non-alphanumeric character.
    5. Change the passwords on a regular basis. About once every
       two months should do for the casual user.
   I have found that using "k-rad" or "leet-speak" helps when you need to
   make up a password.  For example, instead of using the password
   "foobar", try using "f00b4R!".



Lastly, get and install shadow passwords.  You might have to recompile a
few services, but it's worth the extra protection.



    File Permissions



Many of the security holes that exist are because the files are "setuid".
That means that a non-root user can execute the files as root.  Remove
this permission from any files that don't need it.  Like mount.
It really isn't that much of a hassle to keep one of your virtual
consoles logged in as root, and flip over to it when you need to get
something done.



Also, if you have stuff sitting somewhere that you don't want anyone else
to see, don't give them world rwx permission on the dir.



    Keep an eye on the syslog



At least once a day, you need to go check the syslog and see what's been
happening.  You can find it /var/adm/syslog, and I'd also recommend
taking a peek at /var/adm/messages.  You'll want to look for
multiple connections coming from places you don't know in a short period
of time.  If they look suspicious, then don't hesitate to slap an entry
for the domain into /etc/hosts.deny



    Who you trust



This is just common sense.  It's not a wise idea to give out your root password
to someone you just met on IRC 5 minutes ago who claims they can get Apache
up and running on your system if you just tell them the root password.



Set up a guest account with limited read, write, execute abilities and let them
use that.



It's also not wise to let people just log in and fiddle around on your machine.
Despite common belief, it is possible to create Unix ``viruses,'' and all you
really need is the knowledge, the will, and an opportunity.  For more
information, see the paper on
The Plausibility of
Unix Virus Attacks




  _______________________________________________________________________________________________





  FINAL WORD



To be completely honest with you, the only way to be 100% sure your machine
can't be compromised is to physically deny access to it.  That means get
rid of the modem and ethernet card, fill up any hole in the computer's case
with cement, and buy a big, mean pit bull to guard it while you are asleep.



Well, maybe that's going a bit far.  But the point is, if they can't get to
your machine, they can't do anything to it.  If you think your machine has
been compromised, disconnect it from the network, look through the
syslog, try to find out how it was compromised, fix the problem,
set all new passwords for your accounts, and then reconnect it.



We might not be able to make the machine 100% secure, but we can make
it hard for the Bad Guys to do their thing.

  _______________________________________________________________________________________________


Email:
mars@loeffel.txdirect.net





  _______________________________________________________________________________________________




      Copyright &copy; 1997, Marsala
      Published in Issue 14 of the Linux Gazette
      
      



  _______________________________________________________________________________________________




 [ TABLE OF CONTENTS ] 
 [ FRONT PAGE ] 
 Back  
 Next  



  _______________________________________________________________________________________________




    "Linux Gazette...making Linux just a little more lovable!" [IMAGE]
    



  _______________________________________________________________________________________________







  THE MUTT MAILER
  
    by Larry Ayers
    
    

  _______________________________________________________________________________________________





    Introduction
    


 Michael Elkins is a programmer who at one time was involved in the
development of the venerable mail-client, Elm.  He had some ideas which he
would have liked to include in Elm but for whatever reasons the other Elm
developers weren't receptive.  So he struck out on his own, creating a
text-mode mailer which incorporates features from a variety of other
programs.  These include other mailers such as Elm and Pine, as well as John
Davis's Slrn newsreader.  As an indication of the program's hybrid nature
he has named it Mutt.  Although the mailer began as an amalgamation of
features from other programs, it has begun to assume an identity of its own.



Mutt has been in beta-testing for several months now and new versions
have been released regularly.  Lately I've noticed that binary packages have
been appearing in the Sunsite incoming directory, which I take as a sign
that the program is now deemed ``suitable for a general audience.''  I have
found that it compiles cleanly and works dependably.

    Distinguishing Characteristics
    


The composition of messages has always been a thorn in the side of
developers of mail clients.  After all, a usable mailer is the goal, not
a text editor.  The typical approach has been to include a simple message
composition editor (such as Pico in Pine) and allow the option of starting an
external editor of the user's choice.  This has certain drawbacks.  If in the
middle of a message you need an editing function not included by the internal
editor, it can be distracting and awkward to switch boats in midstream, so to
speak.



This minor dilemma is neatly side stepped by Mutt; there is no internal
editor included.  All message composition is done with a familiar editor,
preferably a text-mode one so that Mutt can be run at the console as well as
under X-windows.  As an example, I've set Mutt up to use Vile with a
message-specific rc-file (sets word-wrap, etc).



Mutt can be compiled with a feature unusual in text-mode mail clients:
it can fetch mail from a POP server, a duty which is more commonly assigned to
an external agent such as Popclient.  Compile-time support is also available
for PGP-encrypted messages, though theoretically this is only available for
US citizens.



A few of Mutt's other features include:


     * Configurable colorization of various screen elements, such as headers, sigs, and
       foreground/background.
     * Message sorting options
     * Small executable size (around 150 kb. on my system)
     * MIME support
     * Message threading
     * Indefinite postponement of outgoing messages
     * Can use either curses/ncurses or S-lang as the screen library
     * Customizable keybindings
     * Delivery Status Notification (DSN) support
   


Mutt can be run from the command line, if you just want to mail a quick
message without having to load your mail-spool file. Incidentally, Mutt uses
the mailx (single-file) message format, so the transition from Pine or Elm
is painless.



If you've ever used the Jed editor or Slrn the appearance of Mutt will be
familiar.  Like these programs Mutt is easy on the eyes, and the amount of
coloring used is easily controlled. The documentation supplied with Mutt is
very complete, but this isn't one of those programs which takes long to learn.


    Obtaining Mutt
    


Binary versions of Mutt are available from the Sunsite archive site,
currently in pub/Linux/Incoming. I recommend obtaining the source
from the Mutt home site, where the
latest versions will first appear.  Compiling it yourself allows the program
to be tailored to your needs; there are several compile-time options.



The non-export version, which contains PGP/MIME support, is
export-controlled; U.S. citizens can read the file README.US-only and follow
the directions to access the files.  The non-export version has been
exported anyway (against the author's wishes), and can be obtained from the
following sites:


     * ftp.teuto.de/pub/user/lmb
     * ftp.fu-berlin.de/pub/unix/mail/mutt/mutt-pgp
   

  _______________________________________________________________________________________________





Why not give it a try?  The source file is small, and compilation and
installation just takes a few minutes.  I think you'll like it.


  _______________________________________________________________________________________________



Larry
Ayers



Last modified: Fri Jan 24 18:54:25 CST 1997






  _______________________________________________________________________________________________




      Copyright &copy; 1997, Larry Ayers
      Published in Issue 14 of the Linux Gazette
      
      



  _______________________________________________________________________________________________




 [ TABLE OF CONTENTS ] 
 [ FRONT PAGE ] 
 Back  
 Next  



  _______________________________________________________________________________________________





    "Linux Gazette...making Linux just a little more lovable!" [IMAGE]
    



  _______________________________________________________________________________________________






  WINDOW-MANAGER NEWS
  
    by Larry Ayers
    
    


Window-managers seem to be unique to unix-derived operating systems.
Rather than assuming all windowing/GUI tasks, the X-server confines itself
to the basic grunt-work of facilitating communications between the graphics
hardware and the kernel.  This is typical unix behavior, in which complex
tasks are broken up into sub-tasks performed by separate programs.  This is
beneficial to the end-user.  If something goes wrong in such a system it is
easier to place blame and isolate the problem; flexibility and
configurability are also much greater than in systems in which the graphic
interface duties are intertwined inextricably with basic kernel
functions.



The end result of this is that if you start the X-server ``bare'' (without a
window manager) you will see borderless windows on a gray and black stippled
background.  Few people want this appearance, so over the years a wide variety
of window-managing software has been developed.  Some are proprietary, but in
the free software world there are several active projects, a few of which I'll
discuss in this article.


  _______________________________________________________________________________________________



    FVWM
    


The F(?) Virtual Window Manager is, for several good reasons, the most
commonly used Linux window manager.  It was originally an offshoot of an early
manager called Twm, but has evolved considerably in recent years.



Rob Nation, who was also partially responsible for top and rxvt, was the
maintainer of the 1.xx versions of Fvwm.  This series reached a developmental
plateau a few years ago and a new group of developers adopted the program and
initiated the 2.xx series.  The 1.xx versions are stable and reliable and are
still being used by many people, though they aren't actively maintained.



I won't go into the basic features of Fvwm, as this topic has been
well-covered (by John Fisk and others) in past issues of the Gazette.  Since
those articles appeared there have been many new features and modules added to
Fvwm, a few of which I'll describe.



By the way, don't be put off by the beta status of the 2.xx versions;
since about version 2.0.37 the program has been relatively easy to compile and
free of any but very minor bugs.  Version 2 is asymptotically approaching a
major release which will be version 2.1.



New Features



I can't help but think that the developers working on Fvwm2 are keeping an
eye on the upstart Afterstep window-manager, which is based on Fvwm2 code.
The newest Fvwm2 release (as of Jan 24,1997) is 2.0.45; patches have been
incorporated which give Fvwm2 some of the nicer decorative features of
Afterstep.  These include tiled pixmaps for window-borders and title bars, as
well as gradient-shading of the title bar from one color to another.  Another
addition is the ability to use mini-icons for title bar buttons.  If you're not
interested in such decorative elaborations they can be easily disabled by
editing the fvwm.tmpl file before compilation.  The new release is
worth obtaining even if you don't care about the new visible features, as many
bugs have been fixed.  The man-page has also been expanded and updated to
cover these changes.



It's now possible to write Fvwm modules in either Perl or Python.  Several
examples of each are included in the distribution, which is available from
this Hawaiian site.






  _______________________________________________________________________________________________



    Afterstep
    


If you are fond of the appearance of the NExtstep operating system, you'll
probably like Afterstep.  This is an offshoot of Fvwm2 development which has
attracted much attention recently in the Linux community, to the point where
it is being included (despite its beta status) in some newer distributions.



Afterstep pioneered the use of pixmaps and mini-icons in borders and
title-bars, as mentioned in the Fvwm2 section above.  But the major difference
is the Wharf module, a very configurable tool bar which uses larger-than-normal
icons (64x64).  The supplied icons are very stylish, and can be configured to
have gradient-shaded backgrounds.  As with the Fvwm2 Buttons module, the Wharf
(NExt calls it a ``dock'') can ``swallow'' applications and other modules.  Lately
modules designed to be swallowed by the Wharf have become available from the
Afterstep web-sites.  Among these are a PPP dialer, a CD-player, and a mixer.
Check out the Afterstep
Home Page for the latest news and releases.


  _______________________________________________________________________________________________



    Wm2
    
    Possibly as a reaction to the growing number of unnecessary features in the
    other window-managers,
Chris
Cannam has written a minimalist window-manager called Wm2.  This small and
fast window-manager was inspired by the Plan 9 manager, which is part of the
experimental Plan 9 operating system.  There are no icons, virtual desktops,
or configuration files, in stark contrast to the other managers discussed
here, just nicely framed windows and a simple menu which starts an xterm and
lists active and hidden windows.  The windows are framed in a distinctive
manner, with no top title bar.  Instead a shaped tab protrudes from the top of
the left side of the window with the title displayed vertically.



Rather than include a screen shot of Wm2 in action, here are links to the
Wm2 web page which has links to both a screen shot and the source itself:




The Wm2 Page (local)





The Wm2 Page (WWW)



Wm2 is still relatively new; I have noticed that it stresses the X-server
more than would be expected of such a small application, possibly because of
its use of the shaped-window X-extension.  Screen refreshes seem to be slow.
Nonetheless in this third version it seems to be stable, and it provides a
refreshing contrast to the complexity of the other window-managers. The only
configuration involved comes before compilation of the source.  The various
colors and preferred terminal emulator can be set in the Config.h file;
after installation the only way to change these settings is to re-edit and
recompile.


  _______________________________________________________________________________________________





If you'd like more information on these as well as several other
window-managers, visit
 this excellent
site, which has many links and screen shots.



  _______________________________________________________________________________________________



Larry Ayers


Last modified: Fri Jan 24 19:11:42 CST 1997







  _______________________________________________________________________________________________




      Copyright &copy; 1997, Larry Ayers
      Published in Issue 14 of the Linux Gazette
      
      



  _______________________________________________________________________________________________




 [ TABLE OF CONTENTS ] 
 [ FRONT PAGE ] 
 Back  
 Next  



  _______________________________________________________________________________________________





    "Linux Gazette...making Linux just a little more lovable!" [IMAGE]
    



  _______________________________________________________________________________________________










                                      SHELLS FOR THE END USER
                                                  
    by Larry Ayers
    


My first shell, though I didn't know it by that name, was
command.com in DOS.  It couldn't do much more than simply execute
commands, but it served my needs at the time.  Later on I discovered the
commercial DOS command.com replacement 4DOS, by JP Software.  This came
as something of a revelation to this novice computer user.  Suddenly I could
do file-name completion, use aliases, and change to a directory on a different
drive with simple keystrokes.  Wow, I thought, how did those programmers at JP
Software think of so many clever command-line functions and options!



I later learned that 4Dos (and its OS/2 sibling, 4OS/2) were influenced and
inspired by the various shells used on unix systems.  When I first began using
Linux I was able to learn the rudiments of the Bash shell fairly quickly
because of past experience with the JP Software products.

  _______________________________________________________________________________________________



    The ``Bourne-Again'' Shell
    


New users of Linux are encouraged (in part by distribution defaults) to
use the GNU Bash shell.  Bash has been polished over the years to the point
that any remaining bugs probably affect only the skilled users who make use
of its more arcane functions.  Bash, and its reduced-function alias
sh, work well as agents for executing shell scripts.  As a command
shell in a console or an xterm Bash provides many labor-saving shortcuts and
functions, most of which beginning users don't use.  Reading the voluminous
Bash documentation I began to realize that using Bash the way most users do,
i.e. as the default login and command shell, touches only a small fraction
of its capabilities. O'Reilly has published a three-hundred-page book
detailing Bash shell programming and usage !



Recently Chet Ramey, the maintainer of Bash, released version 2.00 to the
FTP sites.  After reading the list of changes and bug-fixes I concluded that
advanced users will be more appreciative of the release than will common
end-users, like myself.  It's an odd feeling to learn of a feature by finding
out that bugs have been fixed in it!  The documentation for Bash is extensive;
the man pages are available now in HTML format (in a separate file called
bash-doc-2.0.tar.gz).  Bash can be obtained both from Sunsite and its
mirrors (in /pub/gnu) and from the
main GNU site.


  _______________________________________________________________________________________________





I remember the first time I navigated my way through the Slackware
installation menus; being offered the option to install tcsh and zsh made me
realize how little I knew.  What were these alternative shells?  Evidently
some users preferred them to bash, but why?



All of the shells discussed in this article are extensively documented, but
that very feature, as helpful as it is to advanced users, can make it
difficult to get a rough idea of why one shell might be preferable to another.
Luckily it isn't hard to install another shell just to try it out.  Edit the
file /etc/shells (logged in as root) and add a line with the path to
the new shell.  Then execute the command chsh; a default choice will be
offered to you.  Ignore it and type in the name (with path) of the new shell.
You'll have to log out and log back in to activate the new shell.


  _______________________________________________________________________________________________



    Tcsh
    


In issue 12 of the Gazette  Jesper
Pederson wrote a good introductory article about Tcsh; this article also
shows how Jesper's program Dotfile Generator can be used to help write
Tcsh resource files without spending many hours reading the manual.  Since
that article appeared a new version of the Dotfile Generator has been released
which includes a module to generate Bash resource files.  I highly
recommend this program, which is available from
this site.  The Dotfile
Generator won't overwrite your existing files; it writes to another filename
(such as .bashrc-dotfile) This file can then be edited; I usually
transplant sections to my original files to try things out.  The Dotfile
Generator allows you to try various features of your shell without having to
learn the precise rc-file syntax first.

1

A little resource-file editing will be necessary to change over to Tcsh.
The aliases which you have defined can be transplanted from your ~/.bashrc to
~/.cshrc without alteration, but the environment variables are another matter.
Bash (and other ``Bourne-compatible'' shells, such as Zsh) uses a different
format for this than Tcsh.  As an example, export INFODIR=/mt/info in
the ~/.bash_profile would have to be changed to setenv INFODIR /mt/info
in ~/.tcshrc.  I recommend going to the trouble of transferring aliases and
environment variables if you want to give Tcsh a try.  If you don't you'll be
continually distracted by commands which don't work, and you will tend to
blame the shell.



The one feature which really stands out (if you're accustomed to Bash) is
the spelling-correction.  When either a filename or command is misspelled the
shell pops up a suggested correction.  If you tend to type commands quickly
and press ``enter'' without rereading what you've typed you'll love this.
Sometimes the shell is wrong, though, but pressing n rather than
y will force the shell to try and execute what you actually typed.


  _______________________________________________________________________________________________



    Zsh
    


After using Tcsh for a while, you may find yourself thinking, ``I really
don't want to switch completely to Tcsh; if only Bash had that spelling
correction built in!''  Zsh might be what you want.



Zsh is a Bourne-compatible shell like Bash but with several csh-like
features added.  It also resembles the proprietary Korn shell as well as
Pdksh, a free Korn-shell clone.  It's not at all difficult to adapt Bash
configuration files so that Zsh can use them as the syntax is nearly
identical.  ~/.zshenv is analogous to ~/.bash_profile, while ~/.zshrc
corresponds to ~/.bashrc.



The first thing you notice when using Zsh for the first time is the prompt,
which by default looks like this:



<machine-name>#                               /usr/local/src





As you can see, the current directory is on the right hand side of the
screen, giving more room for a command before the line breaks.  When a typed
command reaches the path on the right the path disappears to make room.



The spelling correction behavior seems to be identical to that of Tcsh.  As
with Bash and Tcsh, completion of paths and filenames is bound to the
tab key.  Zsh has an elaborate implementation of programmable
completion, in which file-type specific behavior for completions can be set in
the resource-files.



One helpful aspect of Zsh's completion behavior deserves notice.  Often
there will be a filename and a subdirectory with the same prefix, say if a
file called sample-2.01.tar.gz is unarchived into the directory in
which it resides, creating in the process a new subdirectory called
sample-2.01. Try the command cd sam<TAB> with some
shells and you will be asked if you want to change directory to
sample-2.01.tar.gz or to sample-2.01.  Zsh is smart enough to
realize that directories don't normally have a tar.gz suffix, and
changes to the directory without comment or question.



The Zsh distribution contains extensive help-files which are in the
Info format, allowing them to be browsed from within Emacs or with a
stand-alone Info reader. After reading these documents I came away with
the impression that Zsh probably rivals Bash in the number of arcane features
and programming abilities.  If you would like to see examples of the
complexity possible in Zsh configuration, take a look at The Next
Level, a package of Linux configuration files with explanation which has
become a part of recent Red Hat distributions.  The Next Level's author,
Greg J. Badros, has included an elaborate set of Zsh resource files.
I found them to be quite informative as an example of what's possible with
this shell.



Zsh seems to be under active development; version 3.00 was released last
year, and there have been minor releases since then.  There is a Zsh
home-page here which can serve as a good
introduction.


  _______________________________________________________________________________________________



  CONCLUSION
  


These shells certainly aren't hard to find; most distributions I've seen
include preconfigured packages for all three of them.  One caveat: if you
decide to settle on Tcsh or Zsh as your login shell don't remove Bash, or its
symlink /bin/sh.  Many shell scripts rely on /bin/sh in order to
run properly.  Some packages, such as the Andrew User Interface System, like
to have csh available, so if you have the disk-space Tcsh, along with
its symlink /bin/csh may as well be retained even if it's not your
login shell.



The choice of shells reminds me of the eternal debate between vi-users and
emacs-users.  A decision depends more on working-style and personality than
logic; try them all and see which one fits!


  _______________________________________________________________________________________________



Larry
Ayers



Last modified: Fri Jan 24 23:34:09 CST 1997







  _______________________________________________________________________________________________




      Copyright &copy; 1997, Larry Ayers
      Published in Issue 14 of the Linux Gazette
      
      



  _______________________________________________________________________________________________




 [ TABLE OF CONTENTS ] 
 [ FRONT PAGE ] 
 Back  
 Next  



  _______________________________________________________________________________________________





    "Linux Gazette...making Linux just a little more lovable!" [IMAGE]
    



  _______________________________________________________________________________________________







Novice Bash Tip -- Edit command-lines "joe-style"

    By Joel Wilf, av293@lafn.org
    
    



  _______________________________________________________________________________________________





If like me, you come from the world of DOS and WordStar, you
feel right at home with the joe editor, which uses WordStar
keystrokes.



But as soon as you exit joe, you're back in the land of bash,
where command-lines are edited "emacs-style." Soon,
your fingers are confused.  Before you know it, you're pressing
<control>-d to move the cursor, only to find your command-line
disappearing.



But why use one set of keys to edit text and another to edit
commands?  The beauty of Linux is that you can customize it to
your heart's content.  Here's how to make bash act like our old
friend, joe:




  STEP 1: DEFINE KEYS WITH .INPUTRC:



The bash command-line is handled by the GNU readline library. So
it's not surprising that bash uses the same keystrokes as GNU
emacs.  Luckily, you can change these key-bindings simply by
setting new values in the file .inputrc.



The first step is to go to your $HOME directory and open or
create a text file named .inputrc.  Then add the following
lines, which tell bash to use the basic joe keystrokes:


      "\C-d": forward-char "\C-s": backward-char "\C-f": forward-word "\C-a": backward-word "\C-g":
      delete-char "\C-t": kill-word "\C-y": kill-whole-line
      You can also add the following lines, which fix the behavior of
      the <home>, <end>, <delete>, and <backspace>
      keys:


      "\e[1~": beginning-of-line "\e[3~": delete-char "\e[4~": end-of-line DEL: backward-delete-char
      
      Finally, you can use .inputrc to modify any one of the dozens of
      keystrokes and variables that control bash.  (Among other
      things, you can get bash to stop beeping at you!)  Check the
      READLINE section of the bash man page for details.
      



  STEP 2: FIX TERMINAL SETTINGS WITH STTY:



An experienced Linuxer will see that the changes we made to
.inputrc has created a problem.  We set <control>-s to
it's WordStar meaning.  But the Linux terminal uses
<control>-s to send the "stop" signal.
Pressing <control>-s freezes the terminal until you type
<control>-q, the "start" signal.



The easiest way to fix this is to tell the terminal to use a
different "stop" key.  To reassign "stop" to
<control>-p, type the following line (and put it in your
.bashrc to make it permanent):


      stty stop '^p'
      You can prove this works by pressing <control>-p then
      <control>-q.  It's also a good idea to check your terminal
      configuration -- especially if you change other keys with
      .inputrc.  Type:


      stty -a
      This will display your terminal settings.  If you reassigned the
      "stop" key as shown above, you should see "stop = ^P".



Now you're home free.  All you have to do is exit and log in
again.  And you can edit commands "joe-style."








  _______________________________________________________________________________________________




      Copyright &copy; 1997, Joel Wilf
      Published in Issue 14 of the Linux Gazette
      
      



  _______________________________________________________________________________________________




 [ TABLE OF CONTENTS ] 
 [ FRONT PAGE ] 
 Back  
 Next  



  _______________________________________________________________________________________________





    "Linux Gazette...making Linux just a little more lovable!" [IMAGE]
    



  _______________________________________________________________________________________________







Pick an Editor, Any Editor

    By Jens Wessling, jwesslin@erim.org
    



  _______________________________________________________________________________________________





 [IMAGE]

im (VI iMproved)


  _______________________________________________________________________________________________



One day I realized that I seem to spend an
inordinate amount of time in front of a computer screen
and more precisely with a text editor in front of me.
This should hardly have been a surprise to me considering
I work with computers for eight to ten hours a day and then
I go home and spend several more.  I guess that this obvious
fact finally struck home with me.  I would guess I spend
about 20-30 hours a week in a text editor alone.  With some
quick calculations I realized that this adds up to over 1000
hours a year.  That is over 40 solid days of my life every
year in an editor. (That is a conservative estimate.)  This
realization spurred me to try to optimize the time I spend
in my editor.



The first step I took was to try and find the best
editor around.  I started asking around to see who used
what and to try to find out what the important qualities
of an editor were.  Don't make this mistake.
Editors are one of the most religious beliefs a programmer
holds.  Every programmer is convinced that there's is the
best.  My office-mate uses PICO, some of my co-workers use
EMACS, VI, SlickEdit, or any one of an unending list.  Every
person I talked to insured me that their selection was by
far the best.  When I inquired about the differences, they
were primarily insignificant.  That was when I learned the
horrible truth.  Most editors are essentially equivalent.
No matter how hard people insist, most editors have more
features than any user will ever use. (Except PICO).  In the
Linux community, these selections basically fall in to one
of two categories.  VI clones, or Emacs.  My recommendation
is that everyone learn one of these well.  It doesn't really
matter which one, just pick one, stick with it and use it.
(Religiously if you must.)



I have gone to great lengths to learn VIM, a VI clone.  And
certainly if not THE best, one of the top contenders.  Many
features are shared among VI clones, basically the VI subset.
The additional features are basically individual to each
clone.  VIM comes with most, if not all, Linux distributions.
The home page for VIM is

http://www.math.fu-berlin.de/~guckes/vim/.  VIM is in
active development and is getting better by the day.  Syntax
highlighting should be out, if not by the time you read this,
then soon thereafter.



I will assume that most people know the basics of VI and want
to change it from a simple tool to a powerful one.  I will share
some of the handy tips and tricks I use.




Programming, Tabs, and Tags.

ctags is a marvelous utility for C and C++ Programmers.  ctags
comes with the VIM distribution.  What this utility does is
create a list of all the subroutine names in the files you
specify and allow you to jump to the given subroutine while
in you editor with just one keypress.  The way you run ctags
is simple.

    ctags *.c or ctags *.cpp
    Then, crank up your editor and move to wherever it is you
    call any subroutine from and press [CTRL]-].  This will
    take you immediately to wherever the routine is, even if
    it is in a different file.



File Switching

I frequently work with several files concurrently and I
need to switch between these files continually.  The
command to switch to another file in VIM is ":e fn".
The shortcut to switch to the last file edited is ":e #".
This is fine for normal use, but I switch files often, and
4 keystrokes seems like a bit much.  This is where VIM's
key mapping comes in.  VIM like most editors has an rc
file.  It is called .vimrc, what a shock. 8)
In this file I have the following command.

    " Save and switch to other buffer. map N :w [CTRL]-M
    This command lets me switch buffers with a single keypress.
    The other nice feature in VIM for switching between re arcane functions.  Bash, and its reduced-function alias
sh, work well as agents for executing shell scripts.  As a command
shell in a console or an xterm Bash provides many labor-saving shortcuts and
functions, most of which beginning users don't use.  Reading the voluminous
Bash documentation I began to realize that using Bash the way most users do,
i.e. as the default login and command shell, touches only a small fraction
of its capabilities. O'Reilly has published a three-hundred-page book
detailing Bash shell programming and usage !



Recently Chet Ramey, the maintainer of Bash, released version 2.00 to the
FTP sites.  After reading the list of changes and bug-fixes I concluded that
advanced users will be more appreciative of the release than will common
end-users, like myself.  It's an odd feeling to learn of a feature by finding
out that bugs have been fixed in it!  The documentation for Bash is extensive;
the man pages are available now in HTML format (in a separate file called
bash-doc-2.0.tar.gz).  Bash can be obtained both from Sunsite and its
mirrors (in /pub/gnu) and from the
main GNU site.


  _______________________________________________________________________________________________





I remember the first time I navigated my way through the Slackware
installation menus; being offered the option to install tcsh and zsh made me
realize how little I knew.  What were these alternative shells?  Evidently
some users preferred them to bash, but why?



All of the shells discussed in this article are extensively documented, but
that very feature, as helpful as it is to advanced users, can make it
difficult to get a rough idea of why one shell might be preferable to another.
Luckily it isn't hard to install another shell just to try it out.  Edit the
file /etc/shells (logged in as root) and add a line with the path to
the new shell.  Then execute the command chsh; a default choice will be
offered to you.  Ignore it and type in the name (with path) of the new shell.
You'll have to log out and log back in to activate the new shell.


  _______________________________________________________________________________________________



    Tcsh
    


In issue 12 of the Gazette  Jesper
Pederson wrote a good introductory article about Tcsh; this article also
shows how Jesper's program Dotfile Generator can be used to help write
Tcsh resource files without spending many hours reading the manual.  Since
that article appeared a new version of the Dotfile Generator has been released
which includes a module to generate Bash resource files.  I highly
recommend this program, which is available from
this site.  The Dotfile
Generator won't overwrite your existing files; it writes to another filename
(such as .bashrc-dotfile) This file can then be edited; I usually
transplant sections to my original files to try things out.  The Dotfile
Generator allows you to try various features of your shell without having to
learn the precise rc-file syntax first.

1

A little resource-file editing will be necessary to change over to Tcsh.
The aliases which you have defined can be transplanted from your ~/.bashrc to
~/.cshrc without alteration, but the environment variables are another matter.
Bash (and other ``Bourne-compatible'' shells, such as Zsh) uses a different
format for this than Tcsh.  As an example, export INFODIR=/mt/info in
the ~/.bash_profile would have to be changed to setenv INFODIR /mt/info
in ~/.tcshrc.  I recommend going to the trouble of transferring aliases and
environment variables if you want to give Tcsh a try.  If you don't you'll be
continually distracted by commands which don't work, and you will tend to
blame the shell.



The one feature which really stands out (if you're accustomed to Bash) is
the spelling-correction.  When either a filename or command is misspelled the
shell pops up a suggested correction.  If you tend to type commands quickly
and press ``enter'' without rereading what you've typed you'll love this.
Sometimes the shell is wrong, though, but pressing n rather than
y will force the shell to try and execute what you actually typed.


  _______________________________________________________________________________________________



    Zsh
    


After using Tcsh for a while, you may find yourself thinking, ``I really
don't want to switch completely to Tcsh; if only Bash had that spelling
correction built in!''  Zsh might be what you want.



Zsh is a Bourne-compatible shell like Bash but with several csh-like
features added.  It also resembles the proprietary Korn shell as well as
Pdksh, a free Korn-shell clone.  It's not at all difficult to adapt Bash
configuration files so that Zsh can use them as the syntax is nearly
identical.  ~/.zshenv is analogous to ~/.bash_profile, while ~/.zshrc
corresponds to ~/.bashrc.



The first thing you notice when using Zsh for the first time is the prompt,
which by default looks like this:



<machine-name>#                               /usr/local/src





As you can see, the current directory is on the right hand side of the
screen, giving more room for a command before the line breaks.  When a typed
command reaches the path on the right the path disappears to make room.



The spelling correction behavior seems to be identical to that of Tcsh.  As
with Bash and Tcsh, completion of paths and filenames is bound to the
tab key.  Zsh has an elaborate implementation of programmable
completion, in which file-type specific behavior for completions can be set in
the resource-files.



One helpful aspect of Zsh's completion behavior deserves notice.  Often
there will be a filename and a subdirectory with the same prefix, say if a
file called sample-2.01.tar.gz is unarchived into the directory in
which it resides, creating in the process a new subdirectory called
sample-2.01. Try the command cd sam<TAB> with some
shells and you will be asked if you want to change directory to
sample-2.01.tar.gz or to sample-2.01.  Zsh is smart enough to
realize that directories don't normally have a tar.gz suffix, and
changes to the directory without comment or question.



The Zsh distribution contains extensive help-files which are in the
Info format, allowing them to be browsed from within Emacs or with a
stand-alone Info reader. After reading these documents I came away with
the impression that Zsh probably rivals Bash in the number of arcane features
and programming abilities.  If you would like to see examples of the
complexity possible in Zsh configuration, take a look at The Next
Level, a package of Linux configuration files with explanation which has
become a part of recent Red Hat distributions.  The Next Level's author,
Greg J. Badros, has included an elaborate set of Zsh resource files.
I found them to be quite informative as an example of what's possible with
this shell.



Zsh seems to be under active development; version 3.00 was released last
year, and there have been minor releases since then.  There is a Zsh
home-page here which can serve as a good
introduction.


  _______________________________________________________________________________________________



  CONCLUSION
  


These shells certainly aren't hard to find; most distributions I've seen
include preconfigured packages for all three of them.  One caveat: if you
decide to settle on Tcsh or Zsh as your login shell don't remove Bash, or its
symlink /bin/sh.  Many shell scripts rely on /bin/sh in order to
run properly.  Some packages, such as the Andrew User Interface System, like
to have csh available, so if you have the disk-space Tcsh, along with
its symlink /bin/csh may as well be retained even if it's not your
login shell.



The choice of shells reminds me of the eternal debate between vi-users and
emacs-users.  A decision depends more on working-style and personality than
logic; try them all and see which one fits!


  _______________________________________________________________________________________________



Larry
Ayers



Last modified: Fri Jan 24 23:34:09 CST 1997







  _______________________________________________________________________________________________




      Copyright &copy; 1997, Larry Ayers
      Published in Issue 14 of the Linux Gazette
      
      



  _______________________________________________________________________________________________




 [ TABLE OF CONTENTS ] 
 [ FRONT PAGE ] 
 Back  
 Next  



  _______________________________________________________________________________________________





    "Linux Gazette...making Linux just a little more lovable!" [IMAGE]
    



  _______________________________________________________________________________________________







Novice Bash Tip -- Edit command-lines "joe-style"

    By Joel Wilf, av293@lafn.org
    
    



  _______________________________________________________________________________________________





If like me, you come from the world of DOS and WordStar, you
feel right at home with the joe editor, which uses WordStar
keystrokes.



But as soon as you exit joe, you're back in the land of bash,
where command-lines are edited "emacs-style." Soon,
your fingers are confused.  Before you know it, you're pressing
<control>-d to move the cursor, only to find your command-line
disappearing.



But why use one set of keys to edit text and another to edit
commands?  The beauty of Linux is that you can customize it to
your heart's content.  Here's how to make bash act like our old
friend, joe:




  STEP 1: DEFINE KEYS WITH .INPUTRC:



The bash command-line is handled by the GNU readline library. So
it's not surprising that bash uses the same keystrokes as GNU
emacs.  Luckily, you can change these key-bindings simply by
setting new values in the file .inputrc.



The first step is to go to your $HOME directory and open or
create a text file named .inputrc.  Then add the following
lines, which tell bash to use the basic joe keystrokes:


      "\C-d": forward-char "\C-s": backward-char "\C-f": forward-word "\C-a": backward-word "\C-g":
      delete-char "\C-t": kill-word "\C-y": kill-whole-line
      You can also add the following lines, which fix the behavior of
      the <home>, <end>, <delete>, and <backspace>
      keys:


      "\e[1~": beginning-of-line "\e[3~": delete-char "\e[4~": end-of-line DEL: backward-delete-char
      
      Finally, you can use .inputrc to modify any one of the dozens of
      keystrokes and variables that control bash.  (Among other
      things, you can get bash to stop beeping at you!)  Check the
      READLINE section of the bash man page for details.
      



  STEP 2: FIX TERMINAL SETTINGS WITH STTY:



An experienced Linuxer will see that the changes we made to
.inputrc has created a problem.  We set <control>-s to
it's WordStar meaning.  But the Linux terminal uses
<control>-s to send the "stop" signal.
Pressing <control>-s freezes the terminal until you type
<control>-q, the "start" signal.



The easiest way to fix this is to tell the terminal to use a
different "stop" key.  To reassign "stop" to
<control>-p, type the following line (and put it in your
.bashrc to make it permanent):


      stty stop '^p'
      You can prove this works by pressing <control>-p then
      <control>-q.  It's also a good idea to check your terminal
      configuration -- especially if you change other keys with
      .inputrc.  Type:


      stty -a
      This will display your terminal settings.  If you reassigned the
      "stop" key as shown above, you should see "stop = ^P".



Now you're home free.  All you have to do is exit and log in
again.  And you can edit commands "joe-style."








  _______________________________________________________________________________________________




      Copyright &copy; 1997, Joel Wilf
      Published in Issue 14 of the Linux Gazette
      
      



  _______________________________________________________________________________________________




 [ TABLE OF CONTENTS ] 
 [ FRONT PAGE ] 
 Back  
 Next  



  _______________________________________________________________________________________________





    "Linux Gazette...making Linux just a little more lovable!" [IMAGE]
    



  _______________________________________________________________________________________________







Pick an Editor, Any Editor

    By Jens Wessling, jwesslin@erim.org
    



  _______________________________________________________________________________________________





 [IMAGE]

im (VI iMproved)


  _______________________________________________________________________________________________



One day I realized that I seem to spend an
inordinate amount of time in front of a computer screen
and more precisely with a text editor in front of me.
This should hardly have been a surprise to me considering
I work with computers for eight to ten hours a day and then
I go home and spend several more.  I guess that this obvious
fact finally struck home with me.  I would guess I spend
about 20-30 hours a week in a text editor alone.  With some
quick calculations I realized that this adds up to over 1000
hours a year.  That is over 40 solid days of my life every
year in an editor. (That is a conservative estimate.)  This
realization spurred me to try to optimize the time I spend
in my editor.



The first step I took was to try and find the best
editor around.  I started asking around to see who used
what and to try to find out what the important qualities
of an editor were.  Don't make this mistake.
Editors are one of the most religious beliefs a programmer
holds.  Every programmer is convinced that there's is the
best.  My office-mate uses PICO, some of my co-workers use
EMACS, VI, SlickEdit, or any one of an unending list.  Every
person I talked to insured me that their selection was by
far the best.  When I inquired about the differences, they
were primarily insignificant.  That was when I learned the
horrible truth.  Most editors are essentially equivalent.
No matter how hard people insist, most editors have more
features than any user will ever use. (Except PICO).  In the
Linux community, these selections basically fall in to one
of two categories.  VI clones, or Emacs.  My recommendation
is that everyone learn one of these well.  It doesn't really
matter which one, just pick one, stick with it and use it.
(Religiously if you must.)



I have gone to great lengths to learn VIM, a VI clone.  And
certainly if not THE best, one of the top contenders.  Many
features are shared among VI clones, basically the VI subset.
The additional features are basically individual to each
clone.  VIM comes with most, if not all, Linux distributions.
The home page for VIM is

http://www.math.fu-berlin.de/~guckes/vim/.  VIM is in
active development and is getting better by the day.  Syntax
highlighting should be out, if not by the time you read this,
then soon thereafter.



I will assume that most people know the basics of VI and want
to change it from a simple tool to a powerful one.  I will share
some of the handy tips and tricks I use.




Programming, Tabs, and Tags.

ctags is a marvelous utility for C and C++ Programmers.  ctags
comes with the VIM distribution.  What this utility does is
create a list of all the subroutine names in the files you
specify and allow you to jump to the given subroutine while
in you editor with just one keypress.  The way you run ctags
is simple.

    ctags *.c or ctags *.cpp
    Then, crank up your editor and move to wherever it is you
    call any subroutine from and press [CTRL]-].  This will
    take you immediately to wherever the routine is, even if
    it is in a different file.



File Switching

I frequently work with several files concurrently and I
need to switch between these files continually.  The
command to switch to another file in VIM is ":e fn".
The shortcut to switch to the last file edited is ":e #".
This is fine for normal use, but I switch files often, and
4 keystrokes seems like a bit much.  This is where VIM's
key mapping comes in.  VIM like most editors has an rc
file.  It is called .vimrc, what a shock. 8)
In this file I have the following command.

    " Save and switch to other buffer. map N :w [CTRL]-M
    This command lets me switch buffers with a single keypress.
    The other nice feature in VIM for switching between re arcane functions.  Bash, and its reduced-function alias
sh, work well as agents for executing shell scripts.  As a command
shell in a console or an xterm Bash provides many labor-saving shortcuts and
functions, most of which beginning users don't use.  Reading the voluminous
Bash documentation I began to realize that using Bash the way most users do,
i.e. as the default login and command shell, touches only a small fraction
of its capabilities. O'Reilly has published a three-hundred-page book
detailing Bash shell programming and usage !



Recently Chet Ramey, the maintainer of Bash, released version 2.00 to the
FTP sites.  After reading the list of changes and bug-fixes I concluded that
advanced users will be more appreciative of the release than will common
end-users, like myself.  It's an odd feeling to learn of a feature by finding
out that bugs have been fixed in it!  The documentation for Bash is extensive;
the man pages are available now in HTML format (in a separate file called
bash-doc-2.0.tar.gz).  Bash can be obtained both from Sunsite and its
mirrors (in /pub/gnu) and from the
main GNU site.


  _______________________________________________________________________________________________





I remember the first time I navigated my way through the Slackware
installation menus; being offered the option to install tcsh and zsh made me
realize how little I knew.  What were these alternative shells?  Evidently
some users preferred them to bash, but why?



All of the shells discussed in this article are extensively documented, but
that very feature, as helpful as it is to advanced users, can make it
difficult to get a rough idea of why one shell might be preferable to another.
Luckily it isn't hard to install another shell just to try it out.  Edit the
file /etc/shells (logged in as root) and add a line with the path to
the new shell.  Then execute the command chsh; a default choice will be
offered to you.  Ignore it and type in the name (with path) of the new shell.
You'll have to log out and log back in to activate the new shell.


  _______________________________________________________________________________________________



    Tcsh
    


In issue 12 of the Gazette  Jesper
Pederson wrote a good introductory article about Tcsh; this article also
shows how Jesper's program Dotfile Generator can be used to help write
Tcsh resource files without spending many hours reading the manual.  Since
that article appeared a new version of the Dotfile Generator has been released
which includes a module to generate Bash resource files.  I highly
recommend this program, which is available from
this site.  The Dotfile
Generator won't overwrite your existing files; it writes to another filename
(such as .bashrc-dotfile) This file can then be edited; I usually
transplant sections to my original files to try things out.  The Dotfile
Generator allows you to try various features of your shell without having to
learn the precise rc-file syntax first.

1

A little resource-file editing will be necessary to change over to Tcsh.
The aliases which you have defined can be transplanted from your ~/.bashrc to
~/.cshrc without alteration, but the environment variables are another matter.
Bash (and other ``Bourne-compatible'' shells, such as Zsh) uses a different
format for this than Tcsh.  As an example, export INFODIR=/mt/info in
the ~/.bash_profile would have to be changed to setenv INFODIR /mt/info
in ~/.tcshrc.  I recommend going to the trouble of transferring aliases and
environment variables if you want to give Tcsh a try.  If you don't you'll be
continually distracted by commands which don't work, and you will tend to
blame the shell.



The one feature which really stands out (if you're accustomed to Bash) is
the spelling-correction.  When either a filename or command is misspelled the
shell pops up a suggested correction.  If you tend to type commands quickly
and press ``enter'' without rereading what you've typed you'll love this.
Sometimes the shell is wrong, though, but pressing n rather than
y will force the shell to try and execute what you actually typed.


  _______________________________________________________________________________________________



    Zsh
    


After using Tcsh for a while, you may find yourself thinking, ``I really
don't want to switch completely to Tcsh; if only Bash had that spelling
correction built in!''  Zsh might be what you want.



Zsh is a Bourne-compatible shell like Bash but with several csh-like
features added.  It also resembles the proprietary Korn shell as well as
Pdksh, a free Korn-shell clone.  It's not at all difficult to adapt Bash
configuration files so that Zsh can use them as the syntax is nearly
identical.  ~/.zshenv is analogous to ~/.bash_profile, while ~/.zshrc
corresponds to ~/.bashrc.



The first thing you notice when using Zsh for the first time is the prompt,
which by default looks like this:



<machine-name>#                               /usr/local/src





As you can see, the current directory is on the right hand side of the
screen, giving more room for a command before the line breaks.  When a typed
command reaches the path on the right the path disappears to make room.



The spelling correction behavior seems to be identical to that of Tcsh.  As
with Bash and Tcsh, completion of paths and filenames is bound to the
tab key.  Zsh has an elaborate implementation of programmable
completion, in which file-type specific behavior for completions can be set in
the resource-files.



One helpful aspect of Zsh's completion behavior deserves notice.  Often
there will be a filename and a subdirectory with the same prefix, say if a
file called sample-2.01.tar.gz is unarchived into the directory in
which it resides, creating in the process a new subdirectory called
sample-2.01. Try the command cd sam<TAB> with some
shells and you will be asked if you want to change directory to
sample-2.01.tar.gz or to sample-2.01.  Zsh is smart enough to
realize that directories don't normally have a tar.gz suffix, and
changes to the directory without comment or question.



The Zsh distribution contains extensive help-files which are in the
Info format, allowing them to be browsed from within Emacs or with a
stand-alone Info reader. After reading these documents I came away with
the impression that Zsh probably rivals Bash in the number of arcane features
and programming abilities.  If you would like to see examples of the
complexity possible in Zsh configuration, take a look at The Next
Level, a package of Linux configuration files with explanation which has
become a part of recent Red Hat distributions.  The Next Level's author,
Greg J. Badros, has included an elaborate set of Zsh resource files.
I found them to be quite informative as an example of what's possible with
this shell.



Zsh seems to be under active development; version 3.00 was released last
year, and there have been minor releases since then.  There is a Zsh
home-page here which can serve as a good
introduction.


  _______________________________________________________________________________________________



  CONCLUSION
  


These shells certainly aren't hard to find; most distributions I've seen
include preconfigured packages for all three of them.  One caveat: if you
decide to settle on Tcsh or Zsh as your login shell don't remove Bash, or its
symlink /bin/sh.  Many shell scripts rely on /bin/sh in order to
run properly.  Some packages, such as the Andrew User Interface System, like
to have csh available, so if you have the disk-space Tcsh, along with
its symlink /bin/csh may as well be retained even if it's not your
login shell.



The choice of shells reminds me of the eternal debate between vi-users and
emacs-users.  A decision depends more on working-style and personality than
logic; try them all and see which one fits!


  _______________________________________________________________________________________________



Larry
Ayers



Last modified: Fri Jan 24 23:34:09 CST 1997







  _______________________________________________________________________________________________




      Copyright &copy; 1997, Larry Ayers
      Published in Issue 14 of the Linux Gazette
      
      



  _______________________________________________________________________________________________




 [ TABLE OF CONTENTS ] 
 [ FRONT PAGE ] 
 Back  
 Next  



  _______________________________________________________________________________________________





    "Linux Gazette...making Linux just a little more lovable!" [IMAGE]
    



  _______________________________________________________________________________________________







Novice Bash Tip -- Edit command-lines "joe-style"

    By Joel Wilf, av293@lafn.org
    
    



  _______________________________________________________________________________________________





If like me, you come from the world of DOS and WordStar, you
feel right at home with the joe editor, which uses WordStar
keystrokes.



But as soon as you exit joe, you're back in the land of bash,
where command-lines are edited "emacs-style." Soon,
your fingers are confused.  Before you know it, you're pressing
<control>-d to move the cursor, only to find your command-line
disappearing.



But why use one set of keys to edit text and another to edit
commands?  The beauty of Linux is that you can customize it to
your heart's content.  Here's how to make bash act like our old
friend, joe:




  STEP 1: DEFINE KEYS WITH .INPUTRC:



The bash command-line is handled by the GNU readline library. So
it's not surprising that bash uses the same keystrokes as GNU
emacs.  Luckily, you can change these key-bindings simply by
setting new values in the file .inputrc.



The first step is to go to your $HOME directory and open or
create a text file named .inputrc.  Then add the following
lines, which tell bash to use the basic joe keystrokes:


      "\C-d": forward-char "\C-s": backward-char "\C-f": forward-word "\C-a": backward-word "\C-g":
      delete-char "\C-t": kill-word "\C-y": kill-whole-line
      You can also add the following lines, which fix the behavior of
      the <home>, <end>, <delete>, and <backspace>
      keys:


      "\e[1~": beginning-of-line "\e[3~": delete-char "\e[4~": end-of-line DEL: backward-delete-char
      
      Finally, you can use .inputrc to modify any one of the dozens of
      keystrokes and variables that control bash.  (Among other
      things, you can get bash to stop beeping at you!)  Check the
      READLINE section of the bash man page for details.
      



  STEP 2: FIX TERMINAL SETTINGS WITH STTY:



An experienced Linuxer will see that the changes we made to
.inputrc has created a problem.  We set <control>-s to
it's WordStar meaning.  But the Linux terminal uses
<control>-s to send the "stop" signal.
Pressing <control>-s freezes the terminal until you type
<control>-q, the "start" signal.



The easiest way to fix this is to tell the terminal to use a
different "stop" key.  To reassign "stop" to
<control>-p, type the following line (and put it in your
.bashrc to make it permanent):


      stty stop '^p'
      You can prove this works by pressing <control>-p then
      <control>-q.  It's also a good idea to check your terminal
      configuration -- especially if you change other keys with
      .inputrc.  Type:


      stty -a
      This will display your terminal settings.  If you reassigned the
      "stop" key as shown above, you should see "stop = ^P".



Now you're home free.  All you have to do is exit and log in
again.  And you can edit commands "joe-style."








  _______________________________________________________________________________________________




      Copyright &copy; 1997, Joel Wilf
      Published in Issue 14 of the Linux Gazette
      
      



  _______________________________________________________________________________________________




 [ TABLE OF CONTENTS ] 
 [ FRONT PAGE ] 
 Back  
 Next  



  _______________________________________________________________________________________________





    "Linux Gazette...making Linux just a little more lovable!" [IMAGE]
    



  _______________________________________________________________________________________________







Pick an Editor, Any Editor

    By Jens Wessling, jwesslin@erim.org
    



  _______________________________________________________________________________________________





 [IMAGE]

im (VI iMproved)


  _______________________________________________________________________________________________



One day I realized that I seem to spend an
inordinate amount of time in front of a computer screen
and more precisely with a text editor in front of me.
This should hardly have been a surprise to me considering
I work with computers for eight to ten hours a day and then
I go home and spend several more.  I guess that this obvious
fact finally struck home with me.  I would guess I spend
about 20-30 hours a week in a text editor alone.  With some
quick calculations I realized that this adds up to over 1000
hours a year.  That is over 40 solid days of my life every
year in an editor. (That is a conservative estimate.)  This
realization spurred me to try to optimize the time I spend
in my editor.



The first step I took was to try and find the best
editor around.  I started asking around to see who used
what and to try to find out what the important qualities
of an editor were.  Don't make this mistake.
Editors are one of the most religious beliefs a programmer
holds.  Every programmer is convinced that there's is the
best.  My office-mate uses PICO, some of my co-workers use
EMACS, VI, SlickEdit, or any one of an unending list.  Every
person I talked to insured me that their selection was by
far the best.  When I inquired about the differences, they
were primarily insignificant.  That was when I learned the
horrible truth.  Most editors are essentially equivalent.
No matter how hard people insist, most editors have more
features than any user will ever use. (Except PICO).  In the
Linux community, these selections basically fall in to one
of two categories.  VI clones, or Emacs.  My recommendation
is that everyone learn one of these well.  It doesn't really
matter which one, just pick one, stick with it and use it.
(Religiously if you must.)



I have gone to great lengths to learn VIM, a VI clone.  And
certainly if not THE best, one of the top contenders.  Many
features are shared among VI clones, basically the VI subset.
The additional features are basically individual to each
clone.  VIM comes with most, if not all, Linux distributions.
The home page for VIM is

http://www.math.fu-berlin.de/~guckes/vim/.  VIM is in
active development and is getting better by the day.  Syntax
highlighting should be out, if not by the time you read this,
then soon thereafter.



I will assume that most people know the basics of VI and want
to change it from a simple tool to a powerful one.  I will share
some of the handy tips and tricks I use.




Programming, Tabs, and Tags.

ctags is a marvelous utility for C and C++ Programmers.  ctags
comes with the VIM distribution.  What this utility does is
create a list of all the subroutine names in the files you
specify and allow you to jump to the given subroutine while
in you editor with just one keypress.  The way you run ctags
is simple.

    ctags *.c or ctags *.cpp
    Then, crank up your editor and move to wherever it is you
    call any subroutine from and press [CTRL]-].  This will
    take you immediately to wherever the routine is, even if
    it is in a different file.



File Switching

I frequently work with several files concurrently and I
need to switch between these files continually.  The
command to switch to another file in VIM is ":e fn".
The shortcut to switch to the last file edited is ":e #".
This is fine for normal use, but I switch files often, and
4 keystrokes seems like a bit much.  This is where VIM's
key mapping comes in.  VIM like most editors has an rc
file.  It is called .vimrc, what a shock. 8)
In this file I have the following command.

    " Save and switch to other buffer. map N :w [CTRL]-M
    This command lets me switch buffers with a single keypress.
    The other nice feature in VIM for switching between re arcane functions.  Bash, and its reduced-function alias
sh, work well as agents for executing shell scripts.  As a command
shell in a console or an xterm Bash provides many labor-saving shortcuts and
functions, most of which beginning users don't use.  Reading the voluminous
Bash documentation I began to realize that using Bash the way most users do,
i.e. as the default login and command shell, touches only a small fraction
of its capabilities. O'Reilly has published a three-hundred-page book
detailing Bash shell programming and usage !



Recently Chet Ramey, the maintainer of Bash, released version 2.00 to the
FTP sites.  After reading the list of changes and bug-fixes I concluded that
advanced users will be more appreciative of the release than will common
end-users, like myself.  It's an odd feeling to learn of a feature by finding
out that bugs have been fixed in it!  The documentation for Bash is extensive;
the man pages are available now in HTML format (in a separate file called
bash-doc-2.0.tar.gz).  Bash can be obtained both from Sunsite and its
mirrors (in /pub/gnu) and from the
main GNU site.


  _______________________________________________________________________________________________





I remember the first time I navigated my way through the Slackware
installation menus; being offered the option to install tcsh and zsh made me
realize how little I knew.  What were these alternative shells?  Evidently
some users preferred them to bash, but why?



All of the shells discussed in this article are extensively documented, but
that very feature, as helpful as it is to advanced users, can make it
difficult to get a rough idea of why one shell might be preferable to another.
Luckily it isn't hard to install another shell just to try it out.  Edit the
file /etc/shells (logged in as root) and add a line with the path to
the new shell.  Then execute the command chsh; a default choice will be
offered to you.  Ignore it and type in the name (with path) of the new shell.
You'll have to log out and log back in to activate the new shell.


  _______________________________________________________________________________________________



    Tcsh
    


In issue 12 of the Gazette  Jesper
Pederson wrote a good introductory article about Tcsh; this article also
shows how Jesper's program Dotfile Generator can be used to help write
Tcsh resource files without spending many hours reading the manual.  Since
that article appeared a new version of the Dotfile Generator has been released
which includes a module to generate Bash resource files.  I highly
recommend this program, which is available from
this site.  The Dotfile
Generator won't overwrite your existing files; it writes to another filename
(such as .bashrc-dotfile) This file can then be edited; I usually
transplant sections to my original files to try things out.  The Dotfile
Generator allows you to try various features of your shell without having to
learn the precise rc-file syntax first.

1

A little resource-file editing will be necessary to change over to Tcsh.
The aliases which you have defined can be transplanted from your ~/.bashrc to
~/.cshrc without alteration, but the environment variables are another matter.
Bash (and other ``Bourne-compatible'' shells, such as Zsh) uses a different
format for this than Tcsh.  As an example, export INFODIR=/mt/info in
the ~/.bash_profile would have to be changed to setenv INFODIR /mt/info
in ~/.tcshrc.  I recommend going to the trouble of transferring aliases and
environment variables if you want to give Tcsh a try.  If you don't you'll be
continual                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 