Subject: FVWM: Simple basename routine.

From: Jim Lupo <[email-masked]>
Date: Tue, 21 Nov 1995 09:22:24 -0500 (EST)

Here's a simple basename function.  It doesn't do all that the
basename function is documented to do, but it will handle extraction
of a program name from a fully qualified path name:

/* basename.c

   Given a pointer, s, to a null-terminated character string that
   contains a path name, basename returns a pointer to the last
   element in the path.

   Unlike the real basename, trailing ``/'' characters are not
   deleted, nor is a pointer to a static constant ``.'' returned if s
   or *s is NULL.  This should not be a problem if one desires only
   the program name from the fully qualified executable path name.

*/

#include <string.h>

char *basename ( char *s )
{
  char *t;
  t = strrchr ( s, '/' );
  return ( ( t ) ? ( t + 1 ) : s );
}

-- 
Jim
--
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].