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

More 2¢ Tips!

Send Linux Tips and Tricks to


Netscape and Seyon questions

Date: Mon, 8 Sep 1997 11:23:51 -0600 (MDT)
From: "Michael J. Hammel"

Lynn Danielson asked:

I downloaded Netscape Communicator just a few weeks ago from the Netscape site. I'm not sure older versions of Netscape are still available. I'm probably wrong, but I was under the impression that only the most current beta versions were freely available.


A quick search through Alta-Vista for Netscape mirrors showed a couple of different listing for mirror sites. I perused a few and found most either didn't have anything or had non-English versions, etc. One site I did find with all the appropriate pieces is:


Its a long way to go to get it (Australia), but thats all I could find. If you want to go directly to the latest (4.03b8) Communicator directory, try:


I did notice once while trying to download from Netscape that older versions were available, although I didn't try to download them. I noticed this while looking for the latest download of Communicator through their web sites. Can't remember how I found that, though.

The 3.x version is available commercially from Caldera. I expect that the 4.x versions will be as well, though I don't know if Caldera keeps the beta versions on their anonymous ftp sites.

BTW, the Page Composer is pretty slick, although it has no interface for doing Javascript. It has a few bugs, but its the best WYSIWYG interface for HTML composition on Linux that I've seen. Its better than Applix's HTML Editor, although that one does allow exporting to non-HTML stuff. Collabra Discussions sucks. The old news reader was better at most things. I'd still like to be able to mark a newsgroup read up to a certain point instead of the all-or-nothing bit.

For anyone who is interested - 4.x now supports CSS (Cascading Style Sheets) and layers. Both of these are *very* cool. They are the future of Web design and, IMHO, a very good way to create Multimedia applications for distribution on CDs. One of C|Net's web pages (I think) has some info on these items, including a demo of layers (moves an image all over the screen *over* the underlying text - way cool). The only C|Net URL I ever remember is www.news.com, but you can get to the rest of their sites from there.

-- Michael J. Hammel

Keeping track of tips

Date: Tue, 26 Aug 1997 16:29:13 +0200
From: Ivo Saviane

Dear LG,

it always happens to me that I spend a lot of time finding out how to do a certain thing under Linux/Unix, and then I forget it. The next time I need that information I will start all the `find . ...', `grep xxx *' process again and waste the same amount of time!

To me, the best way to avoid that is to send a mail to myself telling how to do that particular operation. But mail folders get messy and, moreover, are not useful to other users who might need that same information.

Finally I found something that contributes solving this problem. I set up a dummy user who reads his mail and puts it in www readable form. Now it is easy for me to send a mail to news@machine as soon as I learn something, and be sure that I will be able to find that information again just clicking on the appropriate link. It would also be easy to set up a grep script and link it to the same page.

The only warning is to put a meaningful `subject: ' to the mail, since this string will be written besides the link.

I am presently not aware of something similar. At least, not that simple. It you know, let me know too!

If you want to see how this works, visit


A quick description of the basic operations needed is given below.


The following lines briefly describe how to set up the light news server.

1. Create a new user named `news'

2. Login as news and create the directories ~/public_html and ~/public_html/folders (I assume that your http server is configured so that `http://machine/~user' will point to `public_html' in the user's $HOME).

3. Put the wmanager.sh script in the $HOME/bin directory. The script follows the main body of this message as attachment [1]. The script does work under bash.

The relevant variables are grouped at the beginning of the script. These should be changed according to the machine/user setup

4. The script uses splitmail.c in order to break the mail file in sub-folders The binary file should be put in the $HOME/bin dir. See attachment [2].

5. Finally, add a line in the `news' user crontab, like the following

00 * * * * /news_bin_dir/wmanager.sh

where `news_bin_dir' stands for $HOME/bin. In this case the mail will be checked once every hour.

---------------------------------- attachment [1]


# wmanager.sh

# Updates the www news page reading the user's mails 
# (c) 1997 Ivo Saviane

# requires splitmail (attachment [2]) 

## --- environment setup

BIN=/home/obelnews/bin                  # contains all the executables
MDIR=/usr/spool/mail                    # mail files directory
USR=news                                # user's login name
MFOLDER=$MDIR/$USR                      # user's mail file
MYFNAME=`date +%y~%m~%d~%H:%M:%S.fld`   # filename for mail storage under www

FLD=folders                             # final dir root name
PUB=public_html                         # httpd declared public directory

## --- determines the mailfile size

MSIZE=`ls -l $MFOLDER | awk '{print $5}'`

## --- if new mail arrived goes on; otherwise does nothing

if [ $MSIZE != "0" ]; then 

## --- writes the header of index.html in the pub dir

 echo "<html><head><title> News! </title></head>" > $INDEX
 echo "<h2> Internal news archive </h2> <p><p>" >> $INDEX
 echo "Last update: <i>`date`</i> <hr>" >> $INDEX

## --- breaks the mail file in single folders; splitmail.c must be compiled

 $BIN/splitmail $MFOLDER > $MFOLDER

## --- each folder is copied in the folder dir, under the pub dir, 
##     and given an unique name

 for f in $MFOLDER.*; do\
   NR=`echo $f | cut -d. -f2`;\
   MYFNAME=`date +%y~%m~%d~%H:%M:%S.$NR.fld`;\
   mv $f $MYFOLDER;\

## --- prepares the mailfile for future messages

 touch $MFOLDER 

## --- Now creates the body of the www index page, searching the folders
##     dir

 for f in `ls $PUBDIR/* | grep -v index`; do\
   htname=`echo $f | cut -d/ -f5,6`;\
   rfname=`echo $f | cut -d/ -f6 | sed 's/.fld//g'`;\
   echo \<a href\=\"$htname\"\> $rfname\<\/a\> >> $INDEX;\
   echo \<strong\> >> $INDEX;\
   grep "Subject:" $f | head -1  >> $INDEX;\
   echo \</strong\> >> $INDEX;\
   echo \<br\> >> $INDEX;\

  echo "<hr>End of archive" >> $INDEX
  echo "</html>" >> $INDEX

---- attachment [2]

   Reads stdin. Assuming that this has a mailfile format, it breaks the input
   in single messages. A filestem must be given as argument, and single 
   messages will be written as  filestem.1 filestem.2 etc.
   (c) 1997 I.Saviane


#define NMAX 256

#include <stdio.h>


/**************************  MAIN **************************************/

int main(int argc, char *argv[]) {

  FILE *fp;
  char mline[NMAX], mname[NMAX];
  int nmail=0, open;

  if(argc < 2) {
    fprintf(stderr, "splitmail: no input filestem");
    return -1;

  fp = fopen("/tmp/xx", "w");
  while(fgets(mline, NMAX, stdin) != NULL) {

    open = IsFrom(mline);
    if(open==1) {

      sprintf(mname, "%s.%d", argv[1], nmail);
      fp = fopen(mname, "w");
      open = 0;
    fprintf(fp, "%s", mline);
  system("rm /tmp/xx");
  return 1;


int IsFrom(char *s) {

  if(s[0]=='F' && s[1]=='r' && s[2]=='o' && s[3]=='m' && s[4]==' ') {

    return 1;
  } else {

    return 0;

Displaying File Tree

Date: Tue, 26 Aug 1997 16:40:43 -0400 (EDT)
From: Scott K. Ellis

A nice tool for displaying a graphic tree of files or directories in your filesystem can be found at your local sunsite mirror under /pub/Linux/utils/file/tree-1.2.tgz. It is also included as the package tree included in the Debian distribution.

Making Changing X video modes easier

Date: Thu, 28 Aug 1997 20:29:59 +0100
From: Jo Whitby

In issue 20 of the Linux gazette there was a letter from Greg Roelofs on changing video modes in X - this was something I had tried and had found changing colour depths awkward, and didn't know how to start multiple versions of X.

I also found the syntax of the commands difficult to remember, so here's what I did.

First I created 2 files in /usr/local/bin called x8 and x16 for the colour depths that I use, and placed the command in them -

for x8

startx -- :$* -bpp 8 &

and for x16

startx -- :$* -bpp 16 &

then I made them executable -

chmod -c 755 /usr/local/bin/x8
chmod -c 755 /usr/local/bin/x16

now I simply issue the command x8 or x16 for the first instance of X and x8 1 or x16 1 for the next and so on, this I find much easer to remember:-) An addition I would like to make would be to check which X servers are running and to increment the numbers automatically, but as I have only been running Linux for around 6 months my script writing is extremely limited, I must invest in a book on the subject.

Linux is a fantastic OS, now I've tried it I could not go back to Windoze and hate having to turn my Linux box into a wooden doze box just to run the couple of progs that I can't live without (Quicken 4 and a lottery checking prog), so if anyone knows of a good alternative to these please let me know, the sooner doze is gone for good the better - then Linux can have the other 511Mb of space doze95 is hogging!

ps. Linux Gazette is just brilliant, I've been reading all the back issues, nearly caught up now - only been on the net for 3 months. I hope to be able to contribute something a little more useful to the Gazette in the future, when my knowledge is a little better:-)

keep up the good work.

Tree Program

Date: Mon, 01 Sep 1997 03:28:57 -0500
From: Ian

Try this instead of the tree shell-script mentioned earlier:
--------- Cut here --------

#include <stdlib.h>
#include <stdio.h>

#include <sys/stat.h>
#include <unistd.h>

#include <sys/types.h>
#include <dirent.h>

// This is cool for ext2.
#define MAXLEN 256
#define maxdepth 4096

struct dnode {
 dnode *sister;
 char name[MAXLEN];

const char *look;
const char *l_ascii="|+`-";
const char l_ibm[5]={179,195,192,196,0};

int total;

char map[maxdepth];

void generate_header(int level) {
 int i;
 for (i=0;i<level;i++) printf(" %c ",(map[i]?look[0]:32));
 printf (" %c%c ",(map[level]?look[1]:look[2]),look[3]);

dnode* reverselist(dnode *last) {
 dnode *first,*current;

 // Put it back in order:
 // Pre: last==current, first==NULL, current points to backwards linked
 while (current != NULL) {

 return first;

void buildtree(int level) {
 dnode *first,*current,*last;
 char *cwd;
 struct stat st;

 if (level>=maxdepth) return;

 // This is LINUX SPECIFIC: (ie it may not work on other platforms)
 if (cwd==NULL) return;

 // Get (backwards) Dirlist:
 DIR *dir;
 dirent *de;

 if (dir==NULL) return;

 while ((de=readdir(dir))) {
  // use de->d_name for the filename
  if (lstat(de->d_name,&st) != 0) continue; // ie if not success go on.
  if (!S_ISDIR(st.st_mode)) continue; // if not dir go on.
  if (!(strcmp(".",de->d_name) && strcmp("..",de->d_name))) continue; //
skip ./
  current=new dnode;



 // go through each printing names and subtrees

 while (first != NULL) {
  map[level]=(first->sister != NULL);
  // consider recursion here....
  if (chdir (first->name) == 0) {
   if (chdir (cwd) != 0) return;
  delete first;
 free (cwd);

void tree() {
 char *cwd;
 if (cwd==NULL) return;
 printf("Tree of %s:\n\n",cwd);
 free (cwd);
 printf("\nTotal directories = %d\n",total);

void usage() {
 printf("usage: tree {-[agiv]} {dirname}\n\n");
 printf("Tree version 1.0 - Copyright 1997 by Brooke Kjos
 printf("This program is covered by the Gnu General Public License
version 2.0\n
 printf("or later (copyleft). Distribution and use permitted as long
 printf("source code accompanies all executables and no additional\n");
 printf("restrictions are applied\n");
 printf("\n\n Options:\n\t-a use ascii for drawings\n");
 printf("\t-[ig] use IBM(tm) graphics characters\n");
 printf("\t-v Show version number and exit successfully\n");

void main (int argc,char ** argv)  {
 int i=1;
 if (argc>1) {
  if (argv[1][0]=='-') {
   switch ((argv[1])[1]) {
    case 'i':
    case 'I':
    case 'g':
    case 'G':
    look = l_ibm;
    case 'a':
    case 'A':
    look = l_ascii;
    case 'v':
    case 'V':
    printf ("Unknown option: %s\n\n",argv[1]);
   } // switch
  } // if2
 } // if1
 if (argc > i) {
  char *cwd;
  if (cwd==NULL) {
   printf("Failed to getcwd:\n");
  for (;i>argc;i++) {
   if (chdir(argv[i]) == 0) {
    if (chdir(cwd) != 0) {
     printf("Failed to chdir to cwd\n");
   else printf("Failed to chdir to %s\n\n",argv[i]);
  } // for
  free (cwd);
 } else tree();

------- Cut Here --------

Call this tree.cc and run gcc -O2 tree.cc -o /usr/local/bin/tree.

Managing an Entire Project

Date: Tue, 26 Aug 1997 16:44:06 -0400 (EDT)
From: Scott K. Ellis

While RCS is useful for managing one or a small set of files, CVS is a wrapper around RCS that allows you to easily keep track of revisions across an entire project.

Finding what you want with find

Date: Tue, 2 Sep 1997 21:53:41 -0500 (CDT)
From: David Nelson

While the find . -type f -exec grep "string" {} \; works, it does not tell you what file it found the string in. Try using find . -type f -exec grep "string" /dev/null {} \; instead.

David /\/elson

Minicom kermit help

Date: Wed, 10 Sep 1997 12:21:55 -0400 (EDT)
From: "Donald R. Harter Jr."

With minicom, ckermit was hanging up the phone line after I exited it to return to minicom. I was able to determine a quick fix for this. In file ckutio.c comment out (/* */) line 2119 which has tthang() in it. tthang hangs up the line. I don't know why ckermit thought that it should hang up the line.

Donald Harter Jr.

Postscript printing

Date: Sun, 7 Sep 1997 15:12:17 +0200 (MET DST)
From: Roland Smith

Regarding your question in the Linux Gazette, there is a program that can interpret postscript for different printers. It's called Ghostscript.

The smartest thing to do is to encapsulate it in a shell-script and then call this script from printcap.

----- Ghostscript shell script -------
#!/bin/sh # # pslj This shell script is called as an input filter for the # HP LaserJet 5L printer as a PostScript printer # # Version: /usr/local/bin/pslj 1.0 # # Author: R.F. Smith <rsmit06@ibm.net> # Run GhostScript, which runs quietly at a resolution # of 600 dpi, outputs for the laserjet 4, in safe mode, without pausing # at page breaks, writing and reading from standard input/output /usr/bin/gs -q -r600 -sDEVICE=ljet4 -dSAFER -dNOPAUSE -sOutputFile=- - ------- Ghostscript shell script ------

You should only have to change the resolution -r and device -sDEVICE options to something more suitable to your printer. See gs -? for a list of supported devices. I'd suggest you try the cdeskjet or djet500c devices. Do a chmod 755 <scriptname>, and copy it to /usr/local/bin as root.

Next you should add a Postscript printer to your /etc/printcap file. Edit this file as root.

-------- printcap excerpt -----------
ps|HP LaserJet 5L as PostScript:\ :lp=/dev/lp1:\ :sd=/var/spool/lp1:\ :mx#0:\ :if=/usr/local/bin/pslj:sh
-------- printcap excerpt ------------

This is the definition of a printer called ps. It passes everything it should print through the pslj filter, which converts the postscript to something my Laserjet 5 can use.

To print Postscript, use lpr -Pps filename.

change this to reflect your script name.

Hope this helps!


Realaudio without X-windows

Date: Sun, 7 Sep 1997 00:45:58 -0700 (PDT)
From: Toby Reed

This is more of a pointer than a tip, but your readers might want to check out traplayer on sunsite, it lets you play realaudio without starting up an X server on your screen. Kinda useful if you don't like to use memory-hog browsers just to listen to realaudio.

The file is available at sunsite.unc.edu/pub/Linux in the Incoming directory (until it gets moved), and then who knows where. It's called traplayer-0.5.tar.gz.

Connecting to dynamic IP via ethernet

Date: Fri, 12 Sep 1997 13:22:06 +0200
From: August Hoerandl

in LG 21 Denny wrote:

"Hello. I want to connect my Linux box to our ethernet ring here at my company. The problem is that they(we) use dynamic IP adresses, and I don't know how to get an address."

There is a program called bootpc (a bootp client for linux). From the LSM entry (maybe there is a newer version now):

Title:          Linux Bootp Client
Version:        V0.50
Entered-date:   1996-Apr-16
Description:    This is a boot protocol client used to grab the machines
                ip number, set up DNS nameservers and other useful information.
Keywords:       bootp bootpc net util
Author:         ceh@eng.cam.ac.uk (Charles Hawkins)
Maintained-by:  J.S.Peatfield@damtp.cam.ac.uk (Jon Peatfield)
Primary-site:   ftp.damtp.cam.ac.uk:/pub/linux/bootpc/bootpc.v050.tgz
Platform:       You need a BOOTP server too.
Copying-policy: This code is provided as-is, with no warrenty, share and

The package inludes a shell script to set up the ethernet card, send the bootp request, receive the answer and set up everything needed.

I hope this helps


Running commands from X w/out XTerm

Date: Fri, 26 Sep 1997 18:28:51 -0600
From: "Kenneth R. Kinder"

I often found myself running XTerm just to type a single shell commmand. After a while, you just wish you could run a single command without even accessing a menu. To solve this problem, I wrote exec. As the program name would emply, the exec program mearly prompts (in X11) for a command, and replaces its own process with the shell-orriented command you type in. Exec can also browse files, and insert the path in the text box, incase you need a file in your command line. Pretty simple huh? Exec (of course!) is GPL, and can be downloaded at http://www.KenAndTed.com/software/exec/ -- I would appreciate it if someone would modify my source to do more! =)

Ascii problems with FTP

Date: Wed, 24 Sep 1997 12:42:05 -0400
From: Carl Hohman

Andrew, I read your letter to the Linux Gazzette in issue 19. I don't know if you have an answer yet, but here's my 2 bits...
If I understand correctly, you are using FTP under DOS to obtain Linux scripts. Now, as you may know, the line terminators in text files are different between Unix systems and DOS (and Apples, for that matter). I suspect that what's happening is this: FTP is smart enough to know about terminator differences between systems involved in an ascii mode transfer and performs appropriate conversions silently and on the fly. This give you extra ^M's on each line if you download the file in DOS and then simply copy it (or use an NFS mount) to see it from Unix. I suspect that if you use a binary tranfer (FTP> image) the file will arrive intact for Linux use if it originates on a Unix server.

Hope this helps.
Carl Hohman

Red Hat Questions

Date: Thu, 18 Sep 1997 14:06:08 -0700
From: James Gilb

Signal 11 crashes are often caused by hardware problems. Check out the The Sig11 FAQ on: http://www.bitwizard.nl/sig11/

James Gilb

Published in Linux Gazette Issue 22, October 1997


This page maintained by the Editor of Linux Gazette,
Copyright © 1997 Specialized Systems Consultants, Inc.