summaryrefslogtreecommitdiff
path: root/libbb/strrstr.c
blob: b314264f56335eb8502afb3689261291dd9ff04b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* vi: set sw=4 ts=4: */
/*
 * Utility routines.
 *
 * Copyright (C) 2008 Bernhard Fischer
 *
 * Licensed under GPLv2 or later, see file License in this tarball for details.
 */

#include "libbb.h"

/* reverse strstr() */
char* strrstr(const char *haystack, const char *needle)
{
	char *tmp = strrchr(haystack, *needle);
	if (tmp == NULL || strcmp(tmp, needle) != 0)
		return NULL;
	return tmp;
}