Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/cygmagic')
-rwxr-xr-xwinsup/cygwin/cygmagic18
1 files changed, 16 insertions, 2 deletions
diff --git a/winsup/cygwin/cygmagic b/winsup/cygwin/cygmagic
index 5589b26f6..a8ccc8c76 100755
--- a/winsup/cygwin/cygmagic
+++ b/winsup/cygwin/cygmagic
@@ -1,4 +1,14 @@
#!/bin/sh
+# cygmagic - Generate "magic numbers" from a structure.
+#
+# Copyright 2001, 2002 Red Hat, Inc.
+#
+# This file is part of Cygwin.
+#
+# This software is a copyrighted work licensed under the terms of the
+# Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+# details.
+
file_magic=$1; shift
gcc=$1; shift
file=$1; shift
@@ -7,13 +17,17 @@ cat <<EOF > $file_magic
/* autogenerated - do not edit */
#include "$file"
EOF
+sumit() {
+ cksum $*
+}
+
while [ -n "$1" ]; do
define=$1; shift
struct=$1; shift
- sum=`$gcc -E $file | sed -n "/^$struct/,/^};/p" | sed -e 's/[ ]//g' -e '/^$/d' | sum | awk '{printf "0x%x", $1}'`
+ sum=`$gcc -E $file | sed -n "/^$struct/,/^};/p" | sed -e 's/[ ]//g' -e '/^$/d' | sumit | awk '{printf "0x%xU", $1}'`
echo "#define $define $sum"
curr=`sed -n "s/^#[ ]*define CURR_$define[ ][ ]*\([^ ][^ ]*\)/\1/p" $file`
- [ "$curr" == "$sum" ] || echo "*** WARNING WARNING WARNING WARNING WARNING ***
+ [ "$curr" != "$sum" ] && echo "*** WARNING WARNING WARNING WARNING WARNING ***
*** $file: magic number for $define changed old $curr != new $sum
*** WARNING WARNING WARNING WARNING WARNING ***" 1>&2
done >> $file_magic