Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F13755660
test.c
0.gangzta_gmail.com (Soumendra Ganguly)
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
0.gangzta_gmail.com
Dec 17 2020, 4:53 AM
2020-12-17 04:53:55 (UTC+0)
Size
820 B
Referenced Files
None
Subscribers
None
test.c
View Options
#include
<stdio.h>
#include
<termios.h>
int
main
()
{
struct
winsize
w
,
y
;
printf
(
"getting winsize
\n
"
);
if
(
tcgetwinsize
(
0
,
&
w
)
==
-1
)
{
printf
(
"error: tcgetwinsize
\n
"
);
return
-1
;
}
y
=
w
;
printf
(
"winsize: %d %d %d %d
\n
"
,
w
.
ws_row
,
w
.
ws_col
,
w
.
ws_xpixel
,
w
.
ws_ypixel
);
w
.
ws_row
/=
5
;
w
.
ws_col
/=
5
;
w
.
ws_xpixel
/=
5
;
w
.
ws_ypixel
/=
5
;
printf
(
"setting winsize to 1/5 of all members
\n
"
);
if
(
tcsetwinsize
(
0
,
&
w
)
==
-1
)
{
printf
(
"error: tcsetwinsize
\n
"
);
return
-1
;
}
printf
(
"getting winsize
\n
"
);
if
(
tcgetwinsize
(
0
,
&
w
)
==
-1
)
{
printf
(
"error: tcgetwinsize
\n
"
);
return
-1
;
}
printf
(
"winsize: %d %d %d %d
\n
"
,
w
.
ws_row
,
w
.
ws_col
,
w
.
ws_xpixel
,
w
.
ws_ypixel
);
printf
(
"restoring winsize
\n
"
);
if
(
tcsetwinsize
(
0
,
&
y
)
==
-1
)
{
printf
(
"error: tcsetwinsize
\n
"
);
return
-1
;
}
return
0
;
}
File Metadata
Details
Attached
Mime Type
text/x-c
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3287871
Default Alt Text
test.c (820 B)
Attached To
Mode
D27650: Add tcgetwinsize() and tcsetwinsize() to termios.h
Attached
Detach File
Event Timeline
Log In to Comment