Package: cxref Version: 1.6a-1 Severity: normal Tags: patch Hello,
Cxref package doesn't build on GNU/Hurd because of the PATH_MAX macro which doesn't exist on GNU/Hurd. Regards, Arnaud Fontaine -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable') Architecture: hurd-i386 (i686-AT386) Shell: /bin/sh linked to /bin/bash Kernel: GNU 0.3 Versions of packages cxref depends on: ii debconf [debconf-2.0] 1.4.70 Debian configuration management sy ii gcc 4:4.0.2-2+hurd.1 The GNU C compiler ii libc0.3 2.3.5-6 GNU C Library: Shared libraries an cxref recommends no packages. -- debconf information excluded
diff -urN cxref-1.6a.old/FILES cxref-1.6a/FILES
--- cxref-1.6a.old/FILES 2006-02-25 16:59:33.000000000 +0100
+++ cxref-1.6a/FILES 2006-02-25 18:15:23.000000000 +0100
@@ -102,3 +102,5 @@
cxref-1.6a/src/version.h
cxref-1.6a/src/warn-raw.c
cxref-1.6a/src/xref.c
+cxref-1.6a/src/utils.c
+cxref-1.6a/src/utils.h
diff -urN cxref-1.6a.old/src/cxref.c cxref-1.6a/src/cxref.c
--- cxref-1.6a.old/src/cxref.c 2006-02-25 16:59:33.000000000 +0100
+++ cxref-1.6a/src/cxref.c 2006-03-08 14:37:09.000000000 +0100
@@ -26,6 +26,7 @@
#include "memory.h"
#include "datatype.h"
#include "cxref.h"
+#include "utils.h"
/*+ The default value of the CPP command. +*/
#ifdef CXREF_CPP
@@ -106,7 +107,7 @@
{
int i;
char *root_prefix=NULL;
- char here[PATH_MAX+1],there[PATH_MAX+1];
+ char *here,*there;
if(argc==1)
Usage(1);
@@ -155,13 +156,15 @@
if(option_root)
{
- if(!getcwd(there,PATH_MAX))
+ there=my_get_current_dir_name ();
+ if(!there)
{fprintf(stderr,"cxref: Error cannot get current working directory
(1).\n");exit(1);}
if(chdir(option_root))
{fprintf(stderr,"cxref: Error cannot change directory to
'%s'.\n",option_root);exit(1);}
}
- if(!getcwd(here,PATH_MAX))
+ here=my_get_current_dir_name ();
+ if(!here)
{fprintf(stderr,"cxref: Error cannot get current working directory
(2).\n");exit(1);}
if(option_root)
@@ -174,6 +177,8 @@
root_prefix=there+strlen(here)+1;
else
{fprintf(stderr,"cxref: Error the -R option has not specified a parent
directory of the current one.\n");exit(1);}
+
+ Free(there);
}
/* Modify the -I options for the new root directory. */
@@ -228,6 +233,7 @@
option_incdirs[i]=MallocString(CanonicaliseName(option_incdirs[i]));
Free(old);
}
+ Free(here);
/* Parse the options in .cxref in the root directory. */
diff -urN cxref-1.6a.old/src/Makefile.in cxref-1.6a/src/Makefile.in
--- cxref-1.6a.old/src/Makefile.in 2006-02-25 16:59:33.000000000 +0100
+++ cxref-1.6a/src/Makefile.in 2006-02-25 16:51:46.000000000 +0100
@@ -91,7 +91,7 @@
########
-OBJ_FILES=func.o type.o var.o preproc.o comment.o file.o \
+OBJ_FILES=func.o type.o var.o preproc.o comment.o file.o utils.o \
slist.o memory.o \
xref.o \
warn-raw.o latex.o latex-style.o html.o html-style.o rtf.o sgml.o \
diff -urN cxref-1.6a.old/src/preproc.c cxref-1.6a/src/preproc.c
--- cxref-1.6a.old/src/preproc.c 2006-02-25 16:59:33.000000000 +0100
+++ cxref-1.6a/src/preproc.c 2006-03-08 14:32:24.000000000 +0100
@@ -28,6 +28,7 @@
#include "datatype.h"
#include "parse-yy.h"
#include "cxref.h"
+#include "utils.h"
/*+ The file that is currently being processed. +*/
extern File CurFile;
@@ -147,9 +148,12 @@
{
if(!cwd)
{
- cwd=(char*)Malloc(PATH_MAX+1);
- if(!getcwd(cwd,PATH_MAX))
- cwd[0]=0;
+ cwd=my_get_current_dir_name ();
+ if(!cwd)
+ {
+ cwd=Malloc(1);
+ cwd[0]=0;
+ }
}
/* Special gcc-3.x fake names for built-in #defines. */
diff -urN cxref-1.6a.old/src/utils.c cxref-1.6a/src/utils.c
--- cxref-1.6a.old/src/utils.c 1970-01-01 01:00:00.000000000 +0100
+++ cxref-1.6a/src/utils.c 2006-03-08 15:07:49.000000000 +0100
@@ -0,0 +1,56 @@
+/***************************************
+ $Header: /home/amb/cxref/src/RCS/cxref.h 1.30 1999/11/16 18:58:13 amb Exp $
+
+ C Cross Referencing & Documentation tool. Version 1.5c.
+
+ Utility functions.
+ ******************/ /******************
+ Written by Arnaud Fontaine
+
+ This file Copyright 2006 Arnaud Fontaine <[EMAIL PROTECTED]>
+ It may be distributed under the GNU Public License, version 2, or
+ any higher version. See section COPYING of the GNU Public license
+ for conditions under which this file may be redistributed.
+ ***************************************/
+
+#ifndef __GLIBC__
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include "utils.h"
+
+char *my_get_current_dir_name (void)
+{
+ char *pwd;
+ struct stat dotstat, pwdstat;
+ size_t size = CWD_CHUNK_SIZE;
+
+ pwd = getenv ("PWD");
+ if (pwd != NULL
+ && stat (".", &dotstat) == 0
+ && stat (pwd, &pwdstat) == 0
+ && pwdstat.st_dev == dotstat.st_dev
+ && pwdstat.st_ino == dotstat.st_ino)
+ /* The PWD value is correct. Use it. */
+ return strdup (pwd);
+
+ pwd = malloc (CWD_CHUNK_SIZE);
+ if (!pwd)
+ return NULL;
+
+ getcwd (pwd, CWD_CHUNK_SIZE);
+
+ /* Realloc until we have a big enough buffer. */
+ while (!pwd && (errno == ERANGE))
+ {
+ size += CWD_CHUNK_SIZE;
+ pwd = realloc (pwd, size);
+ }
+
+ return pwd;
+}
+#endif /* !__GLIBC__ */
diff -urN cxref-1.6a.old/src/utils.h cxref-1.6a/src/utils.h
--- cxref-1.6a.old/src/utils.h 1970-01-01 01:00:00.000000000 +0100
+++ cxref-1.6a/src/utils.h 2006-03-08 15:06:34.000000000 +0100
@@ -0,0 +1,30 @@
+/***************************************
+ $Header: /home/amb/cxref/src/RCS/cxref.h 1.30 1999/11/16 18:58:13 amb Exp $
+
+ C Cross Referencing & Documentation tool. Version 1.5c.
+
+ Prototypes for utility functions.
+ ******************/ /******************
+ Written by Arnaud Fontaine
+
+ This file Copyright 2006 Arnaud Fontaine <[EMAIL PROTECTED]>
+ It may be distributed under the GNU Public License, version 2, or
+ any higher version. See section COPYING of the GNU Public license
+ for conditions under which this file may be redistributed.
+ ***************************************/
+
+#ifndef UTILS_H
+#define UTILS_H
+
+#define CWD_CHUNK_SIZE 4096
+
+/* GLibc provides get_current_dir_name, which allows automatically the
+ right amount for cwd. If it's not available, use ours. */
+#ifdef __GLIBC_
+# include <unistd.h>
+# define my_get_current_dir_name get_current_dir_name
+#else
+char *my_get_current_dir_name (void);
+#endif /* !__GLIBC__ */
+
+#endif /* utils.h */
pgptYFzQjZtgt.pgp
Description: PGP signature

