All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] Avoid using GNU basename
@ 2012-02-28 15:36 Keith Mok
  2012-02-29 18:51 ` Mike Frysinger
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Keith Mok @ 2012-02-28 15:36 UTC (permalink / raw)
  To: u-boot

There is no GNU basename support in MacOS.
Use generic POSIX basename defined in libgen.h instead.

Signed-off-by: Keith Mok <ek9852@gmail.com>
---
 tools/mkenvimage.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c
index f781731..8b49723 100644
--- a/tools/mkenvimage.c
+++ b/tools/mkenvimage.c
@@ -25,9 +25,6 @@
  * MA 02111-1307 USA
  */

-/* We want the GNU version of basename() */
-#define _GNU_SOURCE
-
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
@@ -35,6 +32,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <compiler.h>
+#include <libgen.h>
 #include <sys/types.h>
 #include <sys/stat.h>

@@ -85,8 +83,10 @@ int main(int argc, char **argv)

        int fp, ep;
        const char *prg;
+       char *prog_pathname;

-       prg = basename(argv[0]);
+       prog_pathname = strdup(argv[0]);
+       prg = basename(prog_pathname);

        /* Turn off getopt()'s internal error message */
        opterr = 0;
-- 
1.7.7.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-03-26 11:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-28 15:36 [U-Boot] [PATCH] Avoid using GNU basename Keith Mok
2012-02-29 18:51 ` Mike Frysinger
2012-03-02  7:16 ` Wolfgang Denk
2012-03-02 14:09   ` Keith Mok
2012-03-02 16:42     ` Wolfgang Denk
     [not found]       ` <CAHjoi4eRTxXJKwg_XsEvtELNQmDzfqHzZiRO=MY-jfVYvDUrgA@mail.gmail.com>
2012-03-03 16:06         ` Wolfgang Denk
2012-03-02  7:19 ` [U-Boot] [PATCH] mkenvimage: fix usage message Wolfgang Denk
2012-03-02 18:39   ` Mike Frysinger
2012-03-26 11:24   ` Anatolij Gustschin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.