# <30-basename-fix.dpatch> by Daniel Kobras # # Use the POSIX basename(3), get rid of private prototype that wasn't used # anyway. Remove the now unneeded REDHAT50 define from the Makefile. # # Explanation: Previously, the code used glibc's basename but didn't realise # it was a GNU extension. Alternatively, one could define _GNU_SOURCE, but # I opted for the--hopefully--more portable POSIX version. (Unlike the GNU # version, the POSIX version may potentially modify its argument.) # #PATCHOPTIONS: -p1 --- gramofile-1.6.orig/bplaysrc/bplay.c 2001-05-05 16:13:55.000000000 +0200 +++ gramofile-1.6/bplaysrc/bplay.c 2004-01-07 18:34:49.000000000 +0100 @@ -20,6 +20,10 @@ #include #include +#ifdef linux +#include +#endif + #ifndef __FreeBSD__ #include #else @@ -53,16 +57,6 @@ /* Prototypes */ -#ifdef linux -/* This is in libc, but not in the header files. -- but it IS in - Red Hat 5.0.... Libc6? - well i'd guess its not in the headers because its nonstandard, i.e. - (probably) only exists on linux... -nox */ -#ifndef REDHAT50 -extern char *basename(char *name); -#endif -#endif - void Usage(void); void ErrDie(char *err); void Die(char *err); @@ -107,11 +101,14 @@ sndf_t filetype; /* The file type */ int mods; /* So user can override */ int optc; /* For getopt */ + char *tmp = NULL; /* Do not clobber argv[0] */ init_curses(); #ifdef linux - progname = basename(argv[0]); /* For errors */ + tmp = strdup(argv[0]); /* POSIX basename may modify its arg */ + progname = basename(tmp); /* For errors */ + free(tmp); #else progname = strrchr(argv[0], '/'); /* Replacement for e.g. FreeBSD */ if (!progname || !*++progname) --- gramofile-1.6.orig/bplaysrc/Makefile 2001-05-05 16:13:55.000000000 +0200 +++ gramofile-1.6/bplaysrc/Makefile 2004-01-07 19:08:31.000000000 +0100 @@ -12,7 +12,7 @@ ########## CHOOSE YOUR ARCHITECTURE: (NOTE: also see ../Makefile!) # For Linux (and maybe others), use these: -CFLAGS = -Wall -O2 -DUSEBUFFLOCK -DREDHAT50 -DLP2CD -DVUMETER # -DDEBUG +CFLAGS = -Wall -O2 -DUSEBUFFLOCK -DLP2CD -DVUMETER # -DDEBUG LIBS = -lncurses # For FreeBSD (and maybe others), use these: