__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# 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
# Optarg -- string value of argument to current option
# Opterr -- if nonzero, print our own diagnostic
# Optopt -- current option letter
# Returns:
# -1 at end of options
# "?" for unrecognized option
# <s> a string representing the current option
# Private Data:
# _opti -- index in multiflag option, e.g., -abc
function getopt(argc, argv, options, longopts, thisopt, i, j)
{
if (length(options) == 0 && length(longopts) == 0)
return -1 # no options given
if (argv[Optind] == "--") { # all done
Optind++
_opti = 0
return -1
} else if (argv[Optind] !~ /^-[^:[:space:]]/) {
_opti = 0
return -1
}
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 thisopt
} else {
j = index(argv[Optind], "=")
if (j > 0)
thisopt = substr(argv[Optind], 3, j - 3)
else
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++
return thisopt
}
}
BEGIN {
Opterr = 1 # default is to diagnose
Optind = 1 # skip ARGV[0]
# test program
if (_getopt_test) {
_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])
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| assert.awk | File | 383 B | 0644 |
|
| bits2str.awk | File | 334 B | 0644 |
|
| cliff_rand.awk | File | 307 B | 0644 |
|
| ctime.awk | File | 234 B | 0644 |
|
| ftrans.awk | File | 315 B | 0644 |
|
| getopt.awk | File | 3.2 KB | 0644 |
|
| gettime.awk | File | 2.43 KB | 0644 |
|
| grcat.c | File | 976 B | 0644 |
|
| groupawk.in | File | 1.73 KB | 0644 |
|
| have_mpfr.awk | File | 221 B | 0644 |
|
| inplace.awk | File | 2.29 KB | 0644 |
|
| intdiv0.awk | File | 462 B | 0644 |
|
| isnumeric.awk | File | 284 B | 0644 |
|
| join.awk | File | 378 B | 0644 |
|
| libintl.awk | File | 238 B | 0644 |
|
| noassign.awk | File | 422 B | 0644 |
|
| ns_passwd.awk | File | 1.25 KB | 0644 |
|
| ord.awk | File | 937 B | 0644 |
|
| passwdawk.in | File | 1.18 KB | 0644 |
|
| processarray.awk | File | 355 B | 0644 |
|
| pwcat.c | File | 824 B | 0644 |
|
| quicksort.awk | File | 1.01 KB | 0644 |
|
| readable.awk | File | 489 B | 0644 |
|
| readfile.awk | File | 267 B | 0644 |
|
| rewind.awk | File | 404 B | 0644 |
|
| round.awk | File | 661 B | 0644 |
|
| shellquote.awk | File | 472 B | 0644 |
|
| strtonum.awk | File | 1.42 KB | 0644 |
|
| walkarray.awk | File | 214 B | 0644 |
|
| zerofile.awk | File | 424 B | 0644 |
|