See below logic from wget
source code. Where is last_component
defined? I presume this is either a GNU include or buried somewhere in the standard C includes. But I can't seem to locate it. Thx.
char *
get_metalink_basename (char *name)
{
int n;
char *basename;
if (!name)
return NULL;
basename = last_component (name);
while ((n = FILE_SYSTEM_PREFIX_LEN (basename)) > 0)
basename += n;
return metalink_check_safe_path (basename) ? basename : NULL;
}
Wget uses gnulib. last_component
is declared in basename-lgpl.h and defined in basename-lgpl.c.