Summary: | ASTERISK-02861: [patch] Multi-Line Comments In Config Files | ||
Reporter: | Anthony Minessale (anthm) | Labels: | |
Date Opened: | 2004-11-19 11:10:36.000-0600 | Date Closed: | 2008-01-15 15:15:41.000-0600 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Core/Configuration |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) multiline_comment_rev2.diff ( 1) multiline_comment_rev3.diff ( 2) multiline_comment.diff | |
Description: | This patch implements multi-line comments in any config file. *) The begin and end token MUST be anchored to the beginning of a new line. e.g. ;-- exten => 1,1,Dial(Zap/10) exten => 1,2,Hangup --; ****** ADDITIONAL INFORMATION ****** Disclaimer on file anthmct@yahoo.com | ||
Comments: | By: Clod Patry (junky) 2004-11-19 12:12:31.000-0600 it works fine on my side. great job anthm. can't you make something like: ;--this is a test--; works too? i know isnt at the beginning, but that would be nice too. with my example, im getting: Nov 22 17:25:44 WARNING[19338]: config.c:548 __ast_load: Unterminated comment detected beginning on line 60 and each seconds: i've that errors: Nov 22 17:27:14 NOTICE[19637]: pbx.c:1341 pbx_extension_helper: Cannot find extension context 'default' Nov 22 17:27:15 NOTICE[19637]: pbx.c:1341 pbx_extension_helper: Cannot find extension context 'default' Nov 22 17:27:16 NOTICE[19637]: pbx.c:1341 pbx_extension_helper: Cannot find extension context 'default' Nov 22 17:27:17 NOTICE[19637]: pbx.c:1341 pbx_extension_helper: Cannot find extension context 'default' Nov 22 17:27:18 NOTICE[19637]: pbx.c:1341 pbx_extension_helper: Cannot find extension context 'default' and if im taking out my examples, no more notices. edited on: 11-22-04 16:27 edited on: 11-22-04 16:37 By: Anthony Minessale (anthm) 2004-11-23 13:53:45.000-0600 new rev 2 now you can use it any way exten => ;-- Wazzup! --; 1,1,Dial(Zap/5) exten => 3,1,Dial(Zap/1) ;-- this works now! --; exten => 2,1,Dial(Zap/3) By: Anthony Minessale (anthm) 2004-12-01 10:32:12.000-0600 Revision 3 optimizes the process by using strchr and merging the single ; processing with the meta ;-- By: Mark Spencer (markster) 2004-12-04 11:11:01.000-0600 This kind of contruct does not work with the existing code: exten => 1245,1,Verbose(Hello ;-- great --; Big ;-- cool --; World!) Also, neither does something like this: ;-- --;exten => 1245,1,Verbose(Hello ;-- foo --; World!) which then causes the remainder of the file not to be parsed, so does this: ;-- ; --; exten => 1245,1,Verbose(Hello World) I've modified it so it works in all these cases and I've verified compatibility with C with odd constructs such as: ; ;-- exten => 1234,1,Foo ; --; And also handled escaping, including: exten => 1245,1,Verbose(Hello ;-- silly --; \;-- foo ;-- blah --; World) And it also eliminates the strcmp's and all strstr's so it should be pretty optimal in terms of performance. By: Mark Spencer (markster) 2004-12-04 11:15:00.000-0600 Merged in CVS with modifications. By: Russell Bryant (russell) 2004-12-06 18:02:52.000-0600 not in 1.0 By: Digium Subversion (svnbot) 2008-01-15 15:15:41.000-0600 Repository: asterisk Revision: 4386 U trunk/config.c ------------------------------------------------------------------------ r4386 | markster | 2008-01-15 15:15:41 -0600 (Tue, 15 Jan 2008) | 2 lines Add heavily revised version of anthm's multi-line comment (bug ASTERISK-2861) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=4386 |