code duplication
[netris.git] / msg_diff.sh
1 #!/bin/sh
2
3 # Copied help_diff.sh from the MPlayer project <http://www.mplayerhq.hu>
4 # copyright MPlayer team
5
6 # This script walks through the master (stdin) help/message file, and
7 # prints (stdout) only those messages which are missing from the help
8 # file given as parameter ($1).
9 #
10 # Example: msg_diff.sh msg.eo.h < msg.en.h > missing.h
11
12 curr=""
13
14 while read -r line; do
15         if echo "$line" | grep '^#define' > /dev/null 2>&1; then
16                 curr=`printf "%s\n" "$line" | cut -d ' ' -f 2`
17                 if grep "^#define $curr[         ]" $1 > /dev/null 2>&1; then
18                         curr=""
19                 fi
20         else
21                 if [ -z "$line" ]; then
22                         curr=""
23                 fi
24         fi
25
26         if [ -n "$curr" ]; then
27                 printf "%s\n" "$line"
28         fi
29 done