On 8/4/07, Mic J <[EMAIL PROTECTED]> wrote:
> On 8/4/07, Andris <[EMAIL PROTECTED]> wrote:
> > Hi, I'm writing a set of small utilities as scripts, and I got a
> > segmentation fault working on one of them.
> >
> > The script is suppoused to align text with spaces. Say you have this
file:
> >
> > Foo1\tFoo2
> > Baaaaaaaaaaaar\tBar2
> > Baz
> >
> > Where \t are horizontal tabs. My script would replace the tabs with an
> > adequate number of spaces to align foo2 and bar2.
> >
> > Right now it works with a file named "file" in the working directory.
> > Of course this is only temporal.
> >
> > The problem is that I get a segmentation fault when I run it. That
> > never happened to me with a shell script. And I can't see where should
> > be a problem.
> >
> > I'm running OpenBSD 4.1-stable, GENERIC, i386. I don't know if it's
> > important, but I didn't create a swap partition (I'm planning to
> > change this).
> >
> > If someone could light me, I'd be very grateful.
>
> It doesnt segfault on my system i386 4.1
> however nothing happens with the file.
> (i hope to avoid reading the code with more than half an eye ...)
>
>
> and would it be very hard to change line number 4 (i think)
> <file=file
> to
> >file=$1
> ? ;)
>
> michael
>

The file should not be changed, it should only be converted to stdout.
Plus, the script does not have to "work", since I'm still working on
it. At least, I was; I don't want my system to freeze again (like it
did once I run it). But it shouldn't not seg fault.

And yes, I'll change that line :P

Thanks for trying!

Reply via email to