[BACK]Return to patch-au CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / chat / icb / patches

File: [cvs.NetBSD.org] / pkgsrc / chat / icb / patches / patch-au (download)

Revision 1.7, Sat Nov 7 22:07:15 2015 UTC (8 years, 5 months ago) by dholland
Branch: MAIN
CVS Tags: pkgsrc-2024Q1-base, pkgsrc-2024Q1, pkgsrc-2023Q4-base, pkgsrc-2023Q4, pkgsrc-2023Q3-base, pkgsrc-2023Q3, pkgsrc-2023Q2-base, pkgsrc-2023Q2, pkgsrc-2023Q1-base, pkgsrc-2023Q1, pkgsrc-2022Q4-base, pkgsrc-2022Q4, pkgsrc-2022Q3-base, pkgsrc-2022Q3, pkgsrc-2022Q2-base, pkgsrc-2022Q2, pkgsrc-2022Q1-base, pkgsrc-2022Q1, pkgsrc-2021Q4-base, pkgsrc-2021Q4, pkgsrc-2021Q3-base, pkgsrc-2021Q3, pkgsrc-2021Q2-base, pkgsrc-2021Q2, pkgsrc-2021Q1-base, pkgsrc-2021Q1, pkgsrc-2020Q4-base, pkgsrc-2020Q4, pkgsrc-2020Q3-base, pkgsrc-2020Q3, pkgsrc-2020Q2-base, pkgsrc-2020Q2, pkgsrc-2020Q1-base, pkgsrc-2020Q1, pkgsrc-2019Q4-base, pkgsrc-2019Q4, pkgsrc-2019Q3-base, pkgsrc-2019Q3, pkgsrc-2019Q2-base, pkgsrc-2019Q2, pkgsrc-2019Q1-base, pkgsrc-2019Q1, pkgsrc-2018Q4-base, pkgsrc-2018Q4, pkgsrc-2018Q3-base, pkgsrc-2018Q3, pkgsrc-2018Q2-base, pkgsrc-2018Q2, pkgsrc-2018Q1-base, pkgsrc-2018Q1, pkgsrc-2017Q4-base, pkgsrc-2017Q4, pkgsrc-2017Q3-base, pkgsrc-2017Q3, pkgsrc-2017Q2-base, pkgsrc-2017Q2, pkgsrc-2017Q1-base, pkgsrc-2017Q1, pkgsrc-2016Q4-base, pkgsrc-2016Q4, pkgsrc-2016Q3-base, pkgsrc-2016Q3, pkgsrc-2016Q2-base, pkgsrc-2016Q2, pkgsrc-2016Q1-base, pkgsrc-2016Q1, pkgsrc-2015Q4-base, pkgsrc-2015Q4, HEAD
Changes since 1.6: +19 -1 lines

Work around lack of access() on OpenBSD.

$NetBSD: patch-au,v 1.7 2015/11/07 22:07:15 dholland Exp $

- use standard headers
- avoid implicit int
- build if NAME_MAX is missing (old Solaris?)
- build if access() and F_OK/R_OK/etc. are missing (OpenBSD)

--- icb/tcl.c.orig	1995-02-24 21:20:30.000000000 +0000
+++ icb/tcl.c
@@ -3,13 +3,14 @@
 
 /* TCL interface */
 
-#ifdef linux
+#include <limits.h>
+#if defined(linux) || defined(__sun)
 #include <unistd.h>
 #endif
 
 #include "icb.h"
 #include "externs.h"
-#include <sys/dir.h>
+#include <dirent.h>
 #include <sys/file.h>
 
 Tcl_Interp *interp;
@@ -92,10 +93,14 @@ tclinit()
 
 }
 
-tclreadicbrc()
+void tclreadicbrc(void)
 {
 	char *p, *path;
+#ifdef NAME_MAX
+	char cmd[NAME_MAX + 10];
+#else
 	char cmd[MAXNAMLEN+10];
+#endif
 	
 	if (!(path = getrcname())) return;
 
@@ -117,7 +122,11 @@ getrcname()
 {
 	static char *names[] = { ".icbrc", ".fnrc", ".tclrc" , (char *)NULL };
 	char *rcfile, *homedir, *getenv(), **p;
+#ifdef NAME_MAX
+	static char rcpath[NAME_MAX + 1];
+#else
 	static char rcpath[MAXNAMLEN+1];	/* path of startup file */
+#endif
 
 	/* get name of file to use */
 	if (((rcfile = getenv("ICBRC")) != NULL)
@@ -135,10 +144,12 @@ getrcname()
 		}
 
 		/* make sure the file is there */
+#if defined(F_OK) && defined(R_OK)
 		if (access(rcfile, (F_OK | R_OK)) < 0) {
 			printf("icb: can't read rc file \"%s\".\r\n", rcfile);
 			return(NULL);
 		}
+#endif
 
 		return rcfile;
 	}