diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2010-11-24 20:27:02 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2010-11-24 20:27:02 +0200 |
commit | 50d4a80f67e5bcbf3902138d85a25f6a90847d31 (patch) | |
tree | 18ebd4f82b1b5732977926b9bac4634bfb002759 | |
parent | b9c0946c39a677f733d42a26d2de3f44131bbdd8 (diff) | |
download | egawk-50d4a80f67e5bcbf3902138d85a25f6a90847d31.tar.gz egawk-50d4a80f67e5bcbf3902138d85a25f6a90847d31.tar.bz2 egawk-50d4a80f67e5bcbf3902138d85a25f6a90847d31.zip |
Add check for plugin license, make close on exec POSIX compatibile.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | TODO | 5 | ||||
-rw-r--r-- | doc/gawk.info | 824 | ||||
-rw-r--r-- | doc/gawk.texi | 20 | ||||
-rw-r--r-- | ext.c | 24 | ||||
-rw-r--r-- | extension/ChangeLog | 6 | ||||
-rw-r--r-- | extension/arrayparm.c | 2 | ||||
-rw-r--r-- | extension/dl.c | 2 | ||||
-rw-r--r-- | extension/filefuncs.c | 2 | ||||
-rw-r--r-- | extension/fork.c | 2 | ||||
-rw-r--r-- | extension/ordchr.c | 2 | ||||
-rw-r--r-- | extension/readfile.c | 2 | ||||
-rw-r--r-- | extension/rwarray.c | 4 | ||||
-rw-r--r-- | extension/testarg.c | 2 | ||||
-rw-r--r-- | extension/xreadlink.c | 2 | ||||
-rw-r--r-- | posix/ChangeLog | 6 | ||||
-rw-r--r-- | posix/gawkmisc.c | 23 |
18 files changed, 527 insertions, 412 deletions
@@ -1,3 +1,8 @@ +Wed Nov 24 20:09:23 2010 Arnold D. Robbins <arnold@skeeve.com> + + * ext.c (do_ext): Require definition of `plugin_is_GPL_compatible' + per GNU Coding standards. + Sun Nov 21 14:23:58 2010 John Haque <j.eh@mchsi.com> Debugger: Fix memory leak when quitting pager. @@ -63,7 +63,11 @@ Changes from 3.1.8 to 4.0.0 21. Arrays of arrays added. -22. Many code cleanups. Removed code for many old, unsupported systems. +22. Per the GNU Coding Standards, dynamic extensions must now define + a global symbol indicating that they are GPL-compatible. See + the documentation and example extensions. + +23. Many code cleanups. Removed code for many old, unsupported systems. Changes from 3.1.7 to 3.1.8 --------------------------- @@ -1,9 +1,10 @@ FIX regular field splitting to use FPAT algorithm. -Revise plug-in code to check for special symbol per GNU coding standards. + +#Revise plug-in code to check for special symbol per GNU coding standards. Paolo's code for checking for single char values in str2wstr(). -Fix os_close_on_exec to do read/modify/write of the fd flags. +#Fix os_close_on_exec to do read/modify/write of the fd flags. Consider forcing [a-z] int abc...wxyz in regexes, no matter what the locale. diff --git a/doc/gawk.info b/doc/gawk.info index 289005e0..dd1f8a98 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -480,6 +480,7 @@ texts being (a) (see below), and with the Back-Cover Texts being (b) `gawk'. * Internals:: A brief look at some `gawk' internals. +* Plugin License:: A note about licensing. * Sample Library:: A example of new functions. * Internal File Description:: What the new functions will do. * Internal File Ops:: The code for internal file operations. @@ -21057,10 +21058,11 @@ be such a guarantee. * Menu: * Internals:: A brief look at some `gawk' internals. +* Plugin License:: A note about licensing. * Sample Library:: A example of new functions. -File: gawk.info, Node: Internals, Next: Sample Library, Up: Dynamic Extensions +File: gawk.info, Node: Internals, Next: Plugin License, Up: Dynamic Extensions C.3.1 A Minimal Introduction to `gawk' Internals ------------------------------------------------ @@ -21312,9 +21314,26 @@ simpler: just blindly copy this code. -File: gawk.info, Node: Sample Library, Prev: Internals, Up: Dynamic Extensions +File: gawk.info, Node: Plugin License, Next: Sample Library, Prev: Internals, Up: Dynamic Extensions -C.3.2 Directory and File Operation Built-ins +C.3.2 Extension Licensing +------------------------- + +Every dynamic extension should define the global symbol +`plugin_is_GPL_compatible' to assert that it has been licensed under a +GPL-compatible license. If this symbol does not exist, `gawk' will +emit a fatal error and exit. + + The declared type of the symbol should be `int'. It does not need +to be in any allocated section, though. The code merely asserts that +the symbol exists in the global scope. Something like this is enough: + + int plugin_is_GPL_compatible; + + +File: gawk.info, Node: Sample Library, Prev: Plugin License, Up: Dynamic Extensions + +C.3.3 Directory and File Operation Built-ins -------------------------------------------- Two useful functions that are not in `awk' are `chdir' (so that an @@ -21331,7 +21350,7 @@ implements these functions for `gawk' in an external extension library. File: gawk.info, Node: Internal File Description, Next: Internal File Ops, Up: Sample Library -C.3.2.1 Using `chdir' and `stat' +C.3.3.1 Using `chdir' and `stat' ................................ This minor node shows how to use the new functions at the `awk' level @@ -21454,7 +21473,7 @@ Elements::): File: gawk.info, Node: Internal File Ops, Next: Using Internal File Ops, Prev: Internal File Description, Up: Sample Library -C.3.2.2 C Code for `chdir' and `stat' +C.3.3.2 C Code for `chdir' and `stat' ..................................... Here is the C code for these extensions. They were written for @@ -21465,6 +21484,8 @@ other POSIX-compliant systems:(1) #include <sys/sysmacros.h> + int plugin_is_GPL_compatible; + /* do_chdir --- provide dynamically loaded chdir() builtin for gawk */ @@ -21610,7 +21631,7 @@ distribution. File: gawk.info, Node: Using Internal File Ops, Prev: Internal File Ops, Up: Sample Library -C.3.2.3 Integrating the Extensions +C.3.3.3 Integrating the Extensions .................................. Now that the code is written, it must be possible to add it at runtime @@ -26228,7 +26249,7 @@ Index (line 10) * programming conventions, functions, writing: Definition Syntax. (line 55) -* programming conventions, gawk internals: Internal File Ops. (line 32) +* programming conventions, gawk internals: Internal File Ops. (line 34) * programming conventions, nextfile statement: Nextfile Function. (line 20) * programming conventions, private variable names: Library Names. @@ -26805,399 +26826,400 @@ Index Tag Table: Node: Top1340 -Node: Foreword29812 -Node: Preface34128 -Ref: Preface-Footnote-137080 -Ref: Preface-Footnote-237186 -Node: History37418 -Node: Names39650 -Ref: Names-Footnote-141127 -Node: This Manual41199 -Ref: This Manual-Footnote-146097 -Node: Conventions46197 -Node: Manual History48256 -Ref: Manual History-Footnote-151434 -Ref: Manual History-Footnote-251475 -Node: How To Contribute51549 -Node: Acknowledgments52693 -Node: Getting Started56962 -Node: Running gawk59334 -Node: One-shot60520 -Node: Read Terminal61745 -Ref: Read Terminal-Footnote-163395 -Ref: Read Terminal-Footnote-263669 -Node: Long63840 -Node: Executable Scripts65216 -Ref: Executable Scripts-Footnote-167077 -Ref: Executable Scripts-Footnote-267179 -Node: Comments67630 -Node: Quoting69998 -Node: DOS Quoting74615 -Node: Sample Data Files75283 -Node: Very Simple78315 -Node: Two Rules82912 -Node: More Complex85059 -Ref: More Complex-Footnote-187989 -Node: Statements/Lines88069 -Ref: Statements/Lines-Footnote-192425 -Node: Other Features92690 -Node: When93559 -Node: Regexp95702 -Node: Regexp Usage97156 -Node: Escape Sequences99182 -Node: Regexp Operators104925 -Ref: Regexp Operators-Footnote-1112097 -Ref: Regexp Operators-Footnote-2112244 -Node: Character Lists112342 -Ref: table-char-classes114117 -Node: GNU Regexp Operators116742 -Node: Case-sensitivity120455 -Ref: Case-sensitivity-Footnote-1123410 -Ref: Case-sensitivity-Footnote-2123645 -Node: Leftmost Longest123753 -Node: Computed Regexps124954 -Node: Locales128371 -Node: Reading Files131461 -Node: Records133477 -Ref: Records-Footnote-1142043 -Node: Fields142080 -Ref: Fields-Footnote-1145112 -Node: Nonconstant Fields145198 -Node: Changing Fields147400 -Node: Field Separators152685 -Node: Default Field Splitting155314 -Node: Regexp Field Splitting156431 -Node: Single Character Fields159781 -Node: Command Line Field Separator160832 -Node: Field Splitting Summary164271 -Ref: Field Splitting Summary-Footnote-1167457 -Node: Constant Size167558 -Node: Splitting By Content172029 -Ref: Splitting By Content-Footnote-1175631 -Node: Multiple Line175671 -Ref: Multiple Line-Footnote-1181411 -Node: Getline181590 -Node: Plain Getline183811 -Node: Getline/Variable185900 -Node: Getline/File187041 -Node: Getline/Variable/File188363 -Ref: Getline/Variable/File-Footnote-1189962 -Node: Getline/Pipe190049 -Node: Getline/Variable/Pipe192597 -Node: Getline/Coprocess193704 -Node: Getline/Variable/Coprocess194947 -Node: Getline Notes195661 -Node: Getline Summary197603 -Ref: table-getline-variants197887 -Node: BEGINFILE/ENDFILE198792 -Node: Command line directories201647 -Node: Printing202282 -Node: Print203913 -Node: Print Examples205250 -Node: Output Separators208034 -Node: OFMT209793 -Node: Printf211151 -Node: Basic Printf212057 -Node: Control Letters213594 -Node: Format Modifiers217406 -Node: Printf Examples223417 -Node: Redirection226132 -Node: Special Files233110 -Node: Special FD233643 -Ref: Special FD-Footnote-1237218 -Node: Special Network237292 -Node: Special Caveats238147 -Node: Close Files And Pipes238941 -Ref: Close Files And Pipes-Footnote-1245885 -Ref: Close Files And Pipes-Footnote-2246033 -Node: Expressions246183 -Node: Values247252 -Node: Constants247928 -Node: Scalar Constants248608 -Ref: Scalar Constants-Footnote-1249467 -Node: Nondecimal-numbers249649 -Node: Regexp Constants252708 -Node: Using Constant Regexps253183 -Node: Variables256188 -Node: Using Variables256843 -Node: Assignment Options258570 -Node: Conversion260451 -Ref: table-locale-affects265825 -Ref: Conversion-Footnote-1266449 -Node: All Operators266558 -Node: Arithmetic Ops267188 -Node: Concatenation269687 -Ref: Concatenation-Footnote-1272480 -Node: Assignment Ops272599 -Ref: table-assign-ops277587 -Node: Increment Ops278988 -Node: Truth Values and Conditions282466 -Node: Truth Values283549 -Node: Typing and Comparison284597 -Node: Variable Typing285318 -Ref: Variable Typing-Footnote-1289215 -Node: Comparison Operators289337 -Ref: table-relational-ops289715 -Node: Boolean Ops293264 -Ref: Boolean Ops-Footnote-1297342 -Node: Conditional Exp297433 -Node: Function Calls299165 -Node: Precedence302724 -Node: Patterns and Actions306377 -Node: Pattern Overview307431 -Node: Regexp Patterns308868 -Node: Expression Patterns309411 -Node: Ranges312961 -Node: BEGIN/END316050 -Node: Using BEGIN/END316800 -Ref: Using BEGIN/END-Footnote-1319531 -Node: I/O And BEGIN/END319645 -Node: Empty321912 -Node: Using Shell Variables322220 -Node: Action Overview324501 -Node: Statements326859 -Node: If Statement328715 -Node: While Statement330214 -Node: Do Statement332246 -Node: For Statement333395 -Node: Switch Statement336535 -Node: Break Statement338583 -Node: Continue Statement340403 -Node: Next Statement342101 -Node: Nextfile Statement344381 -Node: Exit Statement347099 -Node: Built-in Variables349370 -Node: User-modified350465 -Ref: User-modified-Footnote-1358431 -Node: Auto-set358493 -Ref: Auto-set-Footnote-1367155 -Node: ARGC and ARGV367360 -Node: Arrays371121 -Node: Array Basics372630 -Node: Array Intro373341 -Node: Reference to Elements377728 -Node: Assigning Elements379627 -Node: Array Example380118 -Node: Scanning an Array381850 -Node: Delete384127 -Ref: Delete-Footnote-1386517 -Node: Numeric Array Subscripts386574 -Node: Uninitialized Subscripts388761 -Node: Multi-dimensional390367 -Node: Multi-scanning393458 -Node: Array Sorting395042 -Node: Arrays of Arrays398872 -Node: Functions402980 -Node: Built-in403789 -Node: Calling Built-in404803 -Node: Numeric Functions406779 -Ref: Numeric Functions-Footnote-1410533 -Ref: Numeric Functions-Footnote-2410867 -Node: String Functions411136 -Ref: String Functions-Footnote-1432970 -Ref: String Functions-Footnote-2433099 -Ref: String Functions-Footnote-3433347 -Node: Gory Details433434 -Ref: table-sub-escapes435091 -Ref: table-sub-posix-92436437 -Ref: table-sub-proposed437780 -Ref: table-posix-2001-sub439140 -Ref: table-gensub-escapes440415 -Ref: Gory Details-Footnote-1441618 -Node: I/O Functions441669 -Ref: I/O Functions-Footnote-1448457 -Node: Time Functions448548 -Ref: Time Functions-Footnote-1459360 -Ref: Time Functions-Footnote-2459428 -Ref: Time Functions-Footnote-3459586 -Ref: Time Functions-Footnote-4459697 -Ref: Time Functions-Footnote-5459824 -Ref: Time Functions-Footnote-6460051 -Node: Bitwise Functions460317 -Ref: table-bitwise-ops460895 -Ref: Bitwise Functions-Footnote-1465135 -Node: I18N Functions465319 -Node: User-defined467042 -Node: Definition Syntax467846 -Node: Function Example472544 -Node: Function Caveats475126 -Node: Return Statement479051 -Node: Dynamic Typing481708 -Node: Indirect Calls482445 -Node: Internationalization492080 -Node: I18N and L10N493499 -Node: Explaining gettext494183 -Ref: Explaining gettext-Footnote-1499094 -Ref: Explaining gettext-Footnote-2499333 -Node: Programmer i18n499502 -Node: Translator i18n503737 -Node: String Extraction504528 -Ref: String Extraction-Footnote-1505485 -Node: Printf Ordering505611 -Ref: Printf Ordering-Footnote-1508391 -Node: I18N Portability508455 -Ref: I18N Portability-Footnote-1510900 -Node: I18N Example510963 -Ref: I18N Example-Footnote-1513583 -Node: Gawk I18N513655 -Node: Advanced Features514233 -Node: Nondecimal Data515548 -Node: Two-way I/O517109 -Ref: Two-way I/O-Footnote-1522592 -Node: TCP/IP Networking522669 -Node: Profiling525459 -Node: Invoking Gawk532920 -Node: Command Line534227 -Node: Options535012 -Ref: Options-Footnote-1548100 -Node: Other Arguments548125 -Node: AWKPATH Variable550806 -Ref: AWKPATH Variable-Footnote-1553581 -Node: Exit Status553841 -Node: Include Files554513 -Node: Obsolete558114 -Node: Undocumented558915 -Node: Known Bugs559177 -Node: Library Functions559779 -Ref: Library Functions-Footnote-1562760 -Node: Library Names562931 -Ref: Library Names-Footnote-1566404 -Ref: Library Names-Footnote-2566623 -Node: General Functions566709 -Node: Nextfile Function567772 -Node: Strtonum Function572136 -Node: Assert Function575077 -Node: Round Function578381 -Node: Cliff Random Function579921 -Node: Ordinal Functions580936 -Ref: Ordinal Functions-Footnote-1583996 -Node: Join Function584212 -Ref: Join Function-Footnote-1585974 -Node: Gettimeofday Function586174 -Node: Data File Management589885 -Node: Filetrans Function590517 -Node: Rewind Function593943 -Node: File Checking595389 -Node: Empty Files596419 -Node: Ignoring Assigns598644 -Node: Getopt Function600192 -Ref: Getopt Function-Footnote-1611474 -Node: Passwd Functions611677 -Ref: Passwd Functions-Footnote-1620655 -Node: Group Functions620743 -Node: Sample Programs628840 -Node: Running Examples629509 -Node: Clones630237 -Node: Cut Program631369 -Node: Egrep Program641128 -Ref: Egrep Program-Footnote-1648878 -Node: Id Program648988 -Node: Split Program652595 -Node: Tee Program656063 -Node: Uniq Program658806 -Node: Wc Program666173 -Ref: Wc Program-Footnote-1670417 -Node: Miscellaneous Programs670613 -Node: Dupword Program671733 -Node: Alarm Program673764 -Node: Translate Program678306 -Ref: Translate Program-Footnote-1682685 -Ref: Translate Program-Footnote-2682922 -Node: Labels Program683056 -Ref: Labels Program-Footnote-1686347 -Node: Word Sorting686431 -Node: History Sorting690778 -Node: Extract Program692616 -Node: Simple Sed699974 -Node: Igawk Program703031 -Ref: Igawk Program-Footnote-1717762 -Ref: Igawk Program-Footnote-2717963 -Node: Signature Program718101 -Node: Debugger719181 -Node: Debugging720057 -Node: Debugging Concepts720371 -Node: Debugging Terms722224 -Node: Awk Debugging724772 -Node: Sample dgawk session725664 -Node: dgawk invocation726156 -Node: Finding The Bug727340 -Node: List of Debugger Commands733855 -Node: Breakpoint Control735170 -Node: Dgawk Execution Control738380 -Node: Viewing And Changing Data741729 -Node: Dgawk Stack745025 -Node: Dgawk Info746486 -Node: Miscellaneous Dgawk Commands750424 -Node: Readline Support756140 -Node: Dgawk Limitations756956 -Node: Language History759128 -Node: V7/SVR3.1760505 -Node: SVR4762800 -Node: POSIX764245 -Node: BTL765957 -Node: POSIX/GNU767647 -Node: Contributors777311 -Node: Installation780916 -Node: Gawk Distribution781887 -Node: Getting782371 -Node: Extracting783197 -Node: Distribution contents784585 -Node: Unix Installation789658 -Node: Quick Installation790249 -Node: Additional Configuration Options791951 -Node: Configuration Philosophy793714 -Node: Non-Unix Installation796078 -Node: PC Installation796543 -Node: PC Binary Installation797849 -Node: PC Compiling799692 -Node: PC Dynamic804197 -Node: PC Using806560 -Node: Cygwin811108 -Node: MSYS812092 -Node: VMS Installation812598 -Node: VMS Compilation813202 -Node: VMS Installation Details814779 -Node: VMS Running816409 -Node: VMS POSIX818006 -Node: VMS Old Gawk819304 -Node: Unsupported819773 -Node: Atari Installation820235 -Node: Atari Compiling821522 -Node: Atari Using823411 -Node: BeOS Installation826258 -Node: Tandem Installation827403 -Node: Bugs829082 -Node: Other Versions832914 -Node: Notes838136 -Node: Compatibility Mode838828 -Node: Additions839611 -Node: Adding Code840361 -Node: New Ports846413 -Node: Dynamic Extensions850545 -Node: Internals851870 -Node: Sample Library862275 -Node: Internal File Description862934 -Node: Internal File Ops866629 -Ref: Internal File Ops-Footnote-1871469 -Node: Using Internal File Ops871617 -Node: Future Extensions873642 -Node: Basic Concepts877679 -Node: Basic High Level878436 -Ref: Basic High Level-Footnote-1882552 -Node: Basic Data Typing882746 -Node: Floating Point Issues887183 -Node: String Conversion Precision888266 -Ref: String Conversion Precision-Footnote-1889960 -Node: Unexpected Results890069 -Node: POSIX Floating Point Problems891895 -Ref: POSIX Floating Point Problems-Footnote-1895594 -Node: Glossary895632 -Node: Copying919400 -Node: GNU Free Documentation License956957 -Node: next-edition982101 -Node: unresolved982453 -Node: revision982953 -Node: consistency983376 -Node: Index986729 +Node: Foreword29871 +Node: Preface34187 +Ref: Preface-Footnote-137139 +Ref: Preface-Footnote-237245 +Node: History37477 +Node: Names39709 +Ref: Names-Footnote-141186 +Node: This Manual41258 +Ref: This Manual-Footnote-146156 +Node: Conventions46256 +Node: Manual History48315 +Ref: Manual History-Footnote-151493 +Ref: Manual History-Footnote-251534 +Node: How To Contribute51608 +Node: Acknowledgments52752 +Node: Getting Started57021 +Node: Running gawk59393 +Node: One-shot60579 +Node: Read Terminal61804 +Ref: Read Terminal-Footnote-163454 +Ref: Read Terminal-Footnote-263728 +Node: Long63899 +Node: Executable Scripts65275 +Ref: Executable Scripts-Footnote-167136 +Ref: Executable Scripts-Footnote-267238 +Node: Comments67689 +Node: Quoting70057 +Node: DOS Quoting74674 +Node: Sample Data Files75342 +Node: Very Simple78374 +Node: Two Rules82971 +Node: More Complex85118 +Ref: More Complex-Footnote-188048 +Node: Statements/Lines88128 +Ref: Statements/Lines-Footnote-192484 +Node: Other Features92749 +Node: When93618 +Node: Regexp95761 +Node: Regexp Usage97215 +Node: Escape Sequences99241 +Node: Regexp Operators104984 +Ref: Regexp Operators-Footnote-1112156 +Ref: Regexp Operators-Footnote-2112303 +Node: Character Lists112401 +Ref: table-char-classes114176 +Node: GNU Regexp Operators116801 +Node: Case-sensitivity120514 +Ref: Case-sensitivity-Footnote-1123469 +Ref: Case-sensitivity-Footnote-2123704 +Node: Leftmost Longest123812 +Node: Computed Regexps125013 +Node: Locales128430 +Node: Reading Files131520 +Node: Records133536 +Ref: Records-Footnote-1142102 +Node: Fields142139 +Ref: Fields-Footnote-1145171 +Node: Nonconstant Fields145257 +Node: Changing Fields147459 +Node: Field Separators152744 +Node: Default Field Splitting155373 +Node: Regexp Field Splitting156490 +Node: Single Character Fields159840 +Node: Command Line Field Separator160891 +Node: Field Splitting Summary164330 +Ref: Field Splitting Summary-Footnote-1167516 +Node: Constant Size167617 +Node: Splitting By Content172088 +Ref: Splitting By Content-Footnote-1175690 +Node: Multiple Line175730 +Ref: Multiple Line-Footnote-1181470 +Node: Getline181649 +Node: Plain Getline183870 +Node: Getline/Variable185959 +Node: Getline/File187100 +Node: Getline/Variable/File188422 +Ref: Getline/Variable/File-Footnote-1190021 +Node: Getline/Pipe190108 +Node: Getline/Variable/Pipe192656 +Node: Getline/Coprocess193763 +Node: Getline/Variable/Coprocess195006 +Node: Getline Notes195720 +Node: Getline Summary197662 +Ref: table-getline-variants197946 +Node: BEGINFILE/ENDFILE198851 +Node: Command line directories201706 +Node: Printing202341 +Node: Print203972 +Node: Print Examples205309 +Node: Output Separators208093 +Node: OFMT209852 +Node: Printf211210 +Node: Basic Printf212116 +Node: Control Letters213653 +Node: Format Modifiers217465 +Node: Printf Examples223476 +Node: Redirection226191 +Node: Special Files233169 +Node: Special FD233702 +Ref: Special FD-Footnote-1237277 +Node: Special Network237351 +Node: Special Caveats238206 +Node: Close Files And Pipes239000 +Ref: Close Files And Pipes-Footnote-1245944 +Ref: Close Files And Pipes-Footnote-2246092 +Node: Expressions246242 +Node: Values247311 +Node: Constants247987 +Node: Scalar Constants248667 +Ref: Scalar Constants-Footnote-1249526 +Node: Nondecimal-numbers249708 +Node: Regexp Constants252767 +Node: Using Constant Regexps253242 +Node: Variables256247 +Node: Using Variables256902 +Node: Assignment Options258629 +Node: Conversion260510 +Ref: table-locale-affects265884 +Ref: Conversion-Footnote-1266508 +Node: All Operators266617 +Node: Arithmetic Ops267247 +Node: Concatenation269746 +Ref: Concatenation-Footnote-1272539 +Node: Assignment Ops272658 +Ref: table-assign-ops277646 +Node: Increment Ops279047 +Node: Truth Values and Conditions282525 +Node: Truth Values283608 +Node: Typing and Comparison284656 +Node: Variable Typing285377 +Ref: Variable Typing-Footnote-1289274 +Node: Comparison Operators289396 +Ref: table-relational-ops289774 +Node: Boolean Ops293323 +Ref: Boolean Ops-Footnote-1297401 +Node: Conditional Exp297492 +Node: Function Calls299224 +Node: Precedence302783 +Node: Patterns and Actions306436 +Node: Pattern Overview307490 +Node: Regexp Patterns308927 +Node: Expression Patterns309470 +Node: Ranges313020 +Node: BEGIN/END316109 +Node: Using BEGIN/END316859 +Ref: Using BEGIN/END-Footnote-1319590 +Node: I/O And BEGIN/END319704 +Node: Empty321971 +Node: Using Shell Variables322279 +Node: Action Overview324560 +Node: Statements326918 +Node: If Statement328774 +Node: While Statement330273 +Node: Do Statement332305 +Node: For Statement333454 +Node: Switch Statement336594 +Node: Break Statement338642 +Node: Continue Statement340462 +Node: Next Statement342160 +Node: Nextfile Statement344440 +Node: Exit Statement347158 +Node: Built-in Variables349429 +Node: User-modified350524 +Ref: User-modified-Footnote-1358490 +Node: Auto-set358552 +Ref: Auto-set-Footnote-1367214 +Node: ARGC and ARGV367419 +Node: Arrays371180 +Node: Array Basics372689 +Node: Array Intro373400 +Node: Reference to Elements377787 +Node: Assigning Elements379686 +Node: Array Example380177 +Node: Scanning an Array381909 +Node: Delete384186 +Ref: Delete-Footnote-1386576 +Node: Numeric Array Subscripts386633 +Node: Uninitialized Subscripts388820 +Node: Multi-dimensional390426 +Node: Multi-scanning393517 +Node: Array Sorting395101 +Node: Arrays of Arrays398931 +Node: Functions403039 +Node: Built-in403848 +Node: Calling Built-in404862 +Node: Numeric Functions406838 +Ref: Numeric Functions-Footnote-1410592 +Ref: Numeric Functions-Footnote-2410926 +Node: String Functions411195 +Ref: String Functions-Footnote-1433029 +Ref: String Functions-Footnote-2433158 +Ref: String Functions-Footnote-3433406 +Node: Gory Details433493 +Ref: table-sub-escapes435150 +Ref: table-sub-posix-92436496 +Ref: table-sub-proposed437839 +Ref: table-posix-2001-sub439199 +Ref: table-gensub-escapes440474 +Ref: Gory Details-Footnote-1441677 +Node: I/O Functions441728 +Ref: I/O Functions-Footnote-1448516 +Node: Time Functions448607 +Ref: Time Functions-Footnote-1459419 +Ref: Time Functions-Footnote-2459487 +Ref: Time Functions-Footnote-3459645 +Ref: Time Functions-Footnote-4459756 +Ref: Time Functions-Footnote-5459883 +Ref: Time Functions-Footnote-6460110 +Node: Bitwise Functions460376 +Ref: table-bitwise-ops460954 +Ref: Bitwise Functions-Footnote-1465194 +Node: I18N Functions465378 +Node: User-defined467101 +Node: Definition Syntax467905 +Node: Function Example472603 +Node: Function Caveats475185 +Node: Return Statement479110 +Node: Dynamic Typing481767 +Node: Indirect Calls482504 +Node: Internationalization492139 +Node: I18N and L10N493558 +Node: Explaining gettext494242 +Ref: Explaining gettext-Footnote-1499153 +Ref: Explaining gettext-Footnote-2499392 +Node: Programmer i18n499561 +Node: Translator i18n503796 +Node: String Extraction504587 +Ref: String Extraction-Footnote-1505544 +Node: Printf Ordering505670 +Ref: Printf Ordering-Footnote-1508450 +Node: I18N Portability508514 +Ref: I18N Portability-Footnote-1510959 +Node: I18N Example511022 +Ref: I18N Example-Footnote-1513642 +Node: Gawk I18N513714 +Node: Advanced Features514292 +Node: Nondecimal Data515607 +Node: Two-way I/O517168 +Ref: Two-way I/O-Footnote-1522651 +Node: TCP/IP Networking522728 +Node: Profiling525518 +Node: Invoking Gawk532979 +Node: Command Line534286 +Node: Options535071 +Ref: Options-Footnote-1548159 +Node: Other Arguments548184 +Node: AWKPATH Variable550865 +Ref: AWKPATH Variable-Footnote-1553640 +Node: Exit Status553900 +Node: Include Files554572 +Node: Obsolete558173 +Node: Undocumented558974 +Node: Known Bugs559236 +Node: Library Functions559838 +Ref: Library Functions-Footnote-1562819 +Node: Library Names562990 +Ref: Library Names-Footnote-1566463 +Ref: Library Names-Footnote-2566682 +Node: General Functions566768 +Node: Nextfile Function567831 +Node: Strtonum Function572195 +Node: Assert Function575136 +Node: Round Function578440 +Node: Cliff Random Function579980 +Node: Ordinal Functions580995 +Ref: Ordinal Functions-Footnote-1584055 +Node: Join Function584271 +Ref: Join Function-Footnote-1586033 +Node: Gettimeofday Function586233 +Node: Data File Management589944 +Node: Filetrans Function590576 +Node: Rewind Function594002 +Node: File Checking595448 +Node: Empty Files596478 +Node: Ignoring Assigns598703 +Node: Getopt Function600251 +Ref: Getopt Function-Footnote-1611533 +Node: Passwd Functions611736 +Ref: Passwd Functions-Footnote-1620714 +Node: Group Functions620802 +Node: Sample Programs628899 +Node: Running Examples629568 +Node: Clones630296 +Node: Cut Program631428 +Node: Egrep Program641187 +Ref: Egrep Program-Footnote-1648937 +Node: Id Program649047 +Node: Split Program652654 +Node: Tee Program656122 +Node: Uniq Program658865 +Node: Wc Program666232 +Ref: Wc Program-Footnote-1670476 +Node: Miscellaneous Programs670672 +Node: Dupword Program671792 +Node: Alarm Program673823 +Node: Translate Program678365 +Ref: Translate Program-Footnote-1682744 +Ref: Translate Program-Footnote-2682981 +Node: Labels Program683115 +Ref: Labels Program-Footnote-1686406 +Node: Word Sorting686490 +Node: History Sorting690837 +Node: Extract Program692675 +Node: Simple Sed700033 +Node: Igawk Program703090 +Ref: Igawk Program-Footnote-1717821 +Ref: Igawk Program-Footnote-2718022 +Node: Signature Program718160 +Node: Debugger719240 +Node: Debugging720116 +Node: Debugging Concepts720430 +Node: Debugging Terms722283 +Node: Awk Debugging724831 +Node: Sample dgawk session725723 +Node: dgawk invocation726215 +Node: Finding The Bug727399 +Node: List of Debugger Commands733914 +Node: Breakpoint Control735229 +Node: Dgawk Execution Control738439 +Node: Viewing And Changing Data741788 +Node: Dgawk Stack745084 +Node: Dgawk Info746545 +Node: Miscellaneous Dgawk Commands750483 +Node: Readline Support756199 +Node: Dgawk Limitations757015 +Node: Language History759187 +Node: V7/SVR3.1760564 +Node: SVR4762859 +Node: POSIX764304 +Node: BTL766016 +Node: POSIX/GNU767706 +Node: Contributors777370 +Node: Installation780975 +Node: Gawk Distribution781946 +Node: Getting782430 +Node: Extracting783256 +Node: Distribution contents784644 +Node: Unix Installation789717 +Node: Quick Installation790308 +Node: Additional Configuration Options792010 +Node: Configuration Philosophy793773 +Node: Non-Unix Installation796137 +Node: PC Installation796602 +Node: PC Binary Installation797908 +Node: PC Compiling799751 +Node: PC Dynamic804256 +Node: PC Using806619 +Node: Cygwin811167 +Node: MSYS812151 +Node: VMS Installation812657 +Node: VMS Compilation813261 +Node: VMS Installation Details814838 +Node: VMS Running816468 +Node: VMS POSIX818065 +Node: VMS Old Gawk819363 +Node: Unsupported819832 +Node: Atari Installation820294 +Node: Atari Compiling821581 +Node: Atari Using823470 +Node: BeOS Installation826317 +Node: Tandem Installation827462 +Node: Bugs829141 +Node: Other Versions832973 +Node: Notes838195 +Node: Compatibility Mode838887 +Node: Additions839670 +Node: Adding Code840420 +Node: New Ports846472 +Node: Dynamic Extensions850604 +Node: Internals851985 +Node: Plugin License862390 +Node: Sample Library863024 +Node: Internal File Description863688 +Node: Internal File Ops867383 +Ref: Internal File Ops-Footnote-1872259 +Node: Using Internal File Ops872407 +Node: Future Extensions874432 +Node: Basic Concepts878469 +Node: Basic High Level879226 +Ref: Basic High Level-Footnote-1883342 +Node: Basic Data Typing883536 +Node: Floating Point Issues887973 +Node: String Conversion Precision889056 +Ref: String Conversion Precision-Footnote-1890750 +Node: Unexpected Results890859 +Node: POSIX Floating Point Problems892685 +Ref: POSIX Floating Point Problems-Footnote-1896384 +Node: Glossary896422 +Node: Copying920190 +Node: GNU Free Documentation License957747 +Node: next-edition982891 +Node: unresolved983243 +Node: revision983743 +Node: consistency984166 +Node: Index987519 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index a8aef1b7..28692a39 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -660,6 +660,7 @@ particular records in a file and perform operations upon them. @command{gawk}. * Internals:: A brief look at some @command{gawk} internals. +* Plugin License:: A note about licensing. * Sample Library:: A example of new functions. * Internal File Description:: What the new functions will do. * Internal File Ops:: The code for internal file operations. @@ -28275,6 +28276,7 @@ When @option{--sandbox} is specified, extensions are disabled. @menu * Internals:: A brief look at some @command{gawk} internals. +* Plugin License:: A note about licensing. * Sample Library:: A example of new functions. @end menu @@ -28598,6 +28600,22 @@ Again, you should spend time studying the @command{gawk} internals; don't just blindly copy this code. @c ENDOFRANGE gawint +@node Plugin License +@appendixsubsec Extension Licensing + +Every dynamic extension should define the global symbol +@code{plugin_is_GPL_compatible} to assert that it has been licensed under +a GPL-compatible license. If this symbol does not exist, @command{gawk} +will emit a fatal error and exit. + +The declared type of the symbol should be @code{int}. It does not need +to be in any allocated section, though. The code merely asserts that +the symbol exists in the global scope. Something like this is enough: + +@example +int plugin_is_GPL_compatible; +@end example + @node Sample Library @appendixsubsec Directory and File Operation Built-ins @c STARTOFRANGE chdirg @@ -28779,6 +28797,8 @@ slightly for presentation. The complete version can be found in #include <sys/sysmacros.h> +int plugin_is_GPL_compatible; + /* do_chdir --- provide dynamically loaded chdir() builtin for gawk */ @@ -48,6 +48,8 @@ do_ext(int nargs) NODE *(*func)(NODE *, void *); void *dl; int flags = RTLD_LAZY; + int fatal_error = FALSE; + int *gpl_compat; #if 0 static short warned = FALSE; #endif @@ -82,24 +84,36 @@ do_ext(int nargs) /* fatal needs `obj', and we need to deallocate it! */ msg(_("fatal: extension: cannot open `%s' (%s)\n"), obj->stptr, dlerror()); -ferror: - DEREF(obj); - DEREF(fun); - gawk_exit(EXIT_FATAL); + fatal_error = TRUE; + goto done; + } + + /* Per the GNU Coding standards */ + gpl_compat = (int *) dlsym(dl, "plugin_is_GPL_compatible"); + if (gpl_compat == NULL) { + msg(_("fatal: extension: library `%s': does not define `plugin_is_GPL_compatible' (%s)\n"), + obj->stptr, dlerror()); + fatal_error = TRUE; + goto done; } + func = (NODE *(*)(NODE *, void *)) dlsym(dl, fun->stptr); if (func == NULL) { msg(_("fatal: extension: library `%s': cannot call function `%s' (%s)\n"), obj->stptr, fun->stptr, dlerror()); - goto ferror; + fatal_error = TRUE; + goto done; } tmp = (*func)(obj, dl); if (tmp == NULL) tmp = Nnull_string; +done: DEREF(obj); DEREF(fun); + if (fatal_error) + gawk_exit(EXIT_FATAL); return tmp; } diff --git a/extension/ChangeLog b/extension/ChangeLog index 8c772b8b..22dabf9f 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,9 @@ +Wed Nov 24 20:08:13 2010 Arnold D. Robbins <arnold@skeeve.com> + + * arrayparm.c, dl.c, filefuncs.c, fork.c, ordchr.c, readfile.c, + rwarray.c, testarg.c, xreadlink.c: Define `plugin_is_GPL_compatible' + per GNU Coding standards. + Thu May 6 20:55:14 2010 Arnold D. Robbins <arnold@skeeve.com> * Release 3.1.8: Release tar file made. diff --git a/extension/arrayparm.c b/extension/arrayparm.c index 281b50a2..d6763528 100644 --- a/extension/arrayparm.c +++ b/extension/arrayparm.c @@ -32,6 +32,8 @@ #include "awk.h" +int plugin_is_GPL_compatible; + /* do_mkarray --- turn a variable into an array */ /* diff --git a/extension/dl.c b/extension/dl.c index 49938fc8..3e784519 100644 --- a/extension/dl.c +++ b/extension/dl.c @@ -29,6 +29,8 @@ #include "awk.h" #include <dlfcn.h> +int plugin_is_GPL_compatible; + static void *sdl = NULL; static NODE * diff --git a/extension/filefuncs.c b/extension/filefuncs.c index 35b1ae62..c1268508 100644 --- a/extension/filefuncs.c +++ b/extension/filefuncs.c @@ -31,6 +31,8 @@ #include <sys/sysmacros.h> +int plugin_is_GPL_compatible; + /* do_chdir --- provide dynamically loaded chdir() builtin for gawk */ static NODE * diff --git a/extension/fork.c b/extension/fork.c index c5458c60..b6f2268c 100644 --- a/extension/fork.c +++ b/extension/fork.c @@ -27,6 +27,8 @@ #include "awk.h" +int plugin_is_GPL_compatible; + /* do_fork --- provide dynamically loaded fork() builtin for gawk */ static NODE * diff --git a/extension/ordchr.c b/extension/ordchr.c index c5a1375f..492439f3 100644 --- a/extension/ordchr.c +++ b/extension/ordchr.c @@ -30,6 +30,8 @@ #include "awk.h" +int plugin_is_GPL_compatible; + /* do_ord --- return numeric value of first char of string */ static NODE * diff --git a/extension/readfile.c b/extension/readfile.c index edab20f8..9e115d10 100644 --- a/extension/readfile.c +++ b/extension/readfile.c @@ -37,6 +37,8 @@ #define O_BINARY 0 #endif +int plugin_is_GPL_compatible; + /* do_readfile --- read a file into memory */ NODE * diff --git a/extension/rwarray.c b/extension/rwarray.c index ace5c84e..87232c7b 100644 --- a/extension/rwarray.c +++ b/extension/rwarray.c @@ -6,7 +6,7 @@ */ /* - * Copyright (C) 2009 the Free Software Foundation, Inc. + * Copyright (C) 2009, 2010 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -37,6 +37,8 @@ #define MAJOR 1 #define MINOR 0 +int plugin_is_GPL_compatible; + static int write_array(int fd, NODE *array); static int write_elem(int fd, int index, NODE *item); static int write_chain(int fd, int index, NODE *item); diff --git a/extension/testarg.c b/extension/testarg.c index 42fd4dd6..c1a8dc96 100644 --- a/extension/testarg.c +++ b/extension/testarg.c @@ -1,5 +1,7 @@ #include "awk.h" +int plugin_is_GPL_compatible; + static NODE * do_check_arg(int nargs) { diff --git a/extension/xreadlink.c b/extension/xreadlink.c index d56d2a6a..dc484ac2 100644 --- a/extension/xreadlink.c +++ b/extension/xreadlink.c @@ -45,6 +45,8 @@ #include "xalloc.h" +int plugin_is_GPL_compatible; + /* Call readlink to get the symbolic link value of FILE. SIZE is a hint as to how long the link is expected to be; typically it is taken from st_size. It need not be correct. diff --git a/posix/ChangeLog b/posix/ChangeLog index d4710fcc..ddd40114 100644 --- a/posix/ChangeLog +++ b/posix/ChangeLog @@ -1,3 +1,9 @@ +Wed Nov 24 17:26:24 2010 Arnold D. Robbins <arnold@skeeve.com> + + * gawkmisc.c (os_close_on_exec): After discussion on the Bash + list, change the routine to follow POSIX and use read/modify/write + on the flags value. + Thu May 6 20:55:14 2010 Arnold D. Robbins <arnold@skeeve.com> * Release 3.1.8: Release tar file made. diff --git a/posix/gawkmisc.c b/posix/gawkmisc.c index 7fb5f1ef..6032fcdf 100644 --- a/posix/gawkmisc.c +++ b/posix/gawkmisc.c @@ -165,11 +165,30 @@ os_close_on_exec(fd, name, what, dir) int fd; const char *name, *what, *dir; { + int curflags = 0; + if (fd <= 2) /* sanity */ return; - if (fcntl(fd, F_SETFD, 1) < 0) - warning(_("%s %s `%s': could not set close-on-exec: (fcntl: %s)"), + /* + * Per POSIX, use Read/Modify/Write - get the flags, + * add FD_CLOEXEC, set the flags back. + */ + + if ((curflags = fcntl(fd, F_GETFD)) < 0) { + warning(_("%s %s `%s': could not get fd flags: (fcntl F_GETFD: %s)"), + what, dir, name, strerror(errno)); + return; + } + +#ifndef FD_CLOEXEC +#define FD_CLOEXEC 1 +#endif + + curflags |= FD_CLOEXEC; + + if (fcntl(fd, F_SETFD, curflags) < 0) + warning(_("%s %s `%s': could not set close-on-exec: (fcntl F_SETFD: %s)"), what, dir, name, strerror(errno)); } |