gno/usr.orca.bin/describe/basename.c
gdr b00e9eb797 Makefile:
- Renamed from makefile.mk to Makefile.
	- Updated for proper operation as part of GNO build.
	- Discontinue use of vaend.c, basename.c for GNO v2.0.6.

descu:
	- Document ability to specify an output file vice stdout
	  (this feature was already in, but not documented)
	- Allow the output file to be the same name as the first
	  input file (it will be overwritten).
	- Fix buffer overrun bugs that occured when:
		a) There was no initial input file; or
		b) There are no headers in the first input file; or
		c) There are no trailers in the first input file; or
	- Increased SLOTS_QUANTUM from 20 to 64, hopefully increasing
	  the speed on large files.
	- fixed stack check code to use the new routines names
	- put version number in lockstep with descc and describe

descc:
	- descc will now change the database file type to BIN, if it
	  wasn't already so.
	- changed default location of system database
	- fixed stack check code to use the new routines names
	- put version number in lockstep with descu and describe


describe:
	- changed default location of system database
	- fixed stack check code to use the new routines names
	- put version number in lockstep with descu and descc

*.rez:
	- added resource source files
1997-09-24 06:34:59 +00:00

33 lines
554 B
C

/*
* $Id: basename.c,v 1.2 1997/09/24 06:34:57 gdr Exp $
*/
#include <string.h>
#include <stdio.h>
#include <unistd.h>
char *basename (char *name) {
char *p, brk;
/* checking for ':' is GS-specific */
brk = (strchr(name,':')) ? ':' : '/';
p = strrchr(name,brk);
return ((p) ? p+1 : name);
}
#ifdef SHELLCOMD
int main (int argc, char **argv) {
if (argc != 2) {
fprintf(stderr,"Usage: basename file_name\nVersion 1.0\n");
return -1;
}
printf("%s\n",basename(argv[1]));
return 0;
}
#endif /* SHELLCOMD */