diff options
-rwxr-xr-x | filters/calendar | 51 | ||||
-rw-r--r-- | filters/vectors/calendar-invite.expected | 3 |
2 files changed, 30 insertions, 24 deletions
diff --git a/filters/calendar b/filters/calendar index aeddeadf..a808a253 100755 --- a/filters/calendar +++ b/filters/calendar @@ -175,28 +175,30 @@ BEGIN { printf fmt, "LOCATION", location if(organizer != "") printf fmt, "ORGANIZER", organizer - printf " %-14s", "ATTENDEES " - for (idx in people_attending) { - if (idx == 1){ - printf "%s,\n", people_attending[idx] + if (notEmpty(people_attending)) { + printf " %-14s", "ATTENDEES " + for (idx in people_attending) { + if (idx == 1){ + printf "%s,\n", people_attending[idx] + } + else if (idx == length(people_attending)){ + printf " %-14s%s\n", "", people_attending[idx] + } + else{ + printf " %-14s%s,\n", "", people_attending[idx] + } } - else if (idx == length(people_attending)){ - printf " %-14s%s\n", "", people_attending[idx] - } - else{ - printf " %-14s%s,\n", "", people_attending[idx] - } - } - printf "\n\n %-14s\n", "DETAILED LIST:" - for (idx in people_attending) { - printf fmt, "ATTENDEE [" idx "]", people_attending[idx] - partstat = people_partstat[idx] - if (partstat != "") { - printf fmt, "", "STATUS\t" partstat - } - rsvp = people_rsvp[idx] - if (rsvp != "") { - printf fmt, "", "RSVP\t" rsvp + printf "\n\n %-14s\n", "DETAILED LIST:" + for (idx in people_attending) { + printf fmt, "ATTENDEE [" idx "]", people_attending[idx] + partstat = people_partstat[idx] + if (partstat != "") { + printf fmt, "", "STATUS\t" partstat + } + rsvp = people_rsvp[idx] + if (rsvp != "") { + printf fmt, "", "RSVP\t" rsvp + } } } if(entry != "") @@ -205,6 +207,13 @@ BEGIN { } } +function notEmpty(array) +{ + # "length(array) > 0" isn't POSIX-comapoptible, length accepts only strings + for (idx in array) return 1; + return 0; +} + function prepare(line) { gsub($1, "", line) diff --git a/filters/vectors/calendar-invite.expected b/filters/vectors/calendar-invite.expected index 4cd61485..a4f6d1c2 100644 --- a/filters/vectors/calendar-invite.expected +++ b/filters/vectors/calendar-invite.expected @@ -6,9 +6,6 @@ END 2999/12/31 32:30:00 LOCATION Some Location ORGANIZER <invalid@example.org> - ATTENDEES - - DETAILED LIST: A description. With multiple lines. |