Guest User

Untitled

a guest
Nov 13th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. username=johndoe&password=password123
  2.  
  3. password123
  4.  
  5. void httpString(char **dest, char *input, const char *find) {
  6. char *start;
  7. char *o_input = input;
  8. const char *o_find = find;
  9. size_t length = 0;
  10. size_t i = 0;
  11. while (*input) {
  12. if (*input == '&' || input == o_input) {
  13. if (*input == '&') {
  14. input++;
  15. if (*input == 0) {
  16. return;
  17. }
  18. }
  19. while (*input == *find) {
  20. if (*input == 0 || *find == 0) {
  21. return;
  22. }
  23. input++;
  24. find++;
  25. if (*input == '=' && *find == 0) {
  26. input++;
  27. if (*input == 0) {
  28. return;
  29. }
  30. start = input;
  31. while (*input != '&' && *input) {
  32. input++;
  33. length++;
  34. }
  35. *dest = malloc(length + 1);
  36. input = start;
  37. while (*input != '&' && *input) {
  38. (*dest)[i] = *input;
  39. input++;
  40. i++;
  41. }
  42. (*dest)[i] = 0;
  43. return;
  44. }
  45. }
  46. }
  47. find = o_find;
  48. input++;
  49. }
  50. }
Add Comment
Please, Sign In to add comment