pete / cats Goto Github PK
View Code? Open in Web Editor NEWImplementations of cat(1) from various sources.
Implementations of cat(1) from various sources.
Here, placed side-by-side for comparison, are GNU's implementation of cat, Plan 9's implementation, Busybox's implementation, and NetBSD's implementation, Seventh Edition Unix (1979), Tenth Edition Unix (1989), and 4.3BSD. For good measure (and because I suppose I am now committed to collecting cats) also included are Second Edition Unix (in assembly) and Inferno's implementation (in Limbo). All cat.c files (renamed by prefixing the name of the source source) are presented, unaltered and in their entirety. Note how easy it is to read and understand plan9-cat.c (it should take less than a couple of minutes possibly even for coders that don't know C). Other than that, I think the files speak for themselves. Keep in mind while reading that the cat utility's purpose is to concatenate files. Lastly, here are the line and character counts, sorted: Lines Chars Filename --------------------------- 35 531 plan9-cat.c 48 955 busybox-cat.c 48 986 inferno-cat.b 63 1130 unix7-cat.c 64 646 unix2-cat.s 69 1241 unix10-cat.c 222 3948 4.3bsd-cat.c 316 6952 netbsd-cat.c 782 22684 gnu-cat.c 1647 39073 total
Hi!
I'm wondering if you've come across a cat
implementation that produces cat -v
output that can be uniquely reversed back to the original. It may not be a historical version, but if you have looked into these cats extensively, you may have come across this functionality.
I stumbled upon a project that did just that about a year or two ago, found it interesting, but despite repeatedly combing the web for this (by searching for terms like "invertible", "reversible", "bijective", etc), I can't seem to find it again. It may have been BSD based.
By cat -v
, I mean at a high level turning unprintable characters into escaped ones, coded in ASCII. I often do just that, but it would be a nice plus to get back the original should I want it.
In the plan9 version of cat, it has
argv0 = "cat";
but argv0
is never defined nor used for anything. Was this copied correctly from the source? I suspect it was supposed to be argv[0]
to set the filename. (I don't have plan9 sources at hand to check)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.