mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-12-22 14:30:29 +00:00
3a79f5a3a6
does not include resource forks. See the README for changes. This update by Devin Reade.
31 lines
512 B
C
31 lines
512 B
C
#pragma optimize -1
|
|
|
|
#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 */
|