4 * Utility functions for the IMAP module.
12 #include "imap_tools.h"
15 * Break a command down into tokens, taking into consideration the
16 * possibility of escaping spaces using quoted tokens
18 int imap_parameterize(char **args, char *buf) {
27 original_len = strlen(buf);
29 for (i=0; i<original_len; ++i) {
31 if ( (isspace(buf[i])) && (!in_quote) ) {
33 args[num] = &buf[start];
35 if (args[num][0] == '\"') {
37 args[num][strlen(args[num])-1] = 0;
42 else if ( (buf[i] == '\"') && (!in_quote) ) {
46 else if ( (buf[i] == '\"') && (in_quote) ) {