I'm have a big problem with one of the C programs that I'm developping.
actually, I'm trying to monitor the users' session in solaris.
therefore, I have used the source code of the unix "script" command. but the problem is that, when i run that program, the stty settings are lost:
speed 38400 baud; -parity
erase = ^h; swtch = <undef>;
brkint -inpck -istrip icrnl -ixany imaxbel onlcr tab3
echo echoe echok echoctl echoke iexten
However, before executing it, it was like this:
speed 38400 baud; -parity
rows = 50; columns = 132; ypixels = 0; xpixels = 0;
erase = ^h; swtch = <undef>;
brkint -inpck -istrip icrnl -ixany imaxbel onlcr tab3
echo echoe echok echoctl echoke iexten
This is actually resulting in having problems while trying to edit any file with VI editor or view it with the "less" command...
so, can anyone help me on how to get set the rows and columns size from inside the C program?
thank you in advance.
Regards,
Saad
You can save your tty's values with stty -g, then restore them by giving stty that same output on the commandline. How to do this in C is a trickier question if you don't feel like using system(), since there's a lot of ioctl calls involved. You could run strace on stty to see what calls its making to get the values and set the values, though sometimes it might print ambiguous statements due to ioctls meaning different things on different kinds of files.
Thanks for your precious help.
However, I could mange monitoring of user sessions using the screen tool, it is much more sophisticated that the script tool :).