Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. while (dictionary[r] != EOF)
  2. {
  3. if (dictionary[r] != '\n')
  4. {
  5. current_line[i] = dictionary[r];
  6. i++;
  7. }
  8.  
  9. else
  10. {
  11.  
  12. current_line[i] = '\n';
  13. current_line[i+1] = '\0';
  14. i = 0;
  15. if (!isspace(current_line[0]))
  16. {
  17. if (m == -1)
  18. {
  19. if (strstr(current_line, template))
  20. matched_entry = 1;
  21. else
  22. matched_entry = 0;
  23. }
  24.  
  25. if (m == 2)
  26. {
  27. if ((strncmp(current_line, template, strlen(template))) == 0)
  28. matched_entry = 1;
  29. else
  30. matched_entry = 0;
  31. }
  32.  
  33.  
  34.  
  35. if (m == 1)
  36. {
  37. if (strlen(template) > strlen(template))
  38. f = strlen(template);
  39. else
  40. f = strlen(current_line);
  41. if (strncmp(current_line, template, f-1) == 0 )
  42. matched_entry = 1;
  43. else
  44. matched_entry = 0;
  45. }
  46.  
  47.  
  48. if (m == 3)
  49. {
  50. if ( (strstr(current_line, template) + b) == (strchr(current_line, '\0') - 1) )
  51. matched_entry = 1;
  52. else
  53. matched_entry = 0;
  54. }
  55. }
  56. h = h + matched_entry;
  57. if (matched_entry)
  58. strcat(entries, current_line);
  59. }
  60. r++;
  61. }
  62. if(h)
  63. return entries;
  64. else
  65. return NULL;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement