K2LL33D SHELL

 Apache/2.4.7 (Ubuntu)
 Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64
 uid=33(www-data) gid=33(www-data) groups=33(www-data)
 safemode : OFF
 MySQL: ON | Perl: ON | cURL: OFF | WGet: ON
  >  / usr / share / awk /
server ip : 172.67.156.115

your ip : 108.162.216.221

H O M E


Filename/usr/share/awk/ord.awk
Size937
Permissionrw-r--r--
Ownerroot : root
Create time27-Apr-2025 09:55
Last modified03-Jul-2013 04:42
Last accessed05-Jul-2025 20:48
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
# ord.awk --- do ord and chr

# Global identifiers:
# _ord_: numerical values indexed by characters
# _ord_init: function to initialize _ord_
#
# Arnold Robbins, [email protected], Public Domain
# 16 January, 1992
# 20 July, 1992, revised

BEGIN { _ord_init() }

function _ord_init( low, high, i, t)
{
low = sprintf("%c", 7) # BEL is ascii 7
if (low == "\a") { # regular ascii
low = 0
high = 127
} else if (sprintf("%c", 128 + 7) == "\a") {
# ascii, mark parity
low = 128
high = 255
} else { # ebcdic(!)
low = 0
high = 255
}

for (i = low; i <= high; i++) {
t = sprintf("%c", i)
_ord_[t] = i
}
}
function ord(str, c)
{
# only first character is of interest
c = substr(str, 1, 1)
return _ord_[c]
}

function chr(c)
{
# force c to be numeric by adding 0
return sprintf("%c", c + 0)
}