9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] wiki editing via web browser
@ 2004-04-05 16:37 andrey mirtchovski
  2004-04-05 16:41 ` andrey mirtchovski
  0 siblings, 1 reply; 26+ messages in thread
From: andrey mirtchovski @ 2004-04-05 16:37 UTC (permalink / raw)
  To: 9fans

this function was supposed to be disabled (only allowing users to edit
the wiki from a Plan 9 machine) but it seems to have been re-enabled.

currently the main wiki page is fscked.

andrey



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

* Re: [9fans] wiki editing via web browser
  2004-04-05 16:37 [9fans] wiki editing via web browser andrey mirtchovski
@ 2004-04-05 16:41 ` andrey mirtchovski
  2004-04-05 17:49   ` Russ Cox
  0 siblings, 1 reply; 26+ messages in thread
From: andrey mirtchovski @ 2004-04-05 16:41 UTC (permalink / raw)
  To: 9fans

> this function was supposed to be disabled (only allowing users to edit
> the wiki from a Plan 9 machine) but it seems to have been re-enabled.
> 
> currently the main wiki page is fscked.
> 
> andrey

i've reinstated the main page from its last known good state, but we
should really disable editing from the web...

andrey



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

* Re: [9fans] wiki editing via web browser
  2004-04-05 17:49   ` Russ Cox
@ 2004-04-05 17:41     ` a
  2004-04-05 18:00       ` andrey mirtchovski
  2004-04-05 18:07       ` Russ Cox
  0 siblings, 2 replies; 26+ messages in thread
From: a @ 2004-04-05 17:41 UTC (permalink / raw)
  To: 9fans

i don't suppose we have any log info that might be useful for
tracking down the virtual vandal? just curious.
ア


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

* Re: [9fans] wiki editing via web browser
  2004-04-05 16:41 ` andrey mirtchovski
@ 2004-04-05 17:49   ` Russ Cox
  2004-04-05 17:41     ` a
  0 siblings, 1 reply; 26+ messages in thread
From: Russ Cox @ 2004-04-05 17:49 UTC (permalink / raw)
  To: 9fans

andrey mirtchovski wrote:

>>this function was supposed to be disabled (only allowing users to edit
>>the wiki from a Plan 9 machine) but it seems to have been re-enabled.
>>
>>currently the main wiki page is fscked.
>>
>>andrey
>>    
>>
>
>i've reinstated the main page from its last known good state, but we
>should really disable editing from the web...
>  
>

that didn't take long.  we moved services to a new machine over
the weekend, a machine with a working ip/httpd/wikipost.  i think
i've fixed the problem.

russ



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

* Re: [9fans] wiki editing via web browser
  2004-04-05 17:41     ` a
@ 2004-04-05 18:00       ` andrey mirtchovski
  2004-04-05 18:18         ` David Tolpin
  2004-04-06 16:58         ` ron minnich
  2004-04-05 18:07       ` Russ Cox
  1 sibling, 2 replies; 26+ messages in thread
From: andrey mirtchovski @ 2004-04-05 18:00 UTC (permalink / raw)
  To: 9fans

> i don't suppose we have any log info that might be useful for
> tracking down the virtual vandal? just curious.
> ア

you can click on the 'history' link at the bottom of the wiki page to
find their ip address...

the latest perpetrator was from Moldova. 

moldtelecom -- them russians and their abbreviated company names :)



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

* Re: [9fans] wiki editing via web browser
  2004-04-05 17:41     ` a
  2004-04-05 18:00       ` andrey mirtchovski
@ 2004-04-05 18:07       ` Russ Cox
  1 sibling, 0 replies; 26+ messages in thread
From: Russ Cox @ 2004-04-05 18:07 UTC (permalink / raw)
  To: 9fans

a@9srv.net wrote:
> i don't suppose we have any log info that might be useful for
> tracking down the virtual vandal? just curious.

The IP address is in the history.



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

* Re: [9fans] wiki editing via web browser
  2004-04-05 18:00       ` andrey mirtchovski
@ 2004-04-05 18:18         ` David Tolpin
  2004-04-05 18:43           ` andrey mirtchovski
  2004-04-05 21:51           ` boyd, rounin
  2004-04-06 16:58         ` ron minnich
  1 sibling, 2 replies; 26+ messages in thread
From: David Tolpin @ 2004-04-05 18:18 UTC (permalink / raw)
  To: 9fans

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 441 bytes --]

> > i don't suppose we have any log info that might be useful for
> > tracking down the virtual vandal? just curious.
> > ア
>
> you can click on the 'history' link at the bottom of the wiki page to
> find their ip address...
>
> the latest perpetrator was from Moldova. 
>
> moldtelecom -- them russians and their abbreviated company names :)
>

Moldovians are much less Russians than Bulgarians are. Tame your
chauvinism.


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

* Re: [9fans] wiki editing via web browser
  2004-04-05 18:18         ` David Tolpin
@ 2004-04-05 18:43           ` andrey mirtchovski
  2004-04-05 19:11             ` George Michaelson
  2004-04-05 21:51           ` boyd, rounin
  1 sibling, 1 reply; 26+ messages in thread
From: andrey mirtchovski @ 2004-04-05 18:43 UTC (permalink / raw)
  To: 9fans


> Moldovians are much less Russians than Bulgarians are. Tame your
> chauvinism.

'twas a joke, get on with it.  here's an emoticon that should make
more sense: ☺

Bulgaria has also inherited a Soviet-style inclination to get as many
abbreviated words as possible in the names of state-run companies,
"Neftochim" and "Bulgartabak" come as examples.  Should I not be
making fun of those either?

By the way, you either have the definition of 'chauvinism' wrong, or
are confused about which country I am "militantly devoted to the
glorification of"
(http://dictionary.reference.com/search?q=chauvinism).  I believe the
word doesn't change meaning in either russian, armenian, bulgarian,
moldovan (romanian) or gagauz.



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

* Re: [9fans] wiki editing via web browser
  2004-04-05 18:43           ` andrey mirtchovski
@ 2004-04-05 19:11             ` George Michaelson
  2004-04-05 19:21               ` Axel Belinfante
                                 ` (2 more replies)
  0 siblings, 3 replies; 26+ messages in thread
From: George Michaelson @ 2004-04-05 19:11 UTC (permalink / raw)
  To: 9fans


>Bulgaria has also inherited a Soviet-style inclination to get as many
>abbreviated words as possible in the names of state-run companies,
>"Neftochim" and "Bulgartabak" come as examples.  Should I not be
>making fun of those either?

The French do this too, as I am sure Boyd can point out. Maybe the Sovs got
it from the French? And I wish I knew if the 'waterloo == station' urban myth
my mother told me is true (apparently the czar was that impressed with the
station when he saw it)

I like this form of word construction. As does Bell Northern Canada and almost
every other telco these days. EmbraTel, Nortel, K-Tel...

>
>By the way, you either have the definition of 'chauvinism' wrong, or
>are confused about which country I am "militantly devoted to the
>glorification of"
>(http://dictionary.reference.com/search?q=chauvinism).  I believe the
>word doesn't change meaning in either russian, armenian, bulgarian,
>moldovan (romanian) or gagauz.

I blame the cathars, or the bogomils. They're all dead anyway. But I'll
blame Canada if you like!

-George


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

* Re: [9fans] wiki editing via web browser
  2004-04-05 19:11             ` George Michaelson
@ 2004-04-05 19:21               ` Axel Belinfante
  2004-04-05 19:29               ` Roman Shaposhnick
  2004-04-06  0:35               ` boyd, rounin
  2 siblings, 0 replies; 26+ messages in thread
From: Axel Belinfante @ 2004-04-05 19:21 UTC (permalink / raw)
  To: 9fans

> I like this form of word construction. As does Bell Northern Canada and almost
> every other telco these days. EmbraTel, Nortel, K-Tel...

once upon a time there was twentel...

(a functional programming language developed at the
 then called 'technische hogeschool twente')

Axel. - sorry about the noise, but could not resist



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

* Re: [9fans] wiki editing via web browser
  2004-04-05 19:11             ` George Michaelson
  2004-04-05 19:21               ` Axel Belinfante
@ 2004-04-05 19:29               ` Roman Shaposhnick
  2004-04-05 20:48                 ` Wes Kussmaul
  2004-04-06  0:39                 ` boyd, rounin
  2004-04-06  0:35               ` boyd, rounin
  2 siblings, 2 replies; 26+ messages in thread
From: Roman Shaposhnick @ 2004-04-05 19:29 UTC (permalink / raw)
  To: 9fans

On Mon, Apr 05, 2004 at 04:11:52PM -0300, George Michaelson wrote:
> 
> >Bulgaria has also inherited a Soviet-style inclination to get as many
> >abbreviated words as possible in the names of state-run companies,
> >"Neftochim" and "Bulgartabak" come as examples.  Should I not be
> >making fun of those either?
> 
> The French do this too, as I am sure Boyd can point out. Maybe the Sovs got
> it from the French? 

  What ?!?!? I though USA invented the whole idea.

Thanks,
Roman.

P.S. Back in my childhood I though that Russian military tongue was
practically Morse code when it came to the number of acronyms per
sentence, boy, was I wrong: "AFAIR I've RSVPed for the FAQ session before COB"!
And that's *spoken* language!


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

* Re: [9fans] wiki editing via web browser
  2004-04-05 19:29               ` Roman Shaposhnick
@ 2004-04-05 20:48                 ` Wes Kussmaul
  2004-04-05 23:00                   ` 9nut
  2004-04-06  0:39                 ` boyd, rounin
  1 sibling, 1 reply; 26+ messages in thread
From: Wes Kussmaul @ 2004-04-05 20:48 UTC (permalink / raw)
  To: 9fans


>
>P.S. Back in my childhood I though that Russian military tongue was
>practically Morse code when it came to the number of acronyms per
>sentence, boy, was I wrong: "AFAIR I've RSVPed for the FAQ session before 
>COB"!
>And that's *spoken* language!

To have a PKI application reviewed for acceptance by the U.S. military, 
you'll need
to apply to the DoD/DISA/JITC/PKITC/PKE AP program.

WK






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

* Re: [9fans] wiki editing via web browser
  2004-04-05 18:18         ` David Tolpin
  2004-04-05 18:43           ` andrey mirtchovski
@ 2004-04-05 21:51           ` boyd, rounin
  1 sibling, 0 replies; 26+ messages in thread
From: boyd, rounin @ 2004-04-05 21:51 UTC (permalink / raw)
  To: 9fans

> Moldovians are much less Russians than Bulgarians are. Tame your
> chauvinism.

207



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

* Re: [9fans] wiki editing via web browser
  2004-04-05 20:48                 ` Wes Kussmaul
@ 2004-04-05 23:00                   ` 9nut
  0 siblings, 0 replies; 26+ messages in thread
From: 9nut @ 2004-04-05 23:00 UTC (permalink / raw)
  To: 9fans

>>P.S. Back in my childhood I though that Russian military tongue was
>>practically Morse code when it came to the number of acronyms per
>>sentence, boy, was I wrong: "AFAIR I've RSVPed for the FAQ session before 
>>COB"!
>>And that's *spoken* language!
> 
> To have a PKI application reviewed for acceptance by the U.S. military, 
> you'll need
> to apply to the DoD/DISA/JITC/PKITC/PKE AP program.

"Seeing as how the VP is such a VIP, should we keep the PC on the QT, 'cause if
it leaks to the VC, he could end up a MIA and we'd all be put on KP."
	- Robin Williams as Adrian Cronauer



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

* Re: [9fans] wiki editing via web browser
  2004-04-05 19:11             ` George Michaelson
  2004-04-05 19:21               ` Axel Belinfante
  2004-04-05 19:29               ` Roman Shaposhnick
@ 2004-04-06  0:35               ` boyd, rounin
  2 siblings, 0 replies; 26+ messages in thread
From: boyd, rounin @ 2004-04-06  0:35 UTC (permalink / raw)
  To: 9fans

> The French do this too, as I am sure Boyd can point out.

well languages are hard.  i'd rather say:

    t'en veux?

instead of:

    do you want some?

> Maybe the Sovs got it from the French?

perhaps, french being the diplomatic language.

> And I wish I knew if the 'waterloo == station' urban myth

both.  a tubestation and a battle.


ps.  send the JD.



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

* Re: [9fans] wiki editing via web browser
  2004-04-05 19:29               ` Roman Shaposhnick
  2004-04-05 20:48                 ` Wes Kussmaul
@ 2004-04-06  0:39                 ` boyd, rounin
  2004-04-06  2:05                   ` Roman Shaposhnick
  1 sibling, 1 reply; 26+ messages in thread
From: boyd, rounin @ 2004-04-06  0:39 UTC (permalink / raw)
  To: 9fans

> P.S. Back in my childhood I though that Russian military tongue was
> practically Morse code ...

-.-. --.-



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

* Re: [9fans] wiki editing via web browser
  2004-04-06  0:39                 ` boyd, rounin
@ 2004-04-06  2:05                   ` Roman Shaposhnick
  2004-04-06 13:08                     ` Peter Bosch
  0 siblings, 1 reply; 26+ messages in thread
From: Roman Shaposhnick @ 2004-04-06  2:05 UTC (permalink / raw)
  To: 9fans

On Tue, Apr 06, 2004 at 02:39:44AM +0200, boyd, rounin wrote:
> > P.S. Back in my childhood I though that Russian military tongue was
> > practically Morse code ...
> 
> -.-. --.-
  
   .--  -  ..-.  ..--..


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

* Re: [9fans] wiki editing via web browser
  2004-04-06  2:05                   ` Roman Shaposhnick
@ 2004-04-06 13:08                     ` Peter Bosch
  2004-04-06 23:53                       ` Bruce Ellis
  2004-04-07  7:25                       ` Roman Shaposhnick
  0 siblings, 2 replies; 26+ messages in thread
From: Peter Bosch @ 2004-04-06 13:08 UTC (permalink / raw)
  To: 9fans

> On Tue, Apr 06, 2004 at 02:39:44AM +0200, boyd, rounin wrote:
>> > P.S. Back in my childhood I though that Russian military tongue was
>> > practically Morse code ...
>> 
>> -.-. --.-
>   
>    .--  -  ..-.  ..--..

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

static char*asciitab[] = {
	".-",	// A  
	"-...",
	"-.-.",
	"-..",
	".",
	"..-.",
	"--.",
	"....",
	"..",
	".---",
	"-.-",
	".-..",
	"--",
	"-.",
	"---",
	".--.",
	"--.-",
	".-.",
	"...",
	"-",
	"..-",
	"...-",
	".--",
	"-..-",
	"-.--",
	"--..",	// Z
};

static char*numtab[] = {
	"-----", // 0
	".----",
	"..---",
	"...--",
	"....-",
	".....",
	"-....",
	"--...",
	"---..",
	"----.",
};

static struct {
	char c;
	char *m;
} specials[] = {
{	'.',	".-.-.-"	},
{	',',	"--..--"	},
{	'?',	"..--.."	},
{	'@',	".--.-."	},
{	' ',	" "		},
};

int
morsefmt(Fmt *f)
{
	char *p, *src, *dst, c;
	int rv, len, i;

	src = va_arg(f->args, char*);
	len = strlen(src);
	p = dst = malloc(len * 6 + 1);
	if(dst == nil)
		return fmtstrcpy(f, "(romanfmt)");

	while(c = *src++){
		if(c == '\n')
			continue;

		if(isalpha(c)){
			c = toupper(c);
			assert(c >= 'A' && c <= 'Z');
			c -= 'A';
			len = strlen(asciitab[c]);
			memcpy(p, asciitab[c], len);
			p += len;
			continue;
		}

		if(isdigit(c)){
			assert(c >= '0' && c <= '9');
			c -= '0';
			len = strlen(numtab[c]);
			memcpy(p, numtab[c], len);
			p += len;
			continue;
		}

		for(i = 0; i < nelem(specials); i++)
			if(specials[i].c == c)
				break;

		if(i == nelem(specials)){
			*p++ = '?';
			continue;
		}

		len = strlen(specials[i].m);
		memcpy(p, specials[i].m, len);
		p += len;
	}
	*p = 0;

	rv = fmtstrcpy(f, dst);
	free(dst);
	return rv;
}

void
main(void)
{
	Biobuf b;
	char *p;

	Binit(&b, 0, OREAD);
	fmtinstall('M', morsefmt);
	while((p = Brdline(&b, '\n')) != nil){
		p[Blinelen(&b)] = 0;
		print("[%s] %M\n", p, p);
	}
	Bterm(&b);
	exits(0);
}



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

* Re: [9fans] wiki editing via web browser
  2004-04-06 16:58         ` ron minnich
@ 2004-04-06 14:06           ` Noah Evans
  2004-04-06 17:18             ` andrey mirtchovski
  2004-04-07  1:08           ` Geoff Collyer
  1 sibling, 1 reply; 26+ messages in thread
From: Noah Evans @ 2004-04-06 14:06 UTC (permalink / raw)
  To: 9fans

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

Hmmmm...

that got me thinking.

How would the 9 folks implement the internet(meaning stuff like html) if given the chance? Especially the security model.

I've seen alternate ideas referred to in the archives, but I don't recall any systematic discussion of it.

Curious,

Noah


[-- Attachment #2: Type: message/rfc822, Size: 3526 bytes --]

From: ron minnich <rminnich@lanl.gov>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] wiki editing via web browser
Date: Tue, 06 Apr 2004 10:58:03 -0600 (MDT)
Message-ID: <Pine.LNX.4.44.0404061056480.6572-100000@maxroach.lanl.gov>

On Mon, 5 Apr 2004, andrey mirtchovski wrote:

> the latest perpetrator was from Moldova. 

So what are we doing to do, hire Buford Pusser to go track 'em down and go
drill a hole in them? Give it up. The Internet is a public urinal,
nowadays. I'm begining to miss the '70s.

We need a new 'run by fascists' Internet :-)

ron

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

* Re: [9fans] wiki editing via web browser
  2004-04-05 18:00       ` andrey mirtchovski
  2004-04-05 18:18         ` David Tolpin
@ 2004-04-06 16:58         ` ron minnich
  2004-04-06 14:06           ` Noah Evans
  2004-04-07  1:08           ` Geoff Collyer
  1 sibling, 2 replies; 26+ messages in thread
From: ron minnich @ 2004-04-06 16:58 UTC (permalink / raw)
  To: 9fans

On Mon, 5 Apr 2004, andrey mirtchovski wrote:

> the latest perpetrator was from Moldova. 

So what are we doing to do, hire Buford Pusser to go track 'em down and go
drill a hole in them? Give it up. The Internet is a public urinal,
nowadays. I'm begining to miss the '70s.

We need a new 'run by fascists' Internet :-)

ron



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

* Re: [9fans] wiki editing via web browser
  2004-04-06 14:06           ` Noah Evans
@ 2004-04-06 17:18             ` andrey mirtchovski
  2004-04-06 18:47               ` Russ Cox
  0 siblings, 1 reply; 26+ messages in thread
From: andrey mirtchovski @ 2004-04-06 17:18 UTC (permalink / raw)
  To: 9fans


> How would the 9 folks implement the internet(meaning stuff like
> html) if given the chance?  Especially the security model.

echo 'britney spears' > /mnt/web/google.com/searchctl
cd /mnt/web/^`{cat /mnt/web/google.com/searchdata}
page index.ps

note the .ps -- there's no need for html anymore, you can link by
plumbing file names...

andrey



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

* Re: [9fans] wiki editing via web browser
  2004-04-06 17:18             ` andrey mirtchovski
@ 2004-04-06 18:47               ` Russ Cox
  0 siblings, 0 replies; 26+ messages in thread
From: Russ Cox @ 2004-04-06 18:47 UTC (permalink / raw)
  To: 9fans

andrey mirtchovski wrote:
>>How would the 9 folks implement the internet(meaning stuff like
>>html) if given the chance?  Especially the security model.
> 
> 
> echo 'britney spears' > /mnt/web/google.com/searchctl
> cd /mnt/web/^`{cat /mnt/web/google.com/searchdata}
> page index.ps

maybe it's sufficiently advanced technology,
but it sure looks like magic to me!



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

* Re: [9fans] wiki editing via web browser
  2004-04-06 13:08                     ` Peter Bosch
@ 2004-04-06 23:53                       ` Bruce Ellis
  2004-04-07  7:25                       ` Roman Shaposhnick
  1 sibling, 0 replies; 26+ messages in thread
From: Bruce Ellis @ 2004-04-06 23:53 UTC (permalink / raw)
  To: 9fans

I wish I had that when I added "set english" and "set roman"
to csh as an april fool's joke (they instructed csh to display
all numbers in english text, or roman numerals).

set english
set morse

would have been particularly tedious (those pids).

brucee
----- Original Message ----- 
From: "Peter Bosch" <pb@research.bell-labs.com>
To: <9fans@cse.psu.edu>
Sent: Tuesday, April 06, 2004 11:08 PM
Subject: Re: [9fans] wiki editing via web browser

> static char*asciitab[] = {
> ".-", // A  
> "-...",

etc ...


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

* Re: [9fans] wiki editing via web browser
  2004-04-06 16:58         ` ron minnich
  2004-04-06 14:06           ` Noah Evans
@ 2004-04-07  1:08           ` Geoff Collyer
  2004-04-07  1:12             ` boyd, rounin
  1 sibling, 1 reply; 26+ messages in thread
From: Geoff Collyer @ 2004-04-07  1:08 UTC (permalink / raw)
  To: 9fans

Hire Boyd, he's got the equipment, aptitude, attitude and relative
proximity.  I'll try to dig up my Protocol Police sheriff's badge.



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

* Re: [9fans] wiki editing via web browser
  2004-04-07  1:08           ` Geoff Collyer
@ 2004-04-07  1:12             ` boyd, rounin
  0 siblings, 0 replies; 26+ messages in thread
From: boyd, rounin @ 2004-04-07  1:12 UTC (permalink / raw)
  To: 9fans

> Hire Boyd, he's got the equipment, aptitude, attitude ...

attitude?  moi?  :)



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

* Re: [9fans] wiki editing via web browser
  2004-04-06 13:08                     ` Peter Bosch
  2004-04-06 23:53                       ` Bruce Ellis
@ 2004-04-07  7:25                       ` Roman Shaposhnick
  1 sibling, 0 replies; 26+ messages in thread
From: Roman Shaposhnick @ 2004-04-07  7:25 UTC (permalink / raw)
  To: 9fans

Wow! That's the spirit.

Thanks,
Roman.

On Tue, Apr 06, 2004 at 09:08:48AM -0400, Peter Bosch wrote:
> > On Tue, Apr 06, 2004 at 02:39:44AM +0200, boyd, rounin wrote:
> >> > P.S. Back in my childhood I though that Russian military tongue was
> >> > practically Morse code ...
> >> 
> >> -.-. --.-
> >   
> >    .--  -  ..-.  ..--..
> 
> #include <u.h>
> #include <libc.h>
> #include <bio.h>
> #include <ctype.h>
> 
> static char*asciitab[] = {
> 	".-",	// A  
> 	"-...",
> 	"-.-.",
> 	"-..",
> 	".",
> 	"..-.",
> 	"--.",
> 	"....",
> 	"..",
> 	".---",
> 	"-.-",
> 	".-..",
> 	"--",
> 	"-.",
> 	"---",
> 	".--.",
> 	"--.-",
> 	".-.",
> 	"...",
> 	"-",
> 	"..-",
> 	"...-",
> 	".--",
> 	"-..-",
> 	"-.--",
> 	"--..",	// Z
> };
> 
> static char*numtab[] = {
> 	"-----", // 0
> 	".----",
> 	"..---",
> 	"...--",
> 	"....-",
> 	".....",
> 	"-....",
> 	"--...",
> 	"---..",
> 	"----.",
> };
> 
> static struct {
> 	char c;
> 	char *m;
> } specials[] = {
> {	'.',	".-.-.-"	},
> {	',',	"--..--"	},
> {	'?',	"..--.."	},
> {	'@',	".--.-."	},
> {	' ',	" "		},
> };
> 
> int
> morsefmt(Fmt *f)
> {
> 	char *p, *src, *dst, c;
> 	int rv, len, i;
> 
> 	src = va_arg(f->args, char*);
> 	len = strlen(src);
> 	p = dst = malloc(len * 6 + 1);
> 	if(dst == nil)
> 		return fmtstrcpy(f, "(romanfmt)");
> 
> 	while(c = *src++){
> 		if(c == '\n')
> 			continue;
> 
> 		if(isalpha(c)){
> 			c = toupper(c);
> 			assert(c >= 'A' && c <= 'Z');
> 			c -= 'A';
> 			len = strlen(asciitab[c]);
> 			memcpy(p, asciitab[c], len);
> 			p += len;
> 			continue;
> 		}
> 
> 		if(isdigit(c)){
> 			assert(c >= '0' && c <= '9');
> 			c -= '0';
> 			len = strlen(numtab[c]);
> 			memcpy(p, numtab[c], len);
> 			p += len;
> 			continue;
> 		}
> 
> 		for(i = 0; i < nelem(specials); i++)
> 			if(specials[i].c == c)
> 				break;
> 
> 		if(i == nelem(specials)){
> 			*p++ = '?';
> 			continue;
> 		}
> 
> 		len = strlen(specials[i].m);
> 		memcpy(p, specials[i].m, len);
> 		p += len;
> 	}
> 	*p = 0;
> 
> 	rv = fmtstrcpy(f, dst);
> 	free(dst);
> 	return rv;
> }
> 
> void
> main(void)
> {
> 	Biobuf b;
> 	char *p;
> 
> 	Binit(&b, 0, OREAD);
> 	fmtinstall('M', morsefmt);
> 	while((p = Brdline(&b, '\n')) != nil){
> 		p[Blinelen(&b)] = 0;
> 		print("[%s] %M\n", p, p);
> 	}
> 	Bterm(&b);
> 	exits(0);
> }
> 


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

end of thread, other threads:[~2004-04-07  7:25 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-05 16:37 [9fans] wiki editing via web browser andrey mirtchovski
2004-04-05 16:41 ` andrey mirtchovski
2004-04-05 17:49   ` Russ Cox
2004-04-05 17:41     ` a
2004-04-05 18:00       ` andrey mirtchovski
2004-04-05 18:18         ` David Tolpin
2004-04-05 18:43           ` andrey mirtchovski
2004-04-05 19:11             ` George Michaelson
2004-04-05 19:21               ` Axel Belinfante
2004-04-05 19:29               ` Roman Shaposhnick
2004-04-05 20:48                 ` Wes Kussmaul
2004-04-05 23:00                   ` 9nut
2004-04-06  0:39                 ` boyd, rounin
2004-04-06  2:05                   ` Roman Shaposhnick
2004-04-06 13:08                     ` Peter Bosch
2004-04-06 23:53                       ` Bruce Ellis
2004-04-07  7:25                       ` Roman Shaposhnick
2004-04-06  0:35               ` boyd, rounin
2004-04-05 21:51           ` boyd, rounin
2004-04-06 16:58         ` ron minnich
2004-04-06 14:06           ` Noah Evans
2004-04-06 17:18             ` andrey mirtchovski
2004-04-06 18:47               ` Russ Cox
2004-04-07  1:08           ` Geoff Collyer
2004-04-07  1:12             ` boyd, rounin
2004-04-05 18:07       ` 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).