]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
include: [c.h] move up declaration of program_invocation_short_name before usage
authormaximilian attems <max@stro.at>
Sun, 31 Jul 2011 10:47:19 +0000 (12:47 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 2 Aug 2011 11:58:24 +0000 (13:58 +0200)
fixes:
../include/c.h: In function ‘errmsg’:
../include/c.h:111:26: error: ‘program_invocation_short_name’ undeclared
(first use in this function)
../include/c.h:111:26: note: each undeclared identifier is reported only
once for each function it appears in

Signed-off-by: maximilian attems <max@stro.at>
include/c.h

index 70f403c2bb10ea4af4fa77bc2b04ef39854f9485..79581aeb412f5b643cb6637d908f296efd52d5a2 100644 (file)
        _max1 > _max2 ? _max1 : _max2; })
 #endif
 
+#ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
+# ifdef HAVE___PROGNAME
+extern char *__progname;
+#  define program_invocation_short_name __progname
+# else
+#  ifdef HAVE_GETEXECNAME
+#   include <stdlib.h>
+#   define program_invocation_short_name \
+               prog_inv_sh_nm_from_file(getexecname(), 0)
+#  else
+#   define program_invocation_short_name \
+               prog_inv_sh_nm_from_file(__FILE__, 1)
+#  endif
+static char prog_inv_sh_nm_buf[256];
+static inline char *
+prog_inv_sh_nm_from_file(char *f, char stripext)
+{
+       char *t;
+
+       if ((t = strrchr(f, '/')) != NULL)
+               t++;
+       else
+               t = f;
+
+       strncpy(prog_inv_sh_nm_buf, t, sizeof(prog_inv_sh_nm_buf) - 1);
+       prog_inv_sh_nm_buf[sizeof(prog_inv_sh_nm_buf) - 1] = '\0';
+
+       if (stripext && (t = strrchr(prog_inv_sh_nm_buf, '.')) != NULL)
+               *t = '\0';
+
+       return prog_inv_sh_nm_buf;
+}
+# endif
+#endif
+
 
 #ifndef HAVE_ERR_H
 static inline void
@@ -160,41 +195,6 @@ static inline int dirfd(DIR *d)
 }
 #endif
 
-#ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
-# ifdef HAVE___PROGNAME
-extern char *__progname;
-#  define program_invocation_short_name __progname
-# else
-#  ifdef HAVE_GETEXECNAME
-#   include <stdlib.h>
-#   define program_invocation_short_name \
-               prog_inv_sh_nm_from_file(getexecname(), 0)
-#  else
-#   define program_invocation_short_name \
-               prog_inv_sh_nm_from_file(__FILE__, 1)
-#  endif
-static char prog_inv_sh_nm_buf[256];
-static inline char *
-prog_inv_sh_nm_from_file(char *f, char stripext)
-{
-       char *t;
-
-       if ((t = strrchr(f, '/')) != NULL)
-               t++;
-       else
-               t = f;
-
-       strncpy(prog_inv_sh_nm_buf, t, sizeof(prog_inv_sh_nm_buf) - 1);
-       prog_inv_sh_nm_buf[sizeof(prog_inv_sh_nm_buf) - 1] = '\0';
-
-       if (stripext && (t = strrchr(prog_inv_sh_nm_buf, '.')) != NULL)
-               *t = '\0';
-
-       return prog_inv_sh_nm_buf;
-}
-# endif
-#endif
-
 /*
  * Fallback defines for old versions of glibc
  */