[MPlayer-dev-eng] Not [PATCH] - entire file
Arpi
arpi at thot.banki.hu
Mon Dec 23 17:18:59 CET 2002
Hi,
> > if ( echo $line | cut -d ' ' -f 1 | grep '^#define' > /dev/null ); then
> 1^^^^^^^^^ 2^^^^^^^^^^^^^^ 3^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> 1. This is the real reason of stucking. It must be echo -E "$line",
> otherwise when $line contains e.g. "\n" sh->(pdksh|zsh) would execute
> this giving a new line.
>
> 2. we grep for '^...' string, which is first field anyway - redundant
> 3. is equal to grep -q
you're right. sorry i didn't know these...
(that help_diff.sh was my first shell script with such complexity)
> > curr=`echo $line | cut -d ' ' -f 2`
> 1^^^^^^^^^
>
> > if ( grep " $curr " $1 > /dev/null ); then
> > curr="x"
> > fi
>
> redundant
not really.
my version implements a state machine. 'copy state' is enabled when it find
a #define tag not present in the translated version, and it's disabled if it
finds the next one present. while in 'copy state' it copies every single line.
the major difference is that my version works with multi-line defines, while
your one generated uncompilable output. for example, remove
the MSGTR_SystemTooSlow entry from the translated helpfile and run your
script on that. it'll result for the hu file:
#define MSGTR_BuiltinCodecsConf "Using built-in default codecs.conf\n"
#define MSGTR_SystemTooSlow "\n\n"\
#define MSGTR_SMBInitError "Cannot init the libsmbclient library: %d\n"
...
as you see it's buggy.
> if [ -z "$line ] then
>
> In fact... it's redundant. See my script, which is a bit faster, for
> details. It works with bash, zsh, pdksh and ash, And please, try to
> avoid bashisms in the future.
i was happy even with the bash version :)
please try to fix your script to handle multiple lines, or fix my version to
be bash-independent.
A'rpi / Astral & ESP-team
--
Developer of MPlayer, the Movie Player for Linux - http://www.MPlayerHQ.hu
More information about the MPlayer-dev-eng
mailing list