9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "boyd, rounin" <boyd@insultant.net>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu>
Subject: Re: [9fans] drawterm
Date: Fri, 13 Aug 2004 02:03:26 +0200	[thread overview]
Message-ID: <007001c480c8$f6de6100$75fb7d50@SOMA> (raw)
In-Reply-To: <ee9e417a0408121647519236c9@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 341 bytes --]

> From: "Russ Cox" <russcox@gmail.com>

thanks for the clarification, but PING is not an
acceptable error message should you have a
routing/ISP/firewall problem ...

cut to monty python's _the meaning of life_:

    have we got the machine that goes BING?

btw: nor is 'postnote 2'.

bbtw: even ralph tries to get things right.

[-- Attachment #2: ralph.c --]
[-- Type: application/octet-stream, Size: 1339 bytes --]

#include <u.h>
#include <libc.h>
#include <bio.h>
#include <ctype.h>

/*
 * ralph
 *
 * A filter to read stdin and write latin-1 diacriticals as
 * quasi troff to stdout.
 *
 * © Boyd Roberts 2004
 */

/* map latin-1 to troff diacriticals */
static Rune	*tab[256]	=
{
	[0xe0] L"`a", L"'a", L"^a", 0, 0, 0,     0, L"ç",
	[0xe8] L"`e", L"'e", L"^e", 0, 0, 0, L"^i",    0,
	[0xf0]     0,     0,     0, 0, 0, 0, L":o",    0,
};

/* troff string [diacritical] prefix */
char		*tp		= "\\*";

void
main(int argc, char *argv[])
{
	Biobuf	bin;
	Biobuf	bout;
	Biobuf	*in;
	Biobuf	*out;
	int	c;
	int	e;

	USED(argc);
	USED(argv);

	Binit(in = &bin, 0, OREAD);
	Binit(out = &bout, 1, OWRITE);
	e = 0;

	while ((c = Bgetc(in)) >= 0) {
		Rune	*r;

		if (isascii(c)) {
			/* damn windows' CRs */
			if (c != '\r' && Bputc(out, c) < 0) {
				e = 1;
				break;
			}

			continue;
		}

		if ((r = tab[c]) == 0) {
			fprint(2, "ralph: unknown latin-1 0x%02x\n", c);
			exits("update latin-1 table");
		}

		/* single Rune or troff diacritical */
		if (runestrlen(r) == 1) {
			if (Bprint(out, "%C", *r) == Beof)
				e = 1;
		}
		else if (Bprint(out, "%s%S", tp, r) == Beof)
				e = 1;

		if (e)
			break;
	}

	if (!e && Bflush(out) < 0)
		e = 1;

	exits(e ? "i/o error" : "");
}

  reply	other threads:[~2004-08-13  0:03 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-12 20:26 boyd, rounin
2004-08-12 23:47 ` Russ Cox
2004-08-13  0:03   ` boyd, rounin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-11-04 19:28 Steve Simon
2005-11-04 17:21 Russ Cox
2005-11-04 20:09 ` Gabriel Diaz
2005-11-04 18:21   ` "Nils O. Selåsdal"
2005-11-04 20:47     ` Gabriel Diaz
2005-11-04 20:18   ` Russ Cox
2005-11-04 20:13 ` Axel Belinfante
2005-11-04 22:14   ` Axel Belinfante
2005-11-04 22:43     ` Axel Belinfante
2005-11-04 22:50     ` Brantley Coile
2005-11-04 23:01       ` andrey mirtchovski
2005-11-04 23:04         ` Brantley Coile
2005-11-04 23:08       ` Tim Wiess
2005-11-04 23:16         ` andrey mirtchovski
2005-10-18 14:00 Russ Cox
2005-10-06  8:22 Andrew Simmons
2005-10-06  9:47 ` Dave Lukes
2005-10-06 14:25   ` Vester Thacker
2005-10-06 13:16 ` Brantley Coile
2005-10-06 15:08 ` Russ Cox
2005-10-05 12:12 Russ Cox
2003-12-17 13:51 boyd, rounin
2003-12-17  4:10 ` okamoto
2003-12-17 14:31   ` boyd, rounin
2003-12-17  7:11     ` Dan Cross
2003-09-10 14:38 David Presotto
2003-09-10 14:48 ` mirtchov
2003-09-10 16:00   ` andrey mirtchovski
2003-09-10 19:47     ` Atanas Bachvaroff
2003-09-10 21:00     ` Geoff Collyer
2003-09-11  6:18     ` okamoto
2003-09-11 13:12       ` mirtchov
2003-09-12  1:07         ` okamoto
2003-09-11 14:17     ` Axel Belinfante
2003-09-12  2:10       ` okamoto
2003-09-11  2:05 ` boyd, rounin
2003-09-11  4:31 ` Skip Tavakkolian
2002-07-17 22:18 rob pike, esq.
2002-07-17 21:17 Sam
2002-07-17 21:25 ` Sam
2000-12-20  4:11 Russ Cox

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='007001c480c8$f6de6100$75fb7d50@SOMA' \
    --to=boyd@insultant.net \
    --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).