From 9f536032b01a1fd6f8509398c907e8b41463e86f Mon Sep 17 00:00:00 2001 From: Warren Toomey Date: Wed, 16 Mar 2016 09:42:44 +1000 Subject: [PATCH] Fixed stat so it works. --- build/proto | 4 ++-- src/other/wktstat.s | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/build/proto b/build/proto index 95ce9c0..0e3899c 100644 --- a/build/proto +++ b/build/proto @@ -11,8 +11,8 @@ # Contents of each directory ends with a $ on a line by itself # Format was inspired by 6th Edition mkfs # -dd drw-- -1 4 - system drw-- -1 3 +dd drwr- -1 4 + system drwr- -1 3 ttyin irwr- -1 6 keyboard irwr- -1 7 pptin irwr- -1 8 diff --git a/src/other/wktstat.s b/src/other/wktstat.s index d16ee6e..5d4e23b 100644 --- a/src/other/wktstat.s +++ b/src/other/wktstat.s @@ -12,7 +12,7 @@ main: dac name lac statbufptr " Get the file's details into the statbuf - sys status; statfile:0; 0 + sys status; curdir; statfile:0 spa jmp badfile @@ -32,15 +32,16 @@ main: sys write; l; 1 " Yes, print an l jmp 2f 1: lac fd1 - sys write; minus; 1 " Not a dir, not large, print an s + sys write; s; 1 " Not a dir, not large, print an s 2: lac s.perm " Readable by owner? and ureadmask sna jmp 1f lac fd1 -1: sys write; r; 1 " Yes, print an r + sys write; r; 1 " Yes, print an r jmp 2f +1: lac fd1 sys write; minus; 1 " No, print a - sign 2: lac s.perm " Writable by owner? @@ -77,6 +78,9 @@ main: sys write; space; 1 " Print a space lac s.nlinks " Print the number of links out + " but first make it positive + cma + tad d1 jms octal; -2 lac s.uid " Print the user-id out jms octal; -3 @@ -139,7 +143,7 @@ octal: 0 jmp octal i " and return from subroutine longopt: 0 " User set the -l option when this is 1 -fd1: 1 " File descriptor 1, stdout +d1: fd1: 1 " File descriptor 1, stdout d4: 4 d5: 5 d8: 8 @@ -177,3 +181,4 @@ w: 0167 minus: 055 space: 040 newline: 012 +curdir: <. 040; 040040; 040040; 040040 " i.e. "."