Am 31.05.2013 10:47, schrieb Janus Weil:
Attached is a small patch with an alternative implementation (borrowed
from ada/terminals.c). It is not portable to all systems, but at least
it does actually work on my openSUSE box. Is this something we want to
have for gfortran?
# cat >term.c <<EOF
#include <sys/ioctl.h>
#include <stdio.h>
int main (void)
{
struct winsize w;
ioctl(0, TIOCGWINSZ, &w);
printf ("lines %d\n", w.ws_row);
printf ("columns %d\n", w.ws_col);
return 0;
}
EOF
# gcc term.c -o term
# at now <<EOF
term > term1.txt
EOF
# cat term1.txt
lines 63152
columns 55767
# at now <<EOF
term > term2.txt
EOF
# cat term2.txt
lines 24448
columns 22759
So this gives meaningless, varying numbers for me when
executing in non-interactive environment.
Perhaps cutting to some sane numbers is needed?
Or, simply leave the line wrapping to the terminal and
remove all this trimming code?
cheers,
Manfred