Browse Source

Wrap <getopt.h> to make the functions weak and make access to the initialized

variables go direct.  (Common variables cannot be aliased.)
OPENBSD_5_9
guenther 8 years ago
parent
commit
2682fe544f
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      src/lib/libc/stdlib/getopt_long.c

+ 6
- 1
src/lib/libc/stdlib/getopt_long.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getopt_long.c,v 1.26 2013/06/08 22:47:56 millert Exp $ */
/* $OpenBSD: getopt_long.c,v 1.27 2015/09/12 14:48:14 guenther Exp $ */
/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */
/*
@ -61,6 +61,11 @@ int optopt = '?'; /* character checked for validity */
int optreset; /* reset getopt */
char *optarg; /* argument associated with option */
/* DEF_* only work on initialized (non-COMMON) variables */
DEF_WEAK(opterr);
DEF_WEAK(optind);
DEF_WEAK(optopt);
#define PRINT_ERROR ((opterr) && (*options != ':'))
#define FLAG_PERMUTE 0x01 /* permute non-options to the end of argv */


Loading…
Cancel
Save