Mercurial > urweb
comparison src/c/urweb.c @ 1787:69daa6d70299
Top.postFields
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sat, 21 Jul 2012 15:16:57 -0400 |
parents | 61c7eb1d3867 |
children | f57983ba2a36 |
comparison
equal
deleted
inserted
replaced
1786:d794149b3713 | 1787:69daa6d70299 |
---|---|
4084 uw_error(ctx, FATAL, "Disallowed character in CSS property"); | 4084 uw_error(ctx, FATAL, "Disallowed character in CSS property"); |
4085 } | 4085 } |
4086 | 4086 |
4087 return s; | 4087 return s; |
4088 } | 4088 } |
4089 | |
4090 uw_Basis_string uw_Basis_fieldName(uw_context ctx, uw_Basis_postField f) { | |
4091 return f.name; | |
4092 } | |
4093 | |
4094 uw_Basis_string uw_Basis_fieldValue(uw_context ctx, uw_Basis_postField f) { | |
4095 return f.value; | |
4096 } | |
4097 | |
4098 uw_Basis_string uw_Basis_remainingFields(uw_context ctx, uw_Basis_postField f) { | |
4099 return f.remaining; | |
4100 } | |
4101 | |
4102 uw_Basis_postField *uw_Basis_firstFormField(uw_context ctx, uw_Basis_string s) { | |
4103 char *amp, *eq, *unurl, *copy; | |
4104 uw_Basis_postField *f; | |
4105 | |
4106 if (s[0] == 0) | |
4107 return NULL; | |
4108 | |
4109 amp = strchr(s, '&'); | |
4110 copy = uw_malloc(ctx, amp ? amp - s + 1 : strlen(s) + 1); | |
4111 if (amp) { | |
4112 strncpy(copy, s, amp - s); | |
4113 copy[amp - s] = 0; | |
4114 } else | |
4115 strcpy(copy, s); | |
4116 | |
4117 eq = strchr(copy, '='); | |
4118 if (eq) | |
4119 *eq++ = 0; | |
4120 | |
4121 f = uw_malloc(ctx, sizeof(uw_Basis_postField)); | |
4122 unurl = copy; | |
4123 f->name = uw_Basis_unurlifyString(ctx, &unurl); | |
4124 f->value = eq ? (unurl = eq, uw_Basis_unurlifyString(ctx, &unurl)) : ""; | |
4125 f->remaining = amp ? amp+1 : ""; | |
4126 | |
4127 return f; | |
4128 } |