From: maximilian attems <max@stro.at>
To: util-linux@vger.kernel.org
Cc: maximilian attems <max@stro.at>
Subject: [PATCH 1/3] c.h: move up declaration of program_invocation_short_name before usage
Date: Sun, 31 Jul 2011 12:47:19 +0200 [thread overview]
Message-ID: <1312109241-13590-1-git-send-email-max@stro.at> (raw)
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 | 70 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 35 insertions(+), 35 deletions(-)
diff --git a/include/c.h b/include/c.h
index 70f403c..79581ae 100644
--- a/include/c.h
+++ b/include/c.h
@@ -103,6 +103,41 @@
_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
*/
--
1.7.5.4
next reply other threads:[~2011-07-31 10:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-31 10:47 maximilian attems [this message]
2011-07-31 10:47 ` [PATCH 2/3] c.h: Include stdlib.h unconditionaly maximilian attems
2011-08-02 12:15 ` Karel Zak
2011-07-31 10:47 ` [PATCH 3/3] mkswap: Use c.h maximilian attems
2011-08-02 12:16 ` Karel Zak
2011-08-02 12:15 ` [PATCH 1/3] c.h: move up declaration of program_invocation_short_name before usage Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1312109241-13590-1-git-send-email-max@stro.at \
--to=max@stro.at \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox