Linux-Misc Digest #943, Volume #23               Fri, 24 Mar 00 16:13:03 EST

Contents:
  Re: Name service fails for dial up users (Kerry Cox)
  Re: Linux kernel module on C++ (David A. Mair)
  Re: vim syntax highlighting (Robie Basak)
  hot to make a bootable cdrom? (Cevat Ustun)
  Re: html files ==> plane text stdout (Aleksey)
  Re: Windows 2000 has 63,000 bugs - Win2k.html [0/1] - Win2k.html [0/1] (Craig Kelley)
  Re: Question: writing or getting hold of a dial-up script ("Peter T. Breuer")
  Re: LAN transfer speed (Pjtg0707)
  What is the best/most popular Linux distr. to use? ("Big Joe")
  how to config resolution  (Jinning He)
  Re: Name service fails for dial up users ("Peter T. Breuer")
  Problem:  Dell Dimension T700, Maxtor 54098U8 (40G HD) (Edward L. Hepler)
  data corruption through nfs ("Watcher")

----------------------------------------------------------------------------

From: Kerry Cox <[EMAIL PROTECTED]>
Subject: Re: Name service fails for dial up users
Date: Fri, 24 Mar 2000 12:10:01 -0700


==============702075821F69C34ABC11D934
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Never mind.  It turned out to be either the /etc/hosts file had the
localhost listed second and not first or that the secondary DNS was not
listed in the /etc/ppp/options.srv file.  Either way I got it to work.
KJ


Kerry Cox wrote:

>     I did something stupid the other day and can't figure out what it
> was. Maybe someone can help me. I have a Linux server running RedHat
> 6.1 with the latest patches. I use it here at work as my desktop
> machine.
> Attached to it is an external US Robotics 33.6 modem. From home I can
> dial up into this box and have internet connectivity, albeit slow
> versus what I have here at work. It works great using my Linux box at
> home
> and my
> wife and kids can use it also for their Windows machines.
>     However, I deleted some entry on my machine here at work in
> regards to a "named" user or something similar.  Why I did this, I
> don't know.  I thought it unimportant at the time.  But now when I
> connect to my
> Linux box here at work whether using my Linux box or Windows machine
> at home, I cannot look up any pages on the Internet.  Name service
> fails.  I can look at a page if I type in its IP address.  But that is
>
> painfully slow.  Yet, when I telnet into my box here at work (I can
> only do so by using its IP address) name service works great.  I can
> go to any page using the *.com address at work but not at home.
>     I reinstalled the very latest BIND rpm as well as the
> caching-nameserver rpm.  What am I missing?  Any help would be
> appreciated.  Additional information can be provided.
>     Thanks.
> KJ
>
> --
> .-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-.
> | Kerry J. Cox         KSL                              |
> | [EMAIL PROTECTED]    System Administrator             |
> | (801) 575-7771       http://www.ksl.com               |
> | ICQ# 37681165        http://quasi.ksl.com/linux/      |
> `-------------------------------------------------------'
>
>

--
.-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-.
| Kerry J. Cox         KSL                              |
| [EMAIL PROTECTED]    System Administrator             |
| (801) 575-7771       http://www.ksl.com               |
| ICQ# 37681165        http://quasi.ksl.com/linux/      |
`-------------------------------------------------------'



==============702075821F69C34ABC11D934
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Never mind.&nbsp; It turned out to be either the /etc/hosts file had the
localhost listed second and not first or that the secondary DNS was not
listed in the /etc/ppp/options.srv file.&nbsp; Either way I got it to work.
<br>KJ
<br>&nbsp;
<p>Kerry Cox wrote:
<blockquote TYPE=CITE>&nbsp;&nbsp;&nbsp; I did something stupid the other
day and can't figure out what it was. Maybe someone can help me. I have
a Linux server running RedHat 6.1 with the latest patches. I use it here
at work as my desktop
<br>machine.
<br>Attached to it is an external US Robotics 33.6 modem. From home I can
dial up into this box and have internet connectivity, albeit slow versus
what I have here at work. It works great using my Linux box at home
<br>and my
<br>wife and kids can use it also for their Windows machines.
<br>&nbsp;&nbsp;&nbsp; However, I deleted some entry on my machine here
at work in regards to a "named" user or something similar.&nbsp; Why I
did this, I don't know.&nbsp; I thought it unimportant at the time.&nbsp;
But now when I connect to my
<br>Linux box here at work whether using my Linux box or Windows machine
at home, I cannot look up any pages on the Internet.&nbsp; Name service
fails.&nbsp; I can look at a page if I type in its IP address.&nbsp; But
that is
<br>painfully slow.&nbsp; Yet, when I telnet into my box here at work (I
can only do so by using its IP address) name service works great.&nbsp;
I can go to any page using the *.com address at work but not at home.
<br>&nbsp;&nbsp;&nbsp; I reinstalled the very latest BIND rpm as well as
the caching-nameserver rpm.&nbsp; What am I missing?&nbsp; Any help would
be appreciated.&nbsp; Additional information can be provided.
<br>&nbsp;&nbsp;&nbsp; Thanks.
<br>KJ
<pre>--&nbsp;
.-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-.
| Kerry J. Cox&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|KSL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
| |
| [EMAIL PROTECTED]&nbsp;&nbsp;&nbsp; System 
|Administrator&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
||
| (801) 575-7771&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a 
|href="http://www.ksl.com">http://www.ksl.com</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
| |
| ICQ# 37681165&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a 
|href="http://quasi.ksl.com/linux/">http://quasi.ksl.com/linux/</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
| |
`-------------------------------------------------------'</pre>
&nbsp;</blockquote>

<pre>--&nbsp;
.-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-.
| Kerry J. Cox&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|KSL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
| |
| [EMAIL PROTECTED]&nbsp;&nbsp;&nbsp; System 
|Administrator&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
||
| (801) 575-7771&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A 
|HREF="http://www.ksl.com">http://www.ksl.com</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
| |
| ICQ# 37681165&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A 
|HREF="http://quasi.ksl.com/linux/">http://quasi.ksl.com/linux/</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
| |
`-------------------------------------------------------'</pre>
&nbsp;</html>

==============702075821F69C34ABC11D934==


------------------------------

From: David A. Mair <[EMAIL PROTECTED]>
Subject: Re: Linux kernel module on C++
Date: Fri, 24 Mar 2000 12:09:00 -0700

On Fri, 17 Mar 2000 16:02:21 +0200, "Vadim Makhervaks"
<[EMAIL PROTECTED]> wrote:

>Hi,
>
>    Can the linux kernel module be written on C++? I think that it should be
>possible. What compilation and linkage options shall I use to build this
>module?

It's a guess, but I imagine the init and shutdown routines would need
extern "C" linkage and as long as all header files for calls outside
the scope of your own module had extern "C" linkage implied then you
should be able to compile C++ code for everything else.

Regards,
David.

======================================================
In order to avoid the harassment of spam I have 
deliberately included an invalid e-mail address in 
this message.  To contact me by mail remove the not. 
after the @ symbol in the enclosed e-mail address. You 
should note that due to the quantity of mail I receive 
I may not answer and I am more likely to respond to 
follow-up messages.
======================================================

------------------------------

From: [EMAIL PROTECTED] (Robie Basak)
Subject: Re: vim syntax highlighting
Reply-To: [EMAIL PROTECTED]
Date: 25 Mar 2000 03:20:14 GMT

On 24 Mar 2000 11:02:04 -0000, Stuart McLaren said:
>Hi,
>
>I'm having trouble getting Vim syntax highlighting to work.
>
>I've set $VIMRUNTIME to point to the directory in my
>account which contains:
>syntax.vim,synload.vim and tex.vim 
>
>(I'm trying to get highlighting working for latex).
>
>I get no error messages when I type `:syntax on' (ie gvim is finding
>the files) but I get no highlighting either!
>
>Any ideas?
>
>Thanks,
>
>-Stuart

Try running from a virtual console (if you're not already) and making
sure that $TERM is set to linux. vim may not know how to display
colour.

Robie.

-- 

------------------------------

From: Cevat Ustun <[EMAIL PROTECTED]>
Subject: hot to make a bootable cdrom?
Date: Fri, 24 Mar 2000 19:15:39 GMT

How can I write the necessary files to an ext2 image file
so as to make it bootable when I burn it to a cd?

Thanks,

Cev.


------------------------------

From: Aleksey <[EMAIL PROTECTED]>
Subject: Re: html files ==> plane text stdout
Date: Fri, 24 Mar 2000 19:10:42 GMT

In article <8bgcfl$8pi$[EMAIL PROTECTED]>,
Andreas Kahari <[EMAIL PROTECTED]> wrote:
> In article <8bgc87$8gf$[EMAIL PROTECTED]>,
> Aleksey <[EMAIL PROTECTED]> wrote:
> > What program can convert a lot of html files to plane text
> > and put it to stdout.
> >
> > "lynx -dump" do this very good, but with one file only.
> > Shell script will not be very efficient. Am I right?
> >
> > I have to convert several Gb of HTMLs.
> >
>
> Write a simple loop over that lynx hack. Do it in a shell script. If
you
> want to use lynx, that's probably the most effective way to do it.

It is not efficient to start lynx for every html file, because
I have too many ones and they are often small.

I've write the script

#######################################
tempfile=`mktemp /tmp/proc_html.XXXXXX`
rm -f "$tempfile"
mkfifo "$tempfile"

cat $@ > "$tempfile" &

lynx -dump -force_html "$tempfile"

rm -f "$tempfile"
#######################################

It works fine, but lynx demand a lot of RAM. Perhaps it loads all
files.

Do I really have to edit lynx's sources????


Sent via Deja.com http://www.deja.com/
Before you buy.

------------------------------

Crossposted-To: comp.os.linux.advocacy
Subject: Re: Windows 2000 has 63,000 bugs - Win2k.html [0/1] - Win2k.html [0/1]
From: Craig Kelley <[EMAIL PROTECTED]>
Date: 24 Mar 2000 12:18:57 -0700

grant@nowhere. (Grant Edwards) writes:

> In article <[EMAIL PROTECTED]>, JEDIDIAH wrote:
> 
> >>PowerPoint
> >
> >     PowerPoint is better tossed in the trash.
> >     (Yes I've seen 1 too many 'canned' powerpoint presentations.)
> 
> What's worse is the thousands of man-hours wasted by the
> creators of those presentation whiel they futz with
> backgrounds, fonts, animation and other non-value-added crap.
> I've heard of companies that have outlawed the use of
> powerpoint.

I don't doubt it.

People don't know how to get up in front of an audience to communicate 
a message anymore.  They get up, futz around with the laptop, install 
new software, try to get the remote mouse working.  And all for what: 
To *read* their slides to the audience who is already dozing off.

This has to be a prime example of what television does to the human
mind.  They'd rather read projected light images to an audience that
is perfectly capable of reading them already, than to actually convey a 
real message.

Not to mention the HUGE ammounts of disk space these people waste.  I
recently had to badger a grad student because he had filled out his
presentation with scanned TIFF files!

-- 
The wheel is turning but the hamster is dead.
Craig Kelley  -- [EMAIL PROTECTED]
http://www.isu.edu/~kellcrai finger [EMAIL PROTECTED] for PGP block

------------------------------

From: "Peter T. Breuer" <[EMAIL PROTECTED]>
Subject: Re: Question: writing or getting hold of a dial-up script
Date: 24 Mar 2000 19:22:10 GMT

George Bell <[EMAIL PROTECTED]> wrote:
: I would like to have a script that can be executed from the bash shell,
: which can use the wvdialer to dial in, execute sendmail -q and

�nd what's wrong with:

      wvdial home &
      sleep 60
      rsh home.me.org sendmail -q
      rsh home.me.org fetchmail
      sleep 60
      rsh home.me.org killall sendmail fetcmail
      killall pppd

(suitably varied).

Peter

------------------------------

From: [EMAIL PROTECTED] (Pjtg0707)
Crossposted-To: comp.os.linux.hardware,comp.os.linux.networking,comp.os.linux.setup
Subject: Re: LAN transfer speed
Reply-To: [EMAIL PROTECTED]
Date: Fri, 24 Mar 2000 19:45:57 GMT

On Fri, 24 Mar 2000 18:29:03 GMT, Bill Pitz <[EMAIL PROTECTED]> wrote:
>In comp.os.linux.networking Frenzy Killa <[EMAIL PROTECTED]> wrote:
>> I'm quite a Linux newbie, but I do know these rates are way below average
>> for systems with this sort of hardware. Someone please help me with this.
>> It'd be a real pity having a Linux server without being able to use its full
>> potential. I'd really appriciate any help I can get.
>
>The TCP stack (particularly in Win9x..not sure how bad it is in W2k) is not
>capable of transferring at the maximum rated speed of your network.
>You also will lose performance because of encapsulation and network
>overhead.
>
>Linux to Linux transfers will be faster than Linux to Windows or (god forbid)
>Windows to Windows trasnfers.
>
>-Bill

Do you have data to show Win9? stack is less than capable?
Do you have data on any of the Linux variants that they are superior?


------------------------------

From: "Big Joe" <[EMAIL PROTECTED]>
Subject: What is the best/most popular Linux distr. to use?
Date: Fri, 24 Mar 2000 14:26:26 -0500

What's the best/most popular Linux distr. to use?  Is there one that's
better than the other, or runs more apps than others?  Or does it matter at
all?  Which company keeps their Linux distr. most up to date?

Which Linux distr. is better for a novice user and which is better for
experience user?  Or is there a difference?  For example, if you were going
to recommend one to a novice which would you recommend as opposed to if you
were going to recommend one to an experienced user?

If developing an application for Linux, which Linux distr. would you target
(i.e. make sure it ran and installed ok on)?

Anyone have any comments or opinions on which one, if any is better?




------------------------------

Crossposted-To: comp.os.linux.setup
From: Jinning He <[EMAIL PROTECTED]>
Subject: how to config resolution 
Date: Fri, 24 Mar 2000 14:11:18 -0600


I just installed RH6.1 on my desktop (coexist with winNT).
Now the problem is that every window and icon in my screen is so big. I
believe it's because of the resolution. I would like to know how
to configure my resolution to make those windows and icons look
confortable. It's very easy in windoze but seems not that easy in linux.
I couldn't find any graphical tool. I customized my monitor in the
installation and choose 1024*768 @80 HZ. And now a single terminal almost
occupies all the screen. 

thanks

 -- Jinning


------------------------------

From: "Peter T. Breuer" <[EMAIL PROTECTED]>
Subject: Re: Name service fails for dial up users
Date: 24 Mar 2000 20:00:38 GMT

Kerry Cox <[EMAIL PROTECTED]> wrote:
: Never mind.  It turned out to be either the /etc/hosts file had the
: localhost listed second and not first or that the secondary DNS was not
: listed in the /etc/ppp/options.srv file.  Either way I got it to work.

It's the second. Order (of lines!) does not matter in /etc/hosts. Yes, order
WITHIN the line matters. The FQDN should be second, after the IP address.

Peter

------------------------------

From: [EMAIL PROTECTED] (Edward L. Hepler)
Crossposted-To: comp.os.linux.hardware
Subject: Problem:  Dell Dimension T700, Maxtor 54098U8 (40G HD)
Date: 24 Mar 2000 14:51:02 -0500


I just purchased a Dell Dimension T desktop and have a strange problem
with the the disk... 

I purchased the machine with the ATA66 controller and soon found that 
Red Hat 6.1 did not support this yet....  So I moved the disk cable from
the Promise Ultra66 controller to the primary IDE controller on the 
motherboard...   The disk is a Maxtor 54098U8 (40Gbyte)...
So now the HD is running from the onboard IDE controller...

I loaded RH6.1 onto the drive, partitioning it with /, /boot, swap, and
/home partitions.  The /home partition was specified as one huge partition
having a requested size of 1Mbyte, but was to expand to the end of the
disk)...  It ended up being about 34 Gbytes.  (This is because earlier,
I had unsucessfyly tried to make more, smaller partitions and the
RH installer couldn't seem to find the last couple!)  Druid assigned 
/home to hda6.

After loading, I booted and started to configure other things, then noticed
that the system didn't seem to be operating properly...  I did a shutdown,
and reboot...

The system came up but reported multiple errors on /dev/hda6 (the BIG /home
partition)...   Thinking that perhaps I had forgotten to tell the RH installer
to format /home, I did a "mkfs" on /dev/hda6...  Then I rebooted...

The system booted...  I made a few changes... Then decided to reboot to see
that everything was OK...   When the system came up again, /dev/hda6 was
reported as having errors again...  The boot dropped into root mode so that
I could manually run fsck...  I instructed fsck to fix all the problems that
it reported...  Then ran fsck a second time...  It reported a clean /dev/hda6.

The machine rebooted after exiting root mode...  I verified that I could
get into X-windows, etc., then asked for a shutdown -r...  The system rebooted,
again reporting a corrupted /dev/hda6...

Runing fsck cleans things up again, but takes longer (more problems)... and
my empty home directory and even [lost+found] are now gone!

I have tried removing the ATA66 card, thinking that perhaps it is somehow
interfering with the onboard transfers (how I don't know, but I grasping
for straws...)...   

I also looked at the setup screen and it seems to be correctly recognizing
the drive, etc. although the geometry of the drive is not correct... 
I did not see a way to change the geometry in the BIOS...
Does RH6.1 rely on the geometry as reported by the BIOS?

I also thought that perhaps there was some sort of size limit on the 
paritions that I was violating... I went back to the RH installer and
it couldn't find the hard drive (I believe it couldn't find the partition
table)...   sfdisk got a read error trying to read sector
71633835, but reported a parition table that looks sort of reasonable,
although it also reports the wrong number of cylinders, and heads.
fdisk seems to think that the disk has 4982 cylinders, although it also
says that it can not read /dev/hda...  The info on the Maxtor page of
Dell's web site says that it has 79,406 cylinders, 8 heads, 63 sectors per
track, 512 bytes/sector...

I repartitioned the disk using cfdisk, applying the correct geometry, etc.
and telling it to start with a new partition table (-z option)
I tried 4 primary partitions, reloaded RH6.1, and got the same result...

I called Dell Service, who instructed me on how to run the Dell Disk
Diagnostics...  They ran for about 10 hours and found no problem...
The disk appears to be working correctly...

I also used a utility that wipes out the contents of the disk and
started with a clean drive...   same problem...  Linux installs, but
things get corrupted...

Does anyone else out there have the same configuration that is running
who can tell me what they have done to allow RH6.1 to run?
Are there other BIOS settings that need to be modified?

Any assistance or ideas would be greatly appreciated!

Thanks,

Ed Hepler

[EMAIL PROTECTED]
or
[EMAIL PROTECTED]


------------------------------

From: "Watcher" <[EMAIL PROTECTED]>
Crossposted-To: linux.redhat
Subject: data corruption through nfs
Date: Fri, 24 Mar 2000 20:20:04 GMT

(test programs are attached at the end)

We are experiencing strange data corruption problems using RH6.1 nfs client and
Solaris nfs server (SunOS 5.6). Later it is also found that same problem happened
on RH6.1 nfs server too, with much less frequency. This is likely to be a nfs
problem (not clear client or server) because it won't happen if running on
local disks. We hope we can get help by distributing the problem.

The symptom is as this:
If do the following procedure:
1. A data block is first written to file
2. Then write a large amount of data following the block
3. Use fseek to seek back to the data block and update with new values,

at the 3rd step, sometimes the data block is failed to be updated.

The interesting thing is that if we use fopen(<name>,"w+") instead of
using "w", there are much less failures (almost none on Soloaris, but
some on RH6.1 nfs server). We don't know why.

Things to note:
. all file handling is using fstream with fopen, fseek, ftell, fwrite. No
  error messages are reported when data corrupted
. fflush() doesn't help at all.
. the problem seems to be non-deterministic, meaning it doesn't happen
  all the time and it doesn't necessarily happen at the same place. This
  also makes debugging difficult.
. the problem won't happen when writing to local disk

Any response for solutions or same experiences would be appreciated. Please
make sure you also send your answer to my email address. Thanks in advance.

Daben

PS
The following are two programs that demonstrate the problem. testw.c
will do the above procedure 100 times. The data block is a integer initialized
to zero and updated to non-zero. testr.c will check the output file
and exit if it finds that the data block remains zero. An example output of
running testr program:

*** READ TOC hoff = 16808
*** READ TOC hoff = 24700
*** READ TOC hoff = 40366
*** READ TOC hoff = 56339
*** READ TOC hoff = 74576
*** READ TOC hoff = 0
wrong = 1

which says the testw.c program fails at the 6th iteration.

--- test programs ------

/********************************************/
/*  testw.c   write data                    */
/********************************************/
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
  int i,j;
  int dim;                  /* random number of data in the buffer */
  char *data;               /* buffer */
  FILE *fp = fopen("test.dat","w");
  long start;
  int hoff;                 /* the data block to be updated */

  data = (char *)calloc(20003, sizeof(char));

  for (i=0;i<100;i++) {
    /* initial hoff and write to file*/
    hoff = 0;
    if (fseek(fp, 0L, 2) == -1)         /* seek to the end */
      fprintf(stderr, "fseek cannot get to the end\n");
    if ((start = ftell(fp)) == -1)      /* remember the location */
      fprintf(stderr, "ftell failed\n");
    if ((fwrite(&hoff, sizeof(int), 1, fp)) != 1)  /* write the first time */
      fprintf(stderr, "fwrite failed\n");

    /* write data, random pick data size, bug triggered with big size */
    dim = 1+(int) (20000.0*rand()/(RAND_MAX+1.0));
    for (j=0;j<dim;j++) data[j] = 'D';
    if ((fwrite((void *)data, sizeof(char), dim, fp)) != dim)
      fprintf(stderr, "fwrite data failed\n");
    fflush(fp);

    /* change hoff, let it register the current FILE pointer location */
    if ((hoff = ftell(fp)) == -1)
      fprintf(stderr, "ftell failed\n");

    /* re-write hoff at the beginning, buggy part */
    if(fseek(fp,start,0) == -1)
      fprintf(stderr, "fseek back to the beginning failed\n");
    if((fwrite(&hoff, sizeof(int), 1, fp)) != 1)
      fprintf(stderr, "fwrite rewriting failed\n");;

  }

  fclose(fp);
  free(data);
  return 0;
}

======= the following is the read program to validate the output file ======
/*************************************************************/
/*  testr.c : read file test.dat                             */
/*************************************************************/
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
  FILE *fp;
  int hoff;
  int i;
  int wrong = 0;

  fp = fopen("test.dat","r");

  for (i=0;i<100;i++) {
    fread(&hoff, sizeof(char), sizeof(int), fp);
    printf("*** READ TOC hoff = %ld \n",hoff);
    if (hoff == 0) {
      wrong ++;
      break;
    }
    fseek(fp,hoff,0);
  }

  fclose(fp);

  printf("wrong = %d\n",wrong);
  return 0;
}

============================================================
BBN Technologies
70 Fawcett Street, Cambridge, MA 02138
Tel: (617)873-3636



------------------------------


** FOR YOUR REFERENCE **

The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:

    Internet: [EMAIL PROTECTED]

You can send mail to the entire list (and comp.os.linux.misc) via:

    Internet: [EMAIL PROTECTED]

Linux may be obtained via one of these FTP sites:
    ftp.funet.fi                                pub/Linux
    tsx-11.mit.edu                              pub/linux
    sunsite.unc.edu                             pub/Linux

End of Linux-Misc Digest
******************************

Reply via email to