summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2009-05-17 15:28:42 +0000
committerCharles.Forsyth <devnull@localhost>2009-05-17 15:28:42 +0000
commitaf1b61f55a195350b4491438e8b2c381c4ba34bc (patch)
tree1d21834680a5c02e205d176c32dcf2a6f5db79fb
parent8d8ff66ed15c0d625b78f11a4feeeef6516937be (diff)
20090517-1627
-rw-r--r--appl/cmd/m4.b2
-rw-r--r--appl/lib/daytime.b43
-rw-r--r--dis/lib/daytime.disbin4701 -> 4809 bytes
-rw-r--r--dis/m4.disbin12287 -> 12287 bytes
-rw-r--r--emu/MacOSX/win.c8
-rw-r--r--man/2/itslib1
6 files changed, 38 insertions, 16 deletions
diff --git a/appl/cmd/m4.b b/appl/cmd/m4.b
index 39558384..bc992b4f 100644
--- a/appl/cmd/m4.b
+++ b/appl/cmd/m4.b
@@ -288,7 +288,7 @@ isname(s: string): int
isalpha(c: int): int
{
- return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '_' || c > 16r80;
+ return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '_' || c > 16rA0;
}
hash(name: string): int
diff --git a/appl/lib/daytime.b b/appl/lib/daytime.b
index 0e16073b..5fc62fc4 100644
--- a/appl/lib/daytime.b
+++ b/appl/lib/daytime.b
@@ -222,21 +222,26 @@ readtimezone(fname: string): ref Timezone
tz.stdiff = 0;
tz.stname = "GMT";
- fd: ref Sys->FD;
+ s: string;
if(fname == nil){
- fd = sys->open("/env/timezone", Sys->OREAD);
- if(fd == nil)
- fd = sys->open("/locale/timezone", Sys->OREAD);
- }else
- fd = sys->open("/locale/" + fname, sys->OREAD);
- if(fd == nil)
- return tz;
- buf := array[2048] of byte;
- cnt := sys->read(fd, buf, len buf);
- if(cnt <= 0)
+ s = readfile("/env/timezone");
+ if(s == nil)
+ s = readfile("/locale/timezone");
+ }else{
+ if(fname[0] != '/' && fname[0] != '#')
+ fname = "/locale/" + fname;
+ s = readfile(fname);
+ }
+ if(s == nil)
return tz;
-
- (n, val) := sys->tokenize(string buf[0:cnt], "\t \n\r");
+ if(s[0] == '/' || s[0] == '#'){
+ if(s[len s-1] == '\n')
+ s = s[0: len s-1];
+ s = readfile(s);
+ if(s == nil)
+ return tz;
+ }
+ (n, val) := sys->tokenize(s, "\t \n\r");
if(n < 4)
return tz;
@@ -255,6 +260,18 @@ readtimezone(fname: string): ref Timezone
return tz;
}
+readfile(name: string): string
+{
+ fd := sys->open(name, Sys->OREAD);
+ if(fd == nil)
+ return nil;
+ buf := array[2048] of byte;
+ n := sys->read(fd, buf, len buf);
+ if(n <= 0)
+ return nil;
+ return string buf[0:n];
+}
+
SEC2MIN: con 60;
SEC2HOUR: con 60*SEC2MIN;
SEC2DAY: con 24*SEC2HOUR;
diff --git a/dis/lib/daytime.dis b/dis/lib/daytime.dis
index 4b8c6daa..912759dd 100644
--- a/dis/lib/daytime.dis
+++ b/dis/lib/daytime.dis
Binary files differ
diff --git a/dis/m4.dis b/dis/m4.dis
index b3163800..f3d48da9 100644
--- a/dis/m4.dis
+++ b/dis/m4.dis
Binary files differ
diff --git a/emu/MacOSX/win.c b/emu/MacOSX/win.c
index 41ca8d9d..137ab275 100644
--- a/emu/MacOSX/win.c
+++ b/emu/MacOSX/win.c
@@ -305,7 +305,7 @@ static WindowRef oldWindow = NULL;
static void
leave_full_screen(void)
{
- if (0 && amFullScreen) {
+ if(amFullScreen){
EndFullScreen(fullScreenRestore, 0);
theWindow = oldWindow;
ShowWindow(theWindow);
@@ -321,7 +321,7 @@ leave_full_screen(void)
static void
full_screen(void)
{
- if (0 && !amFullScreen) {
+ if(!amFullScreen){
oldWindow = theWindow;
HideWindow(theWindow);
BeginFullScreen(&fullScreenRestore, 0, 0, 0, &theWindow, 0, 0);
@@ -626,6 +626,8 @@ clipread(void)
int i;
char *s;
+ if(appleclip == NULL)
+ return nil;
// Wow. This is ridiculously complicated.
PasteboardSynchronize(appleclip);
if((err = PasteboardGetItemCount(appleclip, &nitems)) != noErr) {
@@ -681,6 +683,8 @@ clipwrite(char *snarf)
CFDataRef cfdata;
PasteboardSyncFlags flags;
+ if(appleclip == NULL)
+ return 0;
runeseprint(rsnarf, rsnarf+nelem(rsnarf), "%s", snarf);
if(PasteboardClear(appleclip) != noErr){
fprint(2, "apple pasteboard clear failed\n");
diff --git a/man/2/itslib b/man/2/itslib
index a1f62b49..a98602c4 100644
--- a/man/2/itslib
+++ b/man/2/itslib
@@ -1,4 +1,5 @@
.TH ITSLIB 2
+.SH NAME
itslib \- test library
.SH SYNOPSIS
.EX