* @return 1 if @p c is a word character, else 0
*/
static int iswordchar(int c, int (*special)(int)) {
* @return 1 if @p c is a word character, else 0
*/
static int iswordchar(int c, int (*special)(int)) {
/** @brief Parse an RFC1521/RFC2616 word
* @param s Pointer to start of word
* @param valuep Where to store value
/** @brief Parse an RFC1521/RFC2616 word
* @param s Pointer to start of word
* @param valuep Where to store value
* @return Pointer just after end of word or NULL if there's no word
*
* A word is a token or a quoted-string.
*/
* @return Pointer just after end of word or NULL if there's no word
*
* A word is a token or a quoted-string.
*/
/** @brief Parse an RFC1521/RFC2616 token
* @param s Pointer to start of token
* @param valuep Where to store value
/** @brief Parse an RFC1521/RFC2616 token
* @param s Pointer to start of token
* @param valuep Where to store value
* @return Pointer just after end of token or NULL if there's no token
*/
static const char *parsetoken(const char *s, char **valuep,
int (*special)(int)) {
if(*s == '"')
return 0;
* @return Pointer just after end of token or NULL if there's no token
*/
static const char *parsetoken(const char *s, char **valuep,
int (*special)(int)) {
if(*s == '"')
return 0;
dynstr_append(&type, tolower((unsigned char)*s++));
if(!(s = skipwhite(s, 1)))
return -1;
dynstr_append(&type, tolower((unsigned char)*s++));
if(!(s = skipwhite(s, 1)))
return -1;
dynstr_append(&type, '/');
if(!(s = skipwhite(s, 1)))
return -1;
dynstr_append(&type, '/');
if(!(s = skipwhite(s, 1)))
return -1;
dynstr_append(&type, tolower((unsigned char)*s++));
if(!(s = skipwhite(s, 1)))
return -1;
dynstr_append(&type, tolower((unsigned char)*s++));
if(!(s = skipwhite(s, 1)))
return -1;
dynstr_append(¶metername, tolower((unsigned char)*s++));
if(!(s = skipwhite(s, 1)))
return -1;
dynstr_append(¶metername, tolower((unsigned char)*s++));
if(!(s = skipwhite(s, 1)))
return -1;
dynstr_append(&name, tolower((unsigned char)*s++));
if(!(s = skipwhite(s, 1)))
return 0;
dynstr_append(&name, tolower((unsigned char)*s++));
if(!(s = skipwhite(s, 1)))
return 0;
dynstr_append(&disposition, tolower((unsigned char)*s++));
if(!(s = skipwhite(s, 1)))
return -1;
dynstr_append(&disposition, tolower((unsigned char)*s++));
if(!(s = skipwhite(s, 1)))
return -1;
dynstr_append(¶metername, tolower((unsigned char)*s++));
if(!(s = skipwhite(s, 1)))
return -1;
dynstr_append(¶metername, tolower((unsigned char)*s++));
if(!(s = skipwhite(s, 1)))
return -1;