- char *r = a;
- while ((t = strtok_r(r, ",", &r))) {
- striplt(t); // strip leading and trailing whitespace
- stripout(t, '(', ')'); // remove any portion in parentheses
- stripallbut(t, '<', '>'); // if angle brackets are present, keep only what is inside them
- array_append(recipients_array, t);
+
+ int num_addresses = num_tokens(a, ',');
+ syslog(LOG_DEBUG, "\x1b[35mEXTRACING: %d addresses from <%s>\x1b[0m", num_addresses, a);
+ for (int i=0; i<num_addresses; ++i) {
+ char this_address[256];
+ extract_token(this_address, a, i, ',', sizeof this_address);
+ syslog(LOG_DEBUG, "\x1b[35mEXTRACTED: <%s>\x1b[0m", this_address);
+ striplt(this_address); // strip leading and trailing whitespace
+ stripout(this_address, '(', ')'); // remove any portion in parentheses
+ stripallbut(this_address, '<', '>'); // if angle brackets are present, keep only what is inside them
+ syslog(LOG_DEBUG, "\x1b[35mPROCESSED: <%s>\x1b[0m", this_address);
+ array_append(recipients_array, this_address);