remove dead code + fix strlen
long => unsigned long + remove printf
different calculation of buffer size (System V)