ref: 96857088f4e03e08ff36aee45a347c564347f226
parent: 5b07f6238bcc14a044d7fa4373eda9ce68d05d64
author: cinap_lenrek <cinap_lenrek@rei2>
date: Mon Feb 20 05:49:54 EST 2012
page: improve shortname()
--- a/sys/src/cmd/page.c
+++ b/sys/src/cmd/page.c
@@ -258,9 +258,14 @@
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;
}