You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.5 KiB

26 years ago
  1. /* Copyright (c) 2000, 2006 MySQL AB
  2. Use is subject to license terms.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; version 2 of the License.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program; if not, write to the Free Software
  12. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  13. */
  14. /* File : strrchr.c
  15. Author : Richard A. O'Keefe.
  16. Updated: 10 April 1984
  17. Defines: strrchr(), rindex()
  18. strrchr(s, c) returns a pointer to the last place in s where c
  19. occurs, or NullS if c does not occur in s. This function is called
  20. rindex in V7 and 4.?bsd systems; while not ideal the name is clearer
  21. than strrchr, so rindex remains in strings.h as a macro. NB:
  22. strrchr looks for single characters, not for sets or strings. The
  23. parameter 'c' is declared 'int' so it will go in a register; if your
  24. C compiler is happy with register char change it to that.
  25. */
  26. #include "strings.h"
  27. char *strrchr(register const char *s, register pchar c)
  28. {
  29. reg3 char *t;
  30. t = NullS;
  31. do if (*s == (char) c) t = (char*) s; while (*s++);
  32. return (char*) t;
  33. }