Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- username=johndoe&password=password123
- password123
- void httpString(char **dest, char *input, const char *find) {
- char *start;
- char *o_input = input;
- const char *o_find = find;
- size_t length = 0;
- size_t i = 0;
- while (*input) {
- if (*input == '&' || input == o_input) {
- if (*input == '&') {
- input++;
- if (*input == 0) {
- return;
- }
- }
- while (*input == *find) {
- if (*input == 0 || *find == 0) {
- return;
- }
- input++;
- find++;
- if (*input == '=' && *find == 0) {
- input++;
- if (*input == 0) {
- return;
- }
- start = input;
- while (*input != '&' && *input) {
- input++;
- length++;
- }
- *dest = malloc(length + 1);
- input = start;
- while (*input != '&' && *input) {
- (*dest)[i] = *input;
- input++;
- i++;
- }
- (*dest)[i] = 0;
- return;
- }
- }
- }
- find = o_find;
- input++;
- }
- }
Add Comment
Please, Sign In to add comment