summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c0336ff)
raw | patch | inline | side by side (parent: c0336ff)
author | Rafael Gieschke <rafael@gieschke.de> | |
Thu, 19 May 2011 11:37:55 +0000 (13:37 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 20 May 2011 01:35:58 +0000 (18:35 -0700) |
Allow NO_GECOS_IN_PWENT to be defined in the Makefile for platforms that
lack the pw_gecos field in their "struct passwd", in which case the
uppercased user name is used instead via the standard '&' replacement
mechanism.
Signed-off-by: Rafael Gieschke <rafael@gieschke.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
lack the pw_gecos field in their "struct passwd", in which case the
uppercased user name is used instead via the standard '&' replacement
mechanism.
Signed-off-by: Rafael Gieschke <rafael@gieschke.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile | patch | blob | history | |
ident.c | patch | blob | history |
diff --git a/Makefile b/Makefile
index 02d6ea39ddb94532f1a8f0413a4e92f1eec6c3d7..90283abb770f9671e40fa87b124bcd909f2ac941 100644 (file)
--- a/Makefile
+++ b/Makefile
#
# Define NO_MKSTEMPS if you don't have mkstemps in the C library.
#
+# Define NO_GECOS_IN_PWENT if you don't have pw_gecos in struct passwd
+# in the C library.
+#
# Define NO_LIBGEN_H if you don't have libgen.h.
#
# Define NEEDS_LIBGEN if your libgen needs -lgen when linking
index 4232084208943c0772e394cfcff2328fb04493af..770b9e02c823dd80b89df2d8a83b975238126fcb 100644 (file)
--- a/ident.c
+++ b/ident.c
static char git_default_date[50];
+#ifdef NO_GECOS_IN_PWENT
+#define get_gecos(ignored) "&"
+#else
+#define get_gecos(struct_passwd) ((struct_passwd)->pw_gecos)
+#endif
+
static void copy_gecos(const struct passwd *w, char *name, size_t sz)
{
char *src, *dst;
* with commas. Also & stands for capitalized form of the login name.
*/
- for (len = 0, dst = name, src = w->pw_gecos; len < sz; src++) {
+ for (len = 0, dst = name, src = get_gecos(w); len < sz; src++) {
int ch = *src;
if (ch != '&') {
*dst++ = ch;