Delete util/getopt.h

util/getopt.h:
    Delete this file.

util/Mmakefile:
    Pass -I../getopt to the C compiler.

util/mkinit.c:
util/mkinit_erl.c:
    Include either <unistd.h> or ../getopt/getopt.h for the declaration
    of getopt(). We don't include both in case there may be conflicting
    declarations of getopt() on some system.
This commit is contained in:
Peter Wang
2019-06-10 13:30:51 +10:00
parent 544f3bf095
commit ac29292e9a
4 changed files with 5 additions and 33 deletions

View File

@@ -18,8 +18,7 @@ include $(MERCURY_DIR)/Mmake.common
#-----------------------------------------------------------------------------#
# We need -I$(RUNTIME_DIR) for "mercury_std.h", etc.
CFLAGS = -I$(RUNTIME_DIR)
CFLAGS = -I$(RUNTIME_DIR) -I../getopt
PROGS=mkinit mkinit_erl mdemangle mfiltercc info_to_mdb
PROGFILENAMES=$(PROGS:%=%$(EXT_FOR_EXE))

View File

@@ -1,30 +0,0 @@
/*
** Copyright (C) 1993-1997 The University of Melbourne.
** This file may only be copied under the terms of the GNU Library General
** Public License - see the file COPYING.LIB in the Mercury distribution.
*/
/*
** mercury_getopt.h - declares the interface to the system function getopt()
**
** We use this file rather than the system's <getopt.h>
** because different systems have different ideas about
** where the `const's should go on the declaration of getopt().
** Also, some systems might have getopt() but not <getopt.h>.
** According to POSIX, getopt() is declared in <unistd.h>.
*/
#ifndef MERCURY_UTIL_GETOPT_H
#define MERCURY_UTIL_GETOPT_H
#define GETOPTHUH '?'
#define GETOPTDONE (-1)
extern int getopt(int, char *const*, const char *);
extern char *optarg;
extern int opterr;
extern int optind;
extern int optopt;
#endif /* not MERCURY_UTIL_GETOPT_H */

View File

@@ -39,7 +39,6 @@
/* mercury_std.h includes mercury_regs.h, and must precede system headers */
#include "mercury_conf.h"
#include "mercury_std.h"
#include "getopt.h"
#include "mercury_array_macros.h"
#include "mkinit_common.h"
@@ -55,6 +54,8 @@
#ifdef MR_HAVE_UNISTD_H
#include <unistd.h>
#else
#include "getopt.h"
#endif
/* --- adjustable limits --- */

View File

@@ -52,6 +52,8 @@
#ifdef MR_HAVE_UNISTD_H
#include <unistd.h>
#else
#include "getopt.h"
#endif
typedef enum