Renamed `prog_execname` `libtu_progname` and added `libtu_progbasename`.

Sun, 11 Mar 2007 00:05:36 +0100

author
Tuomo Valkonen <tuomov@iki.fi>
date
Sun, 11 Mar 2007 00:05:36 +0100
changeset 109
96a557abc364
parent 108
2b4dd5f948bc
child 110
13134ea30227

Renamed `prog_execname` `libtu_progname` and added `libtu_progbasename`.

errorlog.c file | annotate | diff | comparison | revisions
output.c file | annotate | diff | comparison | revisions
util.c file | annotate | diff | comparison | revisions
util.h file | annotate | diff | comparison | revisions
--- 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;
--- 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;
--- 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);
+}
+
--- 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 */

mercurial