More 2 Cent Tips & Tricks LG #32

Date: Wed, 5 Aug 1998 17:34:50 +0100 (BST)
From: Sean Kelly, S.Kelly@newcastle.ac.uk

In issue 31 it was mentioned that someone had been looking for some shell scripting help.

Take a look at http://www.oase-shareware.org/shell/ as I have heard many people mention this site in response to shell scripting queries.

Sean.

lil2cent-4620440 Re: Recognising the AMD K5-PR166

Date: Wed, 05 Aug 1998 11:22:43 -0400
From: Shane Kerr, kerr@wizard.net

I’m wondering whether any other readers have used the AMD K5-PR166 with Linux. It’s just that my system seems to think it’s a K5-PR133 and states that it’s running at 100MHz. Also, the BogoMips value indicates that the processor is running at 100MHz. Anyone any advice?

I’m running a K5 P133+ on one of my systems – it actually is running at 100 MHz, that’s why it’s a « P133+ ». It’s like the Cyrix processors, the name is basically a lie for marketing.

I wouldn’t put too much stock in the BogoMips value – it is bogus after all! My system clocks in at an equivalent to a 112 MHz system when I run the distributed.net client – the reason AMD claims a higher clock value is probably because some instructions run faster, and those may just not happen to be the instructions used in the BogoMips loop.

As for your system thinking your K5-PR166 is a K5-PR133, it’s probably because you have the motherboard jumpered wrong and/or the BIOS configured wrong. Are you sure your motherboard & BIOS support the chip?

Shani

lil2cent-4620440 Your atapi CDROM

Date: Thu, 06 Aug 1998 16:50:04 -0500
From: Ian and Iris, brooke@mail.jump.net

Your /dev directory is the culprit. Current installs use:

 
/dev/hda
/dev/hdb
/dev/hdc
/dev/hdd
(/dev/hde)
(/dev/hdf)

for the first, second, (and third) ide interfaces, m,s,m,s(,m,s). Older installs had the /dev directory written a little differently. You would have the old standard, which was

 
/dev/hdnx

where n was interface, and x was a/b for master/slave.

The only difference is in the names of the files. If you rename them, you will be in compliance. Alternatively, you could run makedev from a recent kernel, though I do not pretend to know all the details of that.

lil2cent-4620440 Tips: simulataneous kernel versions

Date: Fri, 14 Aug 1998 17:35:14 +0200
From: Frodo Looijaard, frodol@dds.nl

From: Renato Weiner, reweiner@yahoo.com
Recently I was looking at the Gazette and I think I have a good suggestion of an article that will be very useful for the Linux community. I have had some technical difficulties of having two simultaneous versions of Kernels in my system. I mean a stable one and a developing one. I searched the net looking for information of how to co-exist both but it’s completely fragmented. If somebody more experienced could put all this information together, it will certainly help a lot of people from kernels developers to end-users.

This may come a bit late, but I am in the process of writing a (mini)HOWTO on this subject. It is not quite trivial, especially with modules lying around, or if you want several kernels with the same version number.

READ  The Standard C Library for Linux Issue 31

Check out http://huizen.dds.nl/~frodol/howto.html for now. I am still in the process of getting it approved as an official mini-HOWTO.

Frodo

lil2cent-4620440 Creating man pages made easy!!!

Date: Sun, 16 Aug 1998 16:14:34 +1000
From: Steven K.H. Siew, ksiew@tig.com.au

Below is something I wrote to help laypeople create their own man pages easily.

—————————————————————————- —-

If you ever wrote a program using gcc in Linux, you may have come across this problem. You have just finished your wonderful little program which is of great use to you and you need a man page for it.

Of course, you have absolutely no idea how to write a man page. Don’t you need to know how to use troff? Or is it nroff to write a man page? Luckily, there is a much easier way to write a man page.

Here I shall describe an easy and quick (and dirty) way of writing a man page without learning troff or nroff. In order to do so, you must have the Perl version 5.004 (or higher) installed on your Linux box.

There is a man page in the various Perl man pages on the creation of a man page using the Perl util « pod2man ». It is called « perlpod.1 ». Below is a step by step guide to finding the man page and the util.

 
ksiew> su
password: 

#|/root>locate perlpod.1
/usr/man/man1/perlpod.1

#|/root>locate pod2man
/usr/bin/pod2man

Now, to write your own man pages, you must first read the perlpod.1 man page. You can do this by « man perlpod ». However, to read the pod2man man page, you must first create it by using pod2man itself.

 
#|/root>pod2man /usr/bin/pod2man > pod2man.1
#|/root>ls -al pod2man.1
-rw-r--r--   1 root     root        13444 Aug 16 12:12 pod2man.1
#|/root>mv pod2man.1 /usr/man/man1/pod2man.1

Okay, now you can read the pod2man man page you have just created by using the command « man pod2man ». After reading it, you can now create your own man pages. As an example, I shall describe a simple man page for one of my own C programs called « addline ». I first create a textfile called « addline.pod » and then turn it into a manpage using ‘pod2man –center= »Addline program manpage » addline.pod > addline.1’.

READ  ht://Dig: Sites that Use ht://Dig

Finally, I move the addline man page into its proper place using « mv addline.1 /usr/man/man1/addline.1 ». There; creating your own man page is simple, isn’t it?

Below is a sample addline.pod file

 =head1 NAME addline - addline numbers to textfiles =head1 SYNOPSIS B
[ B ]
[ B ]
[ B ]
[ B ]
I =head1 DESCRIPTION B inserts line numbers into textfiles. It was written to automate
the insertion of numbers into a data file of results from a neural network
program. =head1 OPTIONS =over 8 =item -c Ignores comments lines. A comment line is any line that starts with a '#'.
This makes it easier to insert comments in the textfile without messing up
the line numbers. =item -v Displays the version number of the addline. =item -3 Uses 3 digits for the line numbers even if the number requires less than 3
digits. For example, 013 instead of 13. The default is to use as few digits for the line number as possible. =item --colon Separates the line number from the rest of the line with a ':' character. =back =head1 EXAMPLES addline textfile addline -c textfile addline -c --colon textfile =head1 NOTES Addline is written in C and compiled using gcc version 2.7.8. It uses the
standard C library and is designed to be fast and efficient. =head1 RESTRICTIONS Never ever use addline on a binary file. =head1 BUGS There are no bugs in addline, there are just some undocumented features. =head1 AUTHORS Original prototype by Steven Siew, but so massively hacked over by
his sister such that Steven Siew probably doesn't recognize it anymore.

lil2cent-4620440 2c Tip Re: Cross-platform Text Conversions

Date: Sun, 16 Aug 1998 07:52:17 -0500 (CDT)
From: Peter Samuelson, psamuels@sampo.creighton.edu

In LG31 you published a 2c tip for a unix2dos replacement written in Tcl. The author asserts that « It turned out to be really easy to do this in Tcl. » Even easier in Perl, I say. Symlink the following code to the same names (d2u, u2d, m2d, m2u, u2m, d2m) Matt used. Make sure this file has execute permission, of course.

Also, if you just want Perl to edit the input files in place, change the « perl -wp » to something like « perl -wpi.orig »….

Peter Samuelson

 
#!/usr/bin/perl -wp
#
# Simpler unix2dos2mac utility for 2-cent tip, mainly because Tcl is ugly.
# No comments that Perl is ugly too, please.
#
# Usage: a standard Unix filter:
#   input:  filename(s) or stdin
#   output: stdout
# Buglet: u2m leaves lone CR at the end of file if it didn't end in LF
#   (Fixing it would use more memory.)

BEGIN {
  $_=$0 =~ s|.*/||;
  $pcmd='s/$/\r/'       if ($0 eq 'u2d');
  $pcmd='s/\r$//'       if ($0 eq 'd2u');
  $pcmd='s/$/\r/;chop'  if ($0 eq 'u2m');
  $pcmd='s/\r/\n/g'     if ($0 eq 'm2u');
  $pcmd='chomp'         if ($0 eq 'd2m');
  $pcmd='s/\r/\r\n/g'   if ($0 eq 'm2d');
  unless($pcmd) {
    print STDERR "This script must be invoked under one of the names:\n",
                 "  u2d, d2u, u2m, m2u, d2m, m2d\n";
    exit 1;
  }
}

eval $pcmd;

lil2cent-4620440 Un-tar as you download

Date: Wed, 19 Aug 1998 13:08:52 -0500
From: scgmille@indiana.edu

READ  Linux Gazette Table of Contents Issue 17

It’s time for fun with pipes. Recently, when downloading the latest kernel over a ridiculously slow connection, I wanted to see where the download was by checking which file in the tarball was being received. After pondering the pipes and GNU utils, this thought came to mind.

You can decompress and un-tar your files as they download, sort of a « streaming decompressor », if you will. From the command line:

 
tail -f --bytes=1m file-being-downloaded.tar.gz | tar -zxv

Tail will display downloaded portion of the file, then remain open displaying bytes as they come. Make sure the 1m (1 megabyte in this case) is LARGER than what you have already downloaded. The piped output of tail goes to tar and the rest is history. Similarly, for bz2 files:

 
tail -f --bytes=1m file.tar.bz2 | bunzip2 - | tar -xv

Enjoy!

lil2cent-4620440 megaraid drivers

Date: Thu, 20 Aug 1998 18:34:32 -0400
From: « Michael Burns2, rburns@shaw.wave.ca

Hi,
It’s been a long fight to get AMI to produce this patch and the install documentation.

Mike Burns

lil2cent-4620440 Re: Suggestion for Article, simultaneous versions of Kernels

Date: Sat, 29 Aug 1998 21:35:27 -0400 (EDT)
From: R Garth Wood rgwood@itactics.itactics.com

I think Hans-Georg is talking about having a stable Linux kernel version X and a dev version X (i.e., not 2.0.34 and 2.1.101 but 2.0.34 and 2.0.34). I assume when you issue: # make modules_install it tromples your old stable modules and gives you errors when you use your stable version X. This is not as trivial a problem as it first seems. However, there is a solution. Have a look at the make-kpkg docs (Debian distro); specifically the « flavour » option. This will solve your problem. It won’t be easy, though.

Have a look at: /etc/conf.modules

to see what I mean.

R Garth Wood

Published in Linux Gazette Issue 32, September 1998

indexnew-2074713 homenew-6499281 back2-6474208 fwd-4759866

This page maintained by the Editor of Linux Gazette, gazette@ssc.com
Copyright © 1998 Specialized Systems Consultants, Inc.