mirror of
https://github.com/20kdc/OC-KittenOS.git
synced 2024-11-23 19:08:05 +11:00
4a57c9f175
because apparently that's a dead meme now? Hmph.
21 lines
452 B
Lua
21 lines
452 B
Lua
-- PREPROC: preprocess input to be 7-bit
|
|
-- This is released into the public domain.
|
|
-- No warranty is provided, implied or otherwise.
|
|
|
|
while true do
|
|
local c = io.read(1)
|
|
if not c then return end
|
|
local bc = c:byte()
|
|
if bc < 127 then
|
|
io.write(c)
|
|
else
|
|
if bc <= 253 then
|
|
-- 127(0) through 253(126)
|
|
io.write("\x7F" .. string.char(bc - 127))
|
|
else
|
|
-- 254(0) through 255 (1)
|
|
io.write("\x7F\x7F" .. string.char(bc - 254))
|
|
end
|
|
end
|
|
end
|