Re: -P fix

Hello, Oskar!

> My solution is to add another option -p that will allow you to
> specify a file that the last working directory is written to.

That's fine.

> A new function print_last_working_directory was created since
> this functionality is needed in two places in main.c.
> I also attempted to update the manual page.

But you didn't update the ouptut of "mc --help".  I know, it's wrong that
mc describes options in two different places.  It's a result of too many 
quick hacks in the sources.  But it must stop.

You see, you made an error because the existing code is duplicated.  We
cannot just ignore this error and go ahead.  Otherwise somebody else will
stumble on the same place.

Unfortunately, mc is not easy to work with.  Adding some functionality so
that it just works for the author is easy.  Cleaning up the underlying
code is hard.  Testing and fixing all found issues is very hard and not
always possible.

> Here's a new

Maybe an alias for bash and zsh, since we are breaking everything anyway.
I don't like exposing this function in the environment, since it
discourages developers from improving it (especially increasing it in

> mc ()
> {
> 	TMPFILE="`mktemp`"
> 	/usr/bin/mc -p "$TMPFILE" "$@"

We have a save temporary directory now, so using mktemp is probably not 
needed - mc itself can create files safely.

> 	cd "`cat $TMPFILE`"

I'd prefer to redirect stderr here, so that mc is releaved from the need
to create that file if mc exits early (think --help, --version).

> export -f mc

This is done better in CVS, but I hope to get rid of the function

> Note that it requires the mktemp command, which is available in
> Debian (debianutils 1.7 or later) and OpenBSD 2.1 or later.
> At least use the patch as an inspiration... :)

Oh, yes.  I think coding is going to be 10% of what needs to be done.  
Not to mention the hassle of adding new translatable strings at this
stage, after the prerelease.  But we really should get it right.

Pavel Roskin

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]