Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. --- match_orig.c    2017-08-19 13:37:11.000000000 -0700
  2. +++ match_2.c   2017-08-19 13:40:33.000000000 -0700
  3. @@ -1,20 +1,24 @@
  4. -// zaya popen'
  5.  int     match(char *s1, char *s2)
  6.  {
  7.      if (!(*s1) && !(*s2))
  8.          return (1);
  9.  
  10. -    if (*s2 == '*' && *(s2 + 1) != '\0' && *s1 == '\0')
  11. -        return (0);
  12. -
  13. -    if (*s2 == '*' && *(s2 + 1) == '*')
  14. -        return match(s1, s2 + 1);
  15. -
  16.      if (*s2 == *s1)
  17.          return (match(s1 + 1, s2 + 1));
  18.  
  19. +    if (*s1 == 0 && *s2 == '*')
  20. +   return match(s1, s2 + 1);
  21. +
  22.      if (*s2 == '*')
  23.          return (match(s1 + 1, s2) || match(s1, s2 + 1));
  24. +
  25.      return (0);
  26.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement