From: Dan Cross <cross@math.psu.edu>
To: 9fans@cse.psu.edu
Subject: [9fans] Whoops.
Date: Wed, 25 Apr 2001 19:07:36 -0400 [thread overview]
Message-ID: <200104252307.TAA19184@math.psu.edu> (raw)
Argh, I hate doing something stupid. When setting cheight and
cwidth with the patches I posted earlier, one should, of course,
do the arithmetic in floating point, otherwise, it's kind of
useless. :-) My apologies; corrected diffs follow.
- Dan C.
diff /sys/src/cmd/ssh/cmd/client_messages.c ./cmd/client_messages.c
372,373c372,373
< int cwidth;
< int cheight;
---
> float cwidth;
> float cheight;
380,382c380,382
< if(cwidth == 0){
< cwidth = width/cols;
< cheight = height/lines;
---
> if((long)cwidth == 0){
> cwidth = (float)width/cols;
> cheight = (float)height/lines;
385a386,393
> static void
> setdefgeom(void)
> {
> width = 640;
> height = 480;
> setdim();
> }
>
393,397d400
< /* defaults */
< width = 640;
< height = 480;
< setdim();
<
400c403,404
< if(fd < 0)
---
> if(fd < 0) {
> setdefgeom();
401a406
> }
406a412
> setdefgeom();
471a478,484
> static long
> round(float val)
> {
>
> return((long)(val + 0.5));
> }
>
483,484c496,497
< putlong(packet, height/cheight); /* rows */
< putlong(packet, width/cwidth); /* columns */
---
> putlong(packet, round(height/cheight)); /* rows */
> putlong(packet, round(width/cwidth)); /* columns */
next reply other threads:[~2001-04-25 23:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-25 23:07 Dan Cross [this message]
2006-03-19 23:28 SHRIZZA
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200104252307.TAA19184@math.psu.edu \
--to=cross@math.psu.edu \
--cc=9fans@cse.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).