mirror of
https://github.com/Gator96100/ProxSpace.git
synced 2025-08-19 21:03:25 -07:00
Updated msys2 to msys2-base-x86_64-20200903
This commit is contained in:
parent
5bc8dbdc75
commit
2307d54cb1
18501 changed files with 1684082 additions and 720361 deletions
|
@ -1,9 +1,11 @@
|
|||
# getopt.awk --- Do C library getopt(3) function in awk
|
||||
# Also supports long options.
|
||||
#
|
||||
# Arnold Robbins, arnold@skeeve.com, Public Domain
|
||||
#
|
||||
# Initial version: March, 1991
|
||||
# Revised: May, 1993
|
||||
# Long options added by Greg Minshall, January 2020
|
||||
|
||||
# External variables:
|
||||
# Optind -- index in ARGV of first nonoption argument
|
||||
|
@ -14,14 +16,14 @@
|
|||
# Returns:
|
||||
# -1 at end of options
|
||||
# "?" for unrecognized option
|
||||
# <c> a character representing the current option
|
||||
# <s> a string representing the current option
|
||||
|
||||
# Private Data:
|
||||
# _opti -- index in multiflag option, e.g., -abc
|
||||
function getopt(argc, argv, options, thisopt, i)
|
||||
function getopt(argc, argv, options, longopts, thisopt, i, j)
|
||||
{
|
||||
if (length(options) == 0) # no options given
|
||||
return -1
|
||||
if (length(options) == 0 && length(longopts) == 0)
|
||||
return -1 # no options given
|
||||
|
||||
if (argv[Optind] == "--") { # all done
|
||||
Optind++
|
||||
|
@ -31,36 +33,61 @@ function getopt(argc, argv, options, thisopt, i)
|
|||
_opti = 0
|
||||
return -1
|
||||
}
|
||||
if (_opti == 0)
|
||||
_opti = 2
|
||||
thisopt = substr(argv[Optind], _opti, 1)
|
||||
Optopt = thisopt
|
||||
i = index(options, thisopt)
|
||||
if (i == 0) {
|
||||
if (Opterr)
|
||||
printf("%c -- invalid option\n", thisopt) > "/dev/stderr"
|
||||
if (_opti >= length(argv[Optind])) {
|
||||
if (argv[Optind] !~ /^--/) { # if this is a short option
|
||||
if (_opti == 0)
|
||||
_opti = 2
|
||||
thisopt = substr(argv[Optind], _opti, 1)
|
||||
Optopt = thisopt
|
||||
i = index(options, thisopt)
|
||||
if (i == 0) {
|
||||
if (Opterr)
|
||||
printf("%c -- invalid option\n", thisopt) > "/dev/stderr"
|
||||
if (_opti >= length(argv[Optind])) {
|
||||
Optind++
|
||||
_opti = 0
|
||||
} else
|
||||
_opti++
|
||||
return "?"
|
||||
}
|
||||
if (substr(options, i + 1, 1) == ":") {
|
||||
# get option argument
|
||||
if (length(substr(argv[Optind], _opti + 1)) > 0)
|
||||
Optarg = substr(argv[Optind], _opti + 1)
|
||||
else
|
||||
Optarg = argv[++Optind]
|
||||
_opti = 0
|
||||
} else
|
||||
Optarg = ""
|
||||
if (_opti == 0 || _opti >= length(argv[Optind])) {
|
||||
Optind++
|
||||
_opti = 0
|
||||
} else
|
||||
_opti++
|
||||
return "?"
|
||||
}
|
||||
if (substr(options, i + 1, 1) == ":") {
|
||||
# get option argument
|
||||
if (length(substr(argv[Optind], _opti + 1)) > 0)
|
||||
Optarg = substr(argv[Optind], _opti + 1)
|
||||
return thisopt
|
||||
} else {
|
||||
j = index(argv[Optind], "=")
|
||||
if (j > 0)
|
||||
thisopt = substr(argv[Optind], 3, j - 3)
|
||||
else
|
||||
Optarg = argv[++Optind]
|
||||
_opti = 0
|
||||
} else
|
||||
Optarg = ""
|
||||
if (_opti == 0 || _opti >= length(argv[Optind])) {
|
||||
thisopt = substr(argv[Optind], 3)
|
||||
Optopt = thisopt
|
||||
i = match(longopts, "(^|,)" thisopt "($|[,:])")
|
||||
if (i == 0) {
|
||||
if (Opterr)
|
||||
printf("%s -- invalid option\n", thisopt) > "/dev/stderr"
|
||||
Optind++
|
||||
return "?"
|
||||
}
|
||||
if (substr(longopts, i+1+length(thisopt), 1) == ":") {
|
||||
if (j > 0)
|
||||
Optarg = substr(argv[Optind], j + 1)
|
||||
else
|
||||
Optarg = argv[++Optind]
|
||||
} else
|
||||
Optarg = ""
|
||||
Optind++
|
||||
_opti = 0
|
||||
} else
|
||||
_opti++
|
||||
return thisopt
|
||||
return thisopt
|
||||
}
|
||||
}
|
||||
BEGIN {
|
||||
Opterr = 1 # default is to diagnose
|
||||
|
@ -68,12 +95,13 @@ BEGIN {
|
|||
|
||||
# test program
|
||||
if (_getopt_test) {
|
||||
while ((_go_c = getopt(ARGC, ARGV, "ab:cd")) != -1)
|
||||
printf("c = <%c>, Optarg = <%s>\n",
|
||||
_go_c, Optarg)
|
||||
_myshortopts = "ab:cd"
|
||||
_mylongopts = "longa,longb:,otherc,otherd"
|
||||
|
||||
while ((_go_c = getopt(ARGC, ARGV, _myshortopts, _mylongopts)) != -1)
|
||||
printf("c = <%s>, Optarg = <%s>\n", _go_c, Optarg)
|
||||
printf("non-option arguments:\n")
|
||||
for (; Optind < ARGC; Optind++)
|
||||
printf("\tARGV[%d] = <%s>\n",
|
||||
Optind, ARGV[Optind])
|
||||
printf("\tARGV[%d] = <%s>\n", Optind, ARGV[Optind])
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# inplace --- load and invoke the inplace extension.
|
||||
#
|
||||
# Copyright (C) 2013, 2017 the Free Software Foundation, Inc.
|
||||
# Copyright (C) 2013, 2017, 2019 the Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GAWK, the GNU implementation of the
|
||||
# AWK Programming Language.
|
||||
|
@ -25,16 +25,21 @@
|
|||
# Revised for namespaces
|
||||
# Arnold Robbins, arnold@skeeve.com
|
||||
# July 2017
|
||||
# June 2019, add backwards compatibility
|
||||
|
||||
@load "inplace"
|
||||
|
||||
# Please set inplace::suffix to make a backup copy. For example, you may
|
||||
# want to set inplace::suffix to .bak on the command line or in a BEGIN rule.
|
||||
|
||||
# Before there were namespaces in gawk, this extension used
|
||||
# INPLACE_SUFFIX as the variable for making backup copies. We allow this
|
||||
# too, so that any code that used the previous version continues to work.
|
||||
|
||||
# By default, each filename on the command line will be edited inplace.
|
||||
# But you can selectively disable this by adding an inplace=0 argument
|
||||
# But you can selectively disable this by adding an inplace::enable=0 argument
|
||||
# prior to files that you do not want to process this way. You can then
|
||||
# reenable it later on the commandline by putting inplace=1 before files
|
||||
# reenable it later on the commandline by putting inplace::enable=1 before files
|
||||
# that you wish to be subject to inplace editing.
|
||||
|
||||
# N.B. We call inplace::end() in the BEGINFILE and END rules so that any
|
||||
|
@ -47,15 +52,16 @@ BEGIN {
|
|||
}
|
||||
|
||||
BEGINFILE {
|
||||
sfx = (suffix ? suffix : awk::INPLACE_SUFFIX)
|
||||
if (filename != "")
|
||||
end(filename, suffix)
|
||||
end(filename, sfx)
|
||||
if (enable)
|
||||
begin(filename = FILENAME, suffix)
|
||||
begin(filename = FILENAME, sfx)
|
||||
else
|
||||
filename = ""
|
||||
}
|
||||
|
||||
END {
|
||||
if (filename != "")
|
||||
end(filename, suffix)
|
||||
end(filename, (suffix ? suffix : awk::INPLACE_SUFFIX))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue