mcedit bug

Pavel Roskin proski at gnu.org
Sat Dec 22 00:50:58 UTC 2001


Hi, Matthias!

> @       Do something on the current file
> 	CMD=%{Enter command}
> 	$CMD ./%0f
> ---
> 
> This only works well for commands without additional arguments. If there
> are arguments then only the command itself is assigned to CMD, but the
> arguments are passed on to the shell trying to execute them as if they
> would be commands. I think it better should look like this:

Could you please give an example?  I tried "ls -al" and it works as one 
would expect.

> It's really tiresome to create the patch files for more than one file by
> hand (maybe for a whole directory). I've offen have to do this, and I
> really missed a menu command doing it for me. I know, the above command
> is not the best solution. What do you think about it? I guess it could
> be usefull for others, too.

I don't think this functionality needs to be tied to MC.  I don't think 
there are many reasons for that process to be interactive.

It's getting offtopic, but you could try this script:

=======================================
#! /bin/sh
: ${backup_suffix="v0"}
backup_files=`find . -name "*.$backup_suffix" -type f | sort | uniq`
for oldfile in $backup_files; do
  newfile=`echo $oldfile | sed 's,^\./,,;s,\.'$backup_suffix'$,,'`
  oldlabel="$oldprefix$newfile"
  newlabel="$newprefix$newfile"
  find "$oldfile" ! -size 0 | grep . >/dev/null || \
    { oldfile="/dev/null"; oldlabel="/dev/null"; }
  find "$newfile" ! -size 0 | grep . >/dev/null || \
    { newfile="/dev/null"; newlabel="/dev/null"; }
  case $newfile in
    *.c) dflags="-u -p" ;;
    *ChangeLog*) dflags="-u1" ;;
    *) dflags="-u" ;;
  esac
  diff $dflags -L "$oldlabel" -L "$newlabel" "$oldfile" "$newfile"
done
=======================================

Just set backup_suffix to your preferred value.  You can also look at CVS 
Utilities: http://www.red-bean.com/cvsutils/

-- 
Regards,
Pavel Roskin




More information about the mc-devel mailing list