Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while (dictionary[r] != EOF)
- {
- if (dictionary[r] != '\n')
- {
- current_line[i] = dictionary[r];
- i++;
- }
- else
- {
- current_line[i] = '\n';
- current_line[i+1] = '\0';
- i = 0;
- if (!isspace(current_line[0]))
- {
- if (m == -1)
- {
- if (strstr(current_line, template))
- matched_entry = 1;
- else
- matched_entry = 0;
- }
- if (m == 2)
- {
- if ((strncmp(current_line, template, strlen(template))) == 0)
- matched_entry = 1;
- else
- matched_entry = 0;
- }
- if (m == 1)
- {
- if (strlen(template) > strlen(template))
- f = strlen(template);
- else
- f = strlen(current_line);
- if (strncmp(current_line, template, f-1) == 0 )
- matched_entry = 1;
- else
- matched_entry = 0;
- }
- if (m == 3)
- {
- if ( (strstr(current_line, template) + b) == (strchr(current_line, '\0') - 1) )
- matched_entry = 1;
- else
- matched_entry = 0;
- }
- }
- h = h + matched_entry;
- if (matched_entry)
- strcat(entries, current_line);
- }
- r++;
- }
- if(h)
- return entries;
- else
- return NULL;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement