delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/02/09/15:11:22

From: cgf AT bbc DOT com (Christopher Faylor)
Subject: Re: getopt?
9 Feb 1998 15:11:22 -0800 :
Message-ID: <Eo4w9A.9Br.cygnus.cygwin32.developers@bbc.com>
References: <Eo4typ DOT 8rG AT bbc DOT com>
Reply-To: cygwin32-developers AT cygnus DOT com
To: cygwin32-developers AT cygnus DOT com

In article <199802092249 DOT RAA07090 AT subrogation DOT cygnus DOT com>,
Ian Lance Taylor  <cygwin32-developers AT cygnus DOT com> wrote:
>   From: cgf AT bbc DOT com (Christopher Faylor)
>   Date: Mon, 9 Feb 1998 22:18:25 GMT
>
>   This time, ld complained about the lack of a getopt_long in the "new"
>   version of getopt.  The Berkeley version doesn't have anything like
>   this, since it is, apparently, only an implementation of old-style
>   single character processing getopt.
>
>That's normal.  The GNU tools will use their own copy of getopt on all
>systems.  Attempting to optimize this is a bad idea, unless you go to
>some extra work to make sure the interface is correct.

Ok.  Then cygwin itself should not be attempting to use the GNU getopt
if it is not available.

>The advantage of putting getopt in cygwin would be for non GNU tools.

Ok.  I'd assumed that libiberty would not be including objects that it
didn't need, but I never inspected it too closely before.  I'm still
concerned that we're removing functionality that somebody may be using,
though.  It might be confusing to people moving from linux, too.

Here are the patches (I don't know if all of the opt* variables should be
exported but they were global, so...):

diff -c cygwin.din.orig cygwin.din
*** cygwin.din.orig	Mon Feb 09 18:04:44 1998
--- cygwin.din	Mon Feb 09 18:04:55 1998
***************
*** 942,944 ****
--- 942,950 ----
  dlsym
  dlerror
  dlfork
+ getopt
+ opterr
+ optind
+ optopt
+ optreset
+ optarg

diff -c include/getopt.h.orig include/getopt.h
*** include/getopt.h.orig	Mon Jan 19 14:48:12 1998
--- include/getopt.h	Mon Feb 09 16:52:25 1998
***************
*** 0 ****
--- 1,33 ----
+ /* getopt.h: Declarations for getopt
+ 
+    Copyright 1997, 1998 Cygnus Solutions.
+ 
+ This file is part of Cygwin32.
+ 
+ This software is a copyrighted work licensed under the terms of the
+ Cygwin32 license.  Please consult the file "CYGWIN32_LICENSE" for
+ details. */
+ 
+ #ifndef _GETOPT_H
+ #define _GETOPT_H
+ 
+ #ifdef	__cplusplus
+ extern "C" {
+ #endif
+ 
+ extern int *__imp_opterr, *__imp_optind, *__imp_optopt, *__imp_optreset;
+ char	**__imp_optarg;
+ 
+ #define opterr (*__imp_opterr)
+ #define optind (*__imp_optind)
+ #define optopt (*__imp_optopt)
+ #define optreset (*__imp_optreset)
+ #define optarg (*__imp_optarg)
+ 
+ int getopt(int, char * const *, const char *);
+ 
+ #ifdef	__cplusplus
+ }
+ #endif
+ 
+ #endif /* _GETOPT_H */
-- 
http://www.bbc.com/	cgf AT bbc DOT com			"Strange how unreal
VMS=>UNIX Solutions	Boston Business Computing	 the real can be."

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019