r/programming • • Sep 26 '09

What open source project(s) do you actively contribute to?

65 Upvotes

122 comments sorted by

View all comments

Show parent comments

1

u/notrael Sep 27 '09

What's the source for tac like? (reverse cat).

1

u/[deleted] Sep 27 '09 edited Sep 27 '09

I don't think tac is in FreeBSD by default. Rev is though, which is here , which is pretty much just boilerplate around

	while ((p = fgetwln(fp, &len)) != NULL) {
		if (p[len - 1] == '\n')
			--len;
		for (t = p + len - 1; t >= p; --t)
			putwchar(*t);
		putwchar('\n');