Author: dcoakley Date: 2011-03-22 16:31:26 -0400 (Tue, 22 Mar 2011) New Revision: 3523
Modified: trunk/osprey/libu/errmsg/extract.awk Log: Avoid using GNU awk extensions for better portability. Some Linux distributions, such as Ubuntu 10.10, ship with alternate versions of awk that do not support GNU extensions. To make things easier, change extract.awk to produce the same output using only traditional awk features. Approved by: Jian-Xin Lai and Suneel Jain Modified: trunk/osprey/libu/errmsg/extract.awk =================================================================== --- trunk/osprey/libu/errmsg/extract.awk 2011-03-18 21:45:00 UTC (rev 3522) +++ trunk/osprey/libu/errmsg/extract.awk 2011-03-22 20:31:26 UTC (rev 3523) @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Advanced Micro Devices, Inc. All Rights Reserved. +# Copyright (C) 2009, 2011 Advanced Micro Devices, Inc. All Rights Reserved. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published @@ -32,19 +32,24 @@ printf "\tchar *msg;\n"; printf "} libu_default_msgs[] = {\n"; } -{ - # note: using gawk extension to set 'result' - if (match($0, /^\$msg ([0-9]+) (.+)$/, result)) { - if (count > 0) { - printf ",\n"; - } - count++; +/^\$msg ([0-9]+) (.+)$/ { + if (count > 0) { + printf ",\n"; + } + count++; - # escape double-quotes in message text - msg = result[2]; - gsub(/"/, "\\\"", msg) - printf "\t{ %s, \"%s\" }", result[1], msg - } + # the message number is the text between the first and second spaces + sp1 = index($0, " ") + sp2 = sp1 + index(substr($0, sp1 + 1), " ") + num = substr($0, sp1 + 1, sp2 - sp1 - 1) + + # the message is the remainder following the second space in the line + msg = substr($0, sp2 + 1) + + # escape double-quotes in message text + gsub(/"/, "\\\"", msg) + + printf "\t{ %s, \"%s\" }", num, msg } END { printf "\n};\n"; ------------------------------------------------------------------------------ Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar _______________________________________________ Open64-devel mailing list Open64-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open64-devel