Re: [9fans] wctl

2023-05-09 Thread 有澤健治
Thanks. sirjofri

OK. I have understood!
I have misunderstood the meaning "padded".
Sorry for may poor english.

2023年5月10日(水) 0:06 sirjofri :

>
> 09.05.2023 15:04:07 有澤健治 :
>
> > Thanks for umbraticus and Richard.
> >
> > The value 72 is experimentally OK.
> > However I am not convinced yet.
> > I can't find the value in the manual.
> 
> Not experimentally. According to rio(4), it's 4 values padded to 12 chars,
> plus the window state as two strings, also padded to 12. If you do the
> math: 6*12=72.
> 
> sirjofri

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tf13f657beb7b12c0-M43294eac9d9b73dec4e91cc7
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] wctl

2023-05-09 Thread sirjofri


09.05.2023 15:04:07 有澤健治 :

> Thanks for umbraticus and Richard.
>
> The value 72 is experimentally OK.
> However I am not convinced yet.
> I can't find the value in the manual.

Not experimentally. According to rio(4), it's 4 values padded to 12 chars, plus 
the window state as two strings, also padded to 12. If you do the math: 6*12=72.

sirjofri

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tf13f657beb7b12c0-M653f4f77683fc542820c5944
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] wctl

2023-05-09 Thread 有澤健治
Thanks for umbraticus and Richard.

The value 72 is experimentally OK.
However I am not convinced yet.
I can't find the value in the manual.

Kenji Arisawa

2023年5月9日(火) 17:00 Richard Miller <9f...@hamnavoe.com>:

> > ; read -c 72 /dev/wctl
> 
> Or, if your chosen flavour of Plan 9 doesn't have the 'read -c'
> option, one of these will do:
> 
> dd -if /dev/wctl -bs 72 -count 1 -quiet 1
> syscall -o read 0 buf 72 [2]/dev/null
> 

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tf13f657beb7b12c0-M429a1a214f0fb13d9c461eda
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] wctl

2023-05-09 Thread Richard Miller
> ; read -c 72 /dev/wctl

Or, if your chosen flavour of Plan 9 doesn't have the 'read -c'
option, one of these will do:

dd -if /dev/wctl -bs 72 -count 1 -quiet 1
syscall -o read 0 buf 72 [2]/dev/null


--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tf13f657beb7b12c0-Mdd9f3de6c6653fc343ffc333
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] wctl

2023-05-09 Thread umbraticus
; read -c 72 /dev/wctl

rio(4)

umbraticus

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tf13f657beb7b12c0-Ma0337129de0681f834f7e7c7
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


[9fans] wctl

2023-05-08 Thread 有澤健治
Hello, 9fans

In writing a program I met a problem on finding window size.
cat /dev/wctl
shows something like this:
hebe% cat /dev/wctl
456  911214 603 current visible
hebe%
Need DEL key to stop. I want to get this info without manual intervention.

I tried a experimental code:

#include 
#include 

void
main(void)
{ char buf[256];
int fd,n;
fd = open("/dev/wctl",OREAD);
print("%d\n",fd);
//n = readn(fd,buf,1);//NG. buffer too small
//n = readn(fd,buf,48);//NG. truncated
//n = readn(fd,buf,56);//NG. truncated
//n = readn(fd,buf,70);//NG. truncated
n = readn(fd,buf,71);//OK, n=71
//n = readn(fd,buf,111);//OK.  n=71
//n = readn(fd,buf,117);//OK.  n=71
//n = readn(fd,buf,128);//NG. hungup
/* I donn't know the reasnalbe value m for readn(fd,buf,m) */
if(n < 0){
print("%r\n");
}
buf[n] = 0;
print("n=%d\n%s\n",n,buf);
close(fd);
exits(nil);
}

I don't know whether m in readn(fd,buf,m) depends on something or not.
If depends. then how to know getting OK value?

Kenji Arisawa

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tf13f657beb7b12c0-M60ccbc9ae01219d2e2f46c4f
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription