shortshort way of reversing the lines in a file

Andrew Scott Beals bandy at lll-crg.UUCP
Sun Sep 1 11:05:58 AEST 1985


Recently, some Gentleman from the UK posted a program that reversed
the lines in a file. I figured that I should post this somewhat 
shorter solution.

----cute here, huh?----
/*
 * mirror the recursive way
 *
 */

#include <stdio.h>

main() {
    char	foo[BUFSIZ];

    if(gets(foo) == NULL) return;
    main();
    puts(foo);
}
----better cut here too----
At least I thought it was cute.

Disclaimer: this program has very little to do with what they
do here at Livermore.



More information about the Comp.sources.unix mailing list