Sometimes things are so obvious that you miss them. "just view a single LF as the field separator and a double LF as the record separator" is, of course, the point that makes me look soooooo stupid.
Seems as if the flamesuit was not good enough. Consider me crashed and burned. Can I pretend I never sent this email ? :) Julian -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Svensson Sent: 12 January 2005 08:24 To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [Asterisk-Users] Changes to manager outputs - A discussion On Wed, 12 Jan 2005, Asterisk wrote: > Peter Svensson wrote: > > On Tue, 11 Jan 2005, Asterisk wrote: > > > >>b) As mentioned, further fields can be added at any time without > >>breaking code > > > > > > The current format is tagged. How much easier can it get to add more > > fields? At the moment the order is not fixed either which is nice > > from a flexibility point. You can have optional fields that ar only > > output if they make sense. > > This was part of my problem - there was a varying number of lines per > "record" which made my processing easier if it were one record per line. > Again, that could be my blindness die to the language I use. You just view a single LF as the field separator and a double LF as the record separator. In other workds, instead of assembling the record until the string "\n" is found you assemble until "\n\n" is found. > >>c) output can be exported directly into spreadsheets > > > > True, but a trivial amount of script magic can transform the current > > tagged format into whatever you want. > > Why have all the various "listners" have to process the output, rather > than have it presented ? Because it is _much_ simpler to parse and update a tagged format than a tab separated one? Remember, the events and command responses are _not_ lines from a database with exactly the same fields each time. Think of them as overloaded RPC perhaps. > > It is not fixed, I think thats is why you are thinking along these lines. > > It is a tagged format. Given the nature of the data that is sent > > (what fields are valid may vary) a tagged format is probably the > > only sane way of representing the data. > > If the data had a "start/end" tag, I would agree. However, it is > difficult to find the end of the data because of the "optional" fields. Not at all hard. If you insist on using line buffered reads then you read until you find an empty line. If not, you just read until the token "\n\n" is found. Peter _______________________________________________ Asterisk-Users mailing list [email protected] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users _______________________________________________ Asterisk-Users mailing list [email protected] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
