Hi Manfred, >> 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.
Huh, funny. For me it works nicely. Does this also happen if you if gate your code by #ifdef TIOCGWINSZ as done in my patch? What operating system are you on? > Perhaps cutting to some sane numbers is needed? Possibly. > Or, simply leave the line wrapping to the terminal and > remove all this trimming code? This is what we do with the actual error messages. I think the reason why the trimming is done for the source lines is that it is harder to follow the locus markers (i.e. "... error at (1) ...") if the source line is wrapped. Cheers, Janus