[MPlayer-dev-eng] Not [PATCH] - entire file

GoTaR gotar at poczta.onet.pl
Mon Dec 23 17:03:00 CET 2002


Hi!

./configure --language=sth stucks on help/help_diff.sh if

> #! /bin/sh

is symlink to either pdksh or zsh. I couldn't find out the reason, so I
wrote sh-compliant (not bash-compliant) script from scratch. I attached
it with pasted original comment. Patching original file is groundless,
but here comes explanation of all issues, that differs:

> curr="x"

redundant - see below

> 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

>     curr=`echo $line | cut -d ' ' -f 2`
            1^^^^^^^^^

>     if ( grep " $curr " $1 > /dev/null ); then
> 	curr="x"
>     fi

redundant

> else
>     if test x"$line" = x; then
[till end]

There are test for zero and non-zero lengths. So here we do

	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.

-- 
GoTaR <priv0.onet.pl->gotar>
PLD stuff at http://mops.uci.agh.edu.pl/~gotar/



***************r-e-k-l-a-m-a**************

Masz dosc placenia prowizji bankowi ?
mBank - zaloz konto
http://epieniadze.onet.pl/mbank 
-------------- next part --------------
#!/bin/sh

# This script walks through the master (stdin) help/message file, and
# prints (stdout) only those messages which are missing from the help
# file given as parameter ($1).
#
# Example: help_diff.sh help_mp-hu.h < help_mp-en.h > missing.h

while read -r line
do
	if echo -E "$line" | grep -q '^#define'
	then
		grep -q `echo -E "$line" | cut -d ' ' -f 2` $1 || echo -E "$line"
	fi
done


More information about the MPlayer-dev-eng mailing list