9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] work with snarf
@ 2004-12-27 17:14 Sergey Reva
  0 siblings, 0 replies; 3+ messages in thread
From: Sergey Reva @ 2004-12-27 17:14 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello Fans

>I write program for viewing character set and copy selected
>characters to snarf.

Now anyone can get it in my site (source + mkfile):
http://rs-rlab.narod.ru/files/symbol.zip

Thanks Russ for help with snarf!
-- 
http://rs-rlab.narod.ru                            mailto:rs_rlab@mail.ru



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] work with snarf
  2004-12-26 13:21 Sergey Reva
@ 2004-12-26 17:11 ` Russ Cox
  0 siblings, 0 replies; 3+ messages in thread
From: Russ Cox @ 2004-12-26 17:11 UTC (permalink / raw)
  To: Sergey Reva, Fans of the OS Plan 9 from Bell Labs

> I write program for viewing character set and copy selected
> characters to snarf, All work fine, but how i can put Rune to snarf.
> Something like that don't work:
> 
>           if((fd=open("/dev/snarf",OWRITE|OTRUNC))>0)
>           {
>               write(fd,Buffer,sizeof(Rune)*RuneCnt);
>               close(fd);
>           }

runes are 16-bit numbers and thus byte-order dependent,
but /dev/snarf (and all other files) expect the utf8 encoding,
which is not byte-order dependent.  page /sys/doc/utf.ps.
print(2) generates utf8 and can print rune strings via %S,
so you can use

if((fd = open("/dev/snarf", OWRITE|OTRUNC)) >= 0){
    fprint(fd, "%.*S", RuneCnt, Buffer);
    close(fd);
}

russ


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [9fans] work with snarf
@ 2004-12-26 13:21 Sergey Reva
  2004-12-26 17:11 ` Russ Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Reva @ 2004-12-26 13:21 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello Fans

I write program for viewing character set and copy selected
characters to snarf, All work fine, but how i can put Rune to snarf.
Something like that don't work:

          if((fd=open("/dev/snarf",OWRITE|OTRUNC))>0)
          {
              write(fd,Buffer,sizeof(Rune)*RuneCnt);
              close(fd);
          }

Thanks

-- 
http://rs-rlab.narod.ru                          mailto:rs_rlab@mail.ru



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-12-27 17:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-27 17:14 [9fans] work with snarf Sergey Reva
  -- strict thread matches above, loose matches on Subject: below --
2004-12-26 13:21 Sergey Reva
2004-12-26 17:11 ` Russ Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).