zsh-workers
 help / color / mirror / code / Atom feed
From: River Tarnell <river@wikimedia.org>
To: zsh-workers@sunsite.dk
Subject: [PATCH] 4.3.5 build fails on SunOS 4.1.4
Date: Mon, 3 Mar 2008 04:58:15 +0000	[thread overview]
Message-ID: <1282467763.20080303045815@wikimedia.org> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 679 bytes --]

this platform doesn't provide strtoul(), and zsh has no compat.c
replacement.  the patch (attached) provides one from NetBSD sources
(which i believe has a liberal enough license to be included in zsh).

there are two remaining problems, but i have no idea where to start
on either of them:

 + unless compiled with --disable-dynamic, any attempt to use
   completion-related features crashes the shell with 'Undefined
   symbol: _incompfunc'

 + job control doesn't work properly.  while typing ^Z in 'vi'
   works fine, in 'vim', the program immediately resumes, rather
   than returning to the shell.  both work fine with the system
   'csh'.

        - river.

[-- Attachment #1.2: zsh-sunos.diff --]
[-- Type: application/octet-stream, Size: 3981 bytes --]

*** configure.ac.old	Fri Feb  1 11:22:22 2008
--- configure.ac	Mon Mar  3 04:35:04 2008
***************
*** 1174,1180 ****
  	       getlogin getpwent getpwnam getpwuid getgrgid getgrnam \
  	       initgroups nis_list \
  	       setuid seteuid setreuid setresuid setsid \
! 	       memcpy memmove strstr strerror \
  	       getrlimit getrusage \
  	       setlocale \
  	       uname \
--- 1174,1180 ----
  	       getlogin getpwent getpwnam getpwuid getgrgid getgrnam \
  	       initgroups nis_list \
  	       setuid seteuid setreuid setresuid setsid \
! 	       memcpy memmove strstr strerror strtoul \
  	       getrlimit getrusage \
  	       setlocale \
  	       uname \
*** Src/compat.c.old	Tue Jul 18 10:17:11 2006
--- Src/compat.c	Mon Mar  3 03:40:28 2008
***************
*** 448,450 ****
--- 448,552 ----
  }
  /**/
  #endif /* ZSH_64_BIT_TYPE */
+ 
+ #ifndef HAVE_STRTOUL
+ 
+ /*
+  * Copyright (c) 1990, 1993
+  *	The Regents of the University of California.  All rights reserved.
+  *
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  * 1. Redistributions of source code must retain the above copyright
+  *    notice, this list of conditions and the following disclaimer.
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in the
+  *    documentation and/or other materials provided with the distribution.
+  * 3. Neither the name of the University nor the names of its contributors
+  *    may be used to endorse or promote products derived from this software
+  *    without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  * SUCH DAMAGE.
+  */
+ 
+ /*
+  * Convert a string to an unsigned long integer.
+  *
+  * Ignores `locale' stuff.  Assumes that the upper and lower case
+  * alphabets and digits are each contiguous.
+  */
+ unsigned long
+ strtoul(nptr, endptr, base)
+ 	const char *nptr;
+ 	char **endptr;
+ 	int base;
+ {
+ 	const char *s;
+ 	unsigned long acc, cutoff;
+ 	int c;
+ 	int neg, any, cutlim;
+ 
+ 	/* endptr may be NULL */
+ 
+ 	s = nptr;
+ 	do {
+ 		c = (unsigned char) *s++;
+ 	} while (isspace(c));
+ 	if (c == '-') {
+ 		neg = 1;
+ 		c = *s++;
+ 	} else {
+ 		neg = 0;
+ 		if (c == '+')
+ 			c = *s++;
+ 	}
+ 	if ((base == 0 || base == 16) &&
+ 	    c == '0' && (*s == 'x' || *s == 'X')) {
+ 		c = s[1];
+ 		s += 2;
+ 		base = 16;
+ 	}
+ 	if (base == 0)
+ 		base = c == '0' ? 8 : 10;
+ 
+ 	cutoff = ULONG_MAX / (unsigned long)base;
+ 	cutlim = (int)(ULONG_MAX % (unsigned long)base);
+ 	for (acc = 0, any = 0;; c = (unsigned char) *s++) {
+ 		if (isdigit(c))
+ 			c -= '0';
+ 		else if (isalpha(c)) {
+ 			c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+ 		} else
+ 			break;
+ 		if (c >= base)
+ 			break;
+ 		if (any < 0)
+ 			continue;
+ 		if (acc > cutoff || (acc == cutoff && c > cutlim)) {
+ 			any = -1;
+ 			acc = ULONG_MAX;
+ 			errno = ERANGE;
+ 		} else {
+ 			any = 1;
+ 			acc *= (unsigned long)base;
+ 			acc += c;
+ 		}
+ 	}
+ 	if (neg && any > 0)
+ 		acc = -acc;
+ 	if (endptr != NULL)
+ 		*endptr = any ? s - 1 : nptr;
+ 	return (acc);
+ }
+ #endif

[-- Attachment #2: Type: application/pgp-signature, Size: 183 bytes --]

             reply	other threads:[~2008-03-03  4:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-03  4:58 River Tarnell [this message]
2008-03-03 12:36 ` Peter Stephenson
2008-03-03 17:31   ` Vin Shelton

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=1282467763.20080303045815@wikimedia.org \
    --to=river@wikimedia.org \
    --cc=zsh-workers@sunsite.dk \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).