Gnu cat.c

>gnu cat.c
>768 lines
>openbsd cat.c
>250 lines

Remind me again, why does *NU even exist?

Attached: 1515512591510.png (483x470, 184K)

Other urls found in this thread:

gnu.org/software/coreutils/manual/html_node/cat-invocation.html
nixdoc.net/man-pages/FreeBSD/man1/cat.1.html
twitter.com/NSFWRedditImage

>Counting comments in the line count
Also plan9 cat is 30-something lines so it must be the best

Because you can actually use it for things

It literally is.

I'm pretty sure I could use python to do that in like 2 lines? C is an awful language.

k

2 lines of Python code that calls into 2000 lines of standard library code.

One line in bash:
cat "$@"

gas all frogposters.

>openbsd cat.c
>250 lines
>plan 9 cat.c
>35 lines
Remind me again, why goes *SD STILL exist?

Attached: 1536720884334s.jpg (250x191, 6K)

not only frogposter but also phoneposter

>calling cat at the terminal
pepe.jpg

That's because GNU cat is more feature rich, has better and more extensive code optimization.
You are a fucking retard.

except the fact that python wouldn't exist without c

where are the evidences for your claim???

Wow it's almost like GNU/cat might have different or more functionality

>What is jython
>What is ironpython
>What is pypy

In the source code. It's less than 1000 lines, trivial to inspect.

Insults to God.

how is he a phoneposter?

Attached: jelly_think.gif (450x450, 1.23M)

>a program designed for conCATenation needs to do more than that
can't wait until cat can read my email

autocorrect, ya dip

Plan 9 has no good browsers

if you remove double newlines (reddit spacing) gnu cat is 631 lines, and most of the rest are comments.

>plan9 cat.c
>35 lines
>my cat.c
>18 lines

#include
#include
int main(int argc char *argv[])
{
FILE *f;
int i;
char c;

for(i = 0;i < argc;++i) {
f = fopen(argv[i]);
if(f != NULL) {
while((c = fgetc(f)) != EOF)
printf("%c", c);
fclose(f);
}
}
return 0;
}

> no commas between arguments
> no indentation
> opens argv[0]
> doesn't open while loop properly

no wonder it's so small

#include
#include
int main(int argc, char *argv[])
{
FILE *f;
int i;
char c;

for(i = 1;i < argc;++i) {
f = fopen(argv[i], "r");
if(f != NULL) {
while((c = fgetc(f)) != EOF)
printf("%c", c);
fclose(f);
}
}
return 0;
}


Compiles and is valid C code. You also don't need brackets in a while for a single line and there is indentation if you weren't blind or on a phone.

Those two lines just call a bunch of other code

And in the end, it's probably C code that's doing all the work. Compiled, but still.

Triggered

>reading and printing each character of a file one at a time
Wow I bet it has great performance. GNU cat BTFO.

This isn't the 80s anymore. Buy better toaster ovens, Ivan.

more features and better optimizations

doesn't handle nofile and - file for stdin

Those are bloat features that aren't needed ;)

this

I'm sure all these autists didn't forget the command line params.
gnu.org/software/coreutils/manual/html_node/cat-invocation.html
nixdoc.net/man-pages/FreeBSD/man1/cat.1.html

Attached: judgingyou.png (672x787, 964K)

see

*sip* I'm also sure they are judging the actual lines of code, not just piping it into a basic tool like wc.
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
BSD cat 1 29 60 309
GNU cat 1 136 147 484
-------------------------------------------------------------------------------

Attached: smug.jpg (680x661, 77K)

>>plan9 cat.c
lines
>>my cat.c
lines
>#include
>#include
>int main(int argc char *argv[])
>{
> FILE *f;
> int i;
> char c;
>
> for(i = 0;i < argc;++i) {
> f = fopen(argv[i]);
> if(f != NULL) {
> while((c = fgetc(f)) != EOF)
> printf("%c", c);
> fclose(f);
> }
> }
> return 0;
>}

Not using int for c ...

More like plan 9 has no browsers at all.

>having a consistent interface is bloat
i bet you think --help is bloat too because those dumbass users should just read the man page

why make a man page if you're going to include a --help?

GNU cat is quality code, fast and efficient (reading chunks, etc.). BSD cat is simple and lightweight, but also slower.

ok I guess you can use anonymous pipe instead of - and without any flags the nofile is useless, fair enough

still slow and depending on C
And I say this as a C hater.

what

6/10

Besides what said it also doesn't check for valid amount of arguments nor returns a specific error if the file cannot be opened/does not exist.
Also you don't even print a newline between each file in case of multiple arguments, risking garbled output.

why not just rewriting it in Haskell?

>why have more than one tutorial/example for my program, there is only one valid use case anyway
>why translate my program into other languages, everyone should just learn english
>etc

>Also you don't even print a newline between each file in case of multiple arguments, risking garbled output.
wtf? so you want a newline out of nowhere when concatenating two binary files?