* Re: numeric brace expansion
[not found] <9506051739.AA28868@offenbach.sbi.com>
@ 1995-06-06 9:42 ` P.Stephenson
1995-06-06 18:54 ` Richard Coleman
0 siblings, 1 reply; 3+ messages in thread
From: P.Stephenson @ 1995-06-06 9:42 UTC (permalink / raw)
To: Zsh hackers list
On undefining HAVE_STRTOL on machines that do have strtol():
mcampbel@schubert.sbi.com wrote:
> gcc -c -I.. -I. -I. -DCONFIG_BROKETS -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmi
> ssing-prototypes -O2 builtin.c
> In file included from zsh.h:1013,
> from builtin.c:32:
> prototypes.h:125: conflicting types for `strtol'
> /optware/unsupported/lib/gcc-lib/sparc-sun-solaris2.3/2.6.3/include/stdlib.h:
> 75: previous declaration of `strtol'
> *** Error code 1
> make: Fatal error: Command failed for target `builtin.o'
> Current working directory /export/local/ftp/zsh-2.6-beta9/Src
> *** Error code 1
You should be able to fix this just by altering prototypes.h and
compat.c to add a `const' to the first argument of strtol(), which is
what gcc is worried about: it doesn't really care if the const is
there or not, but if it is in one prototype it needs to be there in
any other. I think the following is the ANSI/ISO prototype anyway,
but it looks like the zsh code avoids using `const' in prototypes
probably to avoid breaking older compilers. Does ansi2knr not handle
const's? We could always do the
#ifdef __STDC__
#define CONST const
#else
#define CONST
#endif
trick.
*** Src/prototypes.h~ Wed May 31 05:09:46 1995
--- Src/prototypes.h Tue Jun 6 10:32:32 1995
***************
*** 122,128 ****
/**************************************************/
/*** prototypes for functions built in compat.c ***/
#ifndef HAVE_STRTOL
! extern long strtol _((char *s, char **t, int base));
#endif
#ifndef HAVE_STRSTR
--- 122,128 ----
/**************************************************/
/*** prototypes for functions built in compat.c ***/
#ifndef HAVE_STRTOL
! extern long strtol _((const char *s, char **t, int base));
#endif
#ifndef HAVE_STRSTR
*** Src/compat.c~ Wed May 31 05:10:08 1995
--- Src/compat.c Tue Jun 6 10:35:14 1995
***************
*** 35,41 ****
#ifndef HAVE_STRTOL
long
! strtol(char *s, char **t, int base)
{
long ret = 0;
--- 35,41 ----
#ifndef HAVE_STRTOL
long
! strtol(const char *s, char **t, int base)
{
long ret = 0;
--
Peter Stephenson <P.Stephenson@swansea.ac.uk> Tel: +44 1792 205678 extn. 4461
WWW: http://python.swan.ac.uk/~pypeters/ Fax: +44 1792 295324
Department of Physics, University of Wales, Swansea,
Singleton Park, Swansea, SA2 8PP, U.K.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: numeric brace expansion
1995-06-06 9:42 ` numeric brace expansion P.Stephenson
@ 1995-06-06 18:54 ` Richard Coleman
0 siblings, 0 replies; 3+ messages in thread
From: Richard Coleman @ 1995-06-06 18:54 UTC (permalink / raw)
To: zsh-workers
> You should be able to fix this just by altering prototypes.h and
> compat.c to add a `const' to the first argument of strtol(), which is
> what gcc is worried about: it doesn't really care if the const is
> there or not, but if it is in one prototype it needs to be there in
> any other. I think the following is the ANSI/ISO prototype anyway,
> but it looks like the zsh code avoids using `const' in prototypes
> probably to avoid breaking older compilers. Does ansi2knr not handle
> const's? We could always do the
>
> #ifdef __STDC__
> #define CONST const
> #else
> #define CONST
> #endif
I already have configure (autoconf) set to check whether a
system's compiler supports const. If a system doesn't support
const, then config.h will define const to empty.
So using const in the zsh code shouldn't cause any portability
problems. It might be useful to add const some of the string
handling functions in zsh.
Richard Coleman
zsh@math.gatech.edu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: numeric brace expansion
@ 1995-06-05 22:12 Marek Andricik
0 siblings, 0 replies; 3+ messages in thread
From: Marek Andricik @ 1995-06-05 22:12 UTC (permalink / raw)
To: zsh-workers
Richard Coleman wrote:
>
> > This doesn't work at all for me.
> > >echo {01..03}
> > . 0 1 3
> >
> > I figure there has to be some option I haven't set. Could someone clue
> > me in here?
>
> This is broken on both beta8/beta9 (and maybe beta7). It will
> be fixed in beta10 (by the end of the week). To fix this now,
> you should be able to undefine HAVE_STRTOL in config.h and recompile.
>
Hmm, it does not look broken on Ultrix (on SunOS it is). It does
what it should (at least what I think it should).
hron% echo $ZSH_VERSION
2.6-beta9
hron% echo {1..20}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Leading zeroes work too.
Bye, Marek
--
Marek Andricik, nick Nevedko
andricik@hron.ef.tuke.sk, andricik@derpi.tuwien.ac.at
... theyJustTakeCareOfNumberOneAndNumberOneAintYouYouAintEvenNumberTwo
[FrankZappa]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1995-06-06 19:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <9506051739.AA28868@offenbach.sbi.com>
1995-06-06 9:42 ` numeric brace expansion P.Stephenson
1995-06-06 18:54 ` Richard Coleman
1995-06-05 22:12 Marek Andricik
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).