# HG changeset patch # User Tuomo Valkonen # Date 1173567936 -3600 # Node ID 96a557abc364bc18b89b56cabc56c6946f400241 # Parent 2b4dd5f948bc8755641bd4a6651f51e012897c5a Renamed `prog_execname` `libtu_progname` and added `libtu_progbasename`. diff -r 2b4dd5f948bc -r 96a557abc364 errorlog.c --- a/errorlog.c Tue Feb 20 00:18:18 2007 +0100 +++ b/errorlog.c Sun Mar 11 00:05:36 2007 +0100 @@ -39,7 +39,7 @@ if(el->msgs==NULL){ el->msgs=ALLOC_N(char, ERRORLOG_MAX_SIZE); if(el->msgs==NULL){ - fprintf(stderr, "%s: %s\n", prog_execname(), strerror(errno)); + fprintf(stderr, "%s: %s\n", libtu_progname(), strerror(errno)); return; } el->msgs[0]=0; diff -r 2b4dd5f948bc -r 96a557abc364 output.c --- a/output.c Tue Feb 20 00:18:18 2007 +0100 +++ b/output.c Sun Mar 11 00:05:36 2007 +0100 @@ -98,7 +98,7 @@ if(!progname_enable) return; - progname=prog_execname(); + progname=libtu_progname(); if(progname==NULL) return; diff -r 2b4dd5f948bc -r 96a557abc364 util.c --- a/util.c Tue Feb 20 00:18:18 2007 +0100 +++ b/util.c Sun Mar 11 00:05:36 2007 +0100 @@ -30,8 +30,16 @@ } -const char *prog_execname() +const char *libtu_progname() { return progname; } + +const char *libtu_progbasename() +{ + const char *s=strrchr(progname, '/'); + + return (s==NULL ? progname : s+1); +} + diff -r 2b4dd5f948bc -r 96a557abc364 util.h --- a/util.h Tue Feb 20 00:18:18 2007 +0100 +++ b/util.h Sun Mar 11 00:05:36 2007 +0100 @@ -18,6 +18,7 @@ #include "optparser.h" extern void libtu_init(const char *argv0); -extern const char *prog_execname(); +extern const char *libtu_progname(); +extern const char *libtu_progbasename(); #endif /* LIBTU_UTIL_H */