src/stdlib/path.c
/*========================================
 * compress_path -- return path truncated
 *  returns static buffer in all cases
 *  truncates path from the front if needed
 * Created: 2001/12/22 (Perry Rapp)
 *======================================*/
- return path truncated
returns static buffer in all cases
truncates path from the front if needed
Created: 2001/12/22 (Perry Rapp)
- return path truncated returns static buffer in all cases truncates path from the front if needed Created : 2001 / 12 / 22 ( Perry Rapp )
STRING
compress_path (CNSTRING path, INT len)
{
	static char buf[120];
	INT pathlen = strlen(path);
	if (len > (INT)sizeof(buf)-1)
		len = (INT)sizeof(buf)-1;
	if (pathlen > len) {
		STRING dotdotdot = "...";
		INT delta = pathlen - len - strlen(dotdotdot);
		strcpy(buf, dotdotdot);
		strcpy(buf+strlen(dotdotdot), path+delta);
	} else {
		strcpy(buf, path);
	}
	return buf;
}
STRING compress_path ( CNSTRING path , INT len ) { static char buf [ 120 ] ; INT pathlen = strlen ( path ) ; if ( len > ( INT ) sizeof ( buf ) - 1 ) len = ( INT ) sizeof ( buf ) - 1 ; if ( pathlen > len ) { STRING dotdotdot = " " ; INT delta = pathlen - len - strlen ( dotdotdot ) ; strcpy ( buf , dotdotdot ) ; strcpy ( buf + strlen ( dotdotdot ) , path + delta ) ; } else { strcpy ( buf , path ) ; } return buf ; }
compress_path -- return path truncated
  returns static buffer in all cases
  truncates path from the front if needed
 Created: 2001/12/22 (Perry Rapp)
compress_path -- return path truncated returns static buffer in all cases truncates path from the front if needed Created : 2001 / 12 / 22 ( Perry Rapp )
/* TODO: be nice to expand "."  */