page: improve shortname()

front
cinap_lenrek 2012-02-20 10:49:54 +01:00
parent 5b07f6238b
commit 96857088f4
1 changed files with 8 additions and 3 deletions

View File

@ -258,9 +258,14 @@ char*
shortname(char *s)
{
char *x;
if(x = strrchr(s, '/'))
if(x[1] != 0)
return x+1;
while(strlen(s) > 20){
if((x = strchr(s, '/')) == nil)
break;
if(x[1] == 0)
break;
s = x+1;
}
return s;
}