FVWM: Simple basename routine.

From: Jim Lupo <lupoja_at_feynman.ml.wpafb.af.mil>
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 majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Tue Nov 21 1995 - 08:21:23 GMT

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:57 BST