History

20090819-1812

forsyth committed 17 years ago

Commit 8ff71a01 parent e8d2d054 files · +16 −32Browse files

Unified · Split

4 files
  1. CHANGES +2 −0
  2. appl/cmd/mk/mk.b +14 −32
  3. dis/mk.dis +0 −0
  4. include/version.h +1 −1
CHANGES+2−0
@@ -1,3 +1,5 @@
1+20090819
2+ appl/cmd/mk/mk.b replace maketmp/mktemp (issue 202, mechiel); also old change: don't persist with bulkmtime on non-directories
13 20090816
24 registry(4) Event.post increased rootvers when entries are written or removed (issue 179, powerman)
35 20090809
appl/cmd/mk/mk.b+14−32
@@ -175,7 +175,7 @@ patrule: ref Rule; · 174 unmodified lines
175175 main(argc: int, argv: array of array of byte)
176176 {
177177 w: ref Word;
178− s, temp: array of byte;
178+ s: array of byte;
179179 files := array[256] of array of byte;
180180 f: array of array of byte = files;
181181 ff: int;
@@ -265,20 +265,15 @@ main(argc: int, argv: array of array of byte) · 83 unmodified lines
265265 #
266266 # assignment args become null strings
267267 #
268− temp = nil;
268+ temp: string;
269269 for(i = 0; argv[i] != nil; i++)
270270 if(libc0->strchr(argv[i], '=') != nil){
271271 bufcpy(buf, argv[i], libc0->strlen(argv[i]));
272272 insert(buf, ' ');
273273 if(tfd == nil){
274− temp = maketmp();
275− if(temp == nil){
276− perrors("temp file");
277− Exit();
278− }
279− sys->create(libc0->ab2s(temp), Sys->OWRITE, 8r600);
280− if((tfd = sys->open(libc0->ab2s(temp), 2)) == nil){
281− perror(temp);
274+ (temp, tfd) = tmpfile("/tmp/mkarg");
275+ if(tfd == nil){
276+ perror(array of byte temp);
282277 Exit();
283278 }
284279 tb = bufio->fopen(tfd, Sys->OWRITE);
@@ -290,7 +285,7 @@ main(argc: int, argv: array of array of byte) · 5 unmodified lines
290285 tb.flush();
291286 sys->seek(tfd, big 0, 0);
292287 parse(libc0->s2ab("command line args"), tfd, 1);
293− sys->remove(libc0->ab2s(temp));
288+ sys->remove(temp);
294289 }
295290 if(buf.current != 0){
296291 buf.current--;
@@ -424,20 +419,16 @@ stob(buf: array of byte, s: string) · 127 unmodified lines
424419 libc0->strncpy(buf, b, len buf);
425420 }
426421
427−mktemp(t: array of byte)
422+tmpfile(basename: string): (string, ref Sys->FD)
428423 {
429− x := libc0->strchr(t, 'X');
430− if(x == nil)
431− return;
432− pid := libc0->s2ab(string sys->pctl(0, nil));
433− for(i := 'a'; i <= 'z'; i++){
434− x[0] = byte i;
435− x = x[1: ];
436− libc0->strncpy(x, pid, libc0->strlen(x));
437− (ok, nil) := sys->stat(libc0->ab2s(t));
438− if(ok >= 0)
439− continue;
424+ pid := sys->pctl(0, nil);
425+ for(i := 0; i < 100; i++){
426+ t := basename+sys->sprint("%8.8d.%.2d", pid, i);
427+ fd := sys->create(t, Sys->OEXCL|Sys->ORDWR, 8r600);
428+ if(fd != nil)
429+ return (t, fd);
440430 }
431+ return (nil, nil);
441432 }
442433
443434 postnote(t: int, pid: int, note: array of byte)
@@ -3385,15 +3376,6 @@ catchnotes() · 2941 unmodified lines
33853376 # atnotify(notifyf, 1);
33863377 }
33873378
3388−temp := array[] of { byte '/', byte 't', byte 'm', byte 'p', byte '/', byte 'm', byte 'k', byte 'a', byte 'r', byte 'g', byte 'X', byte 'X', byte 'X', byte 'X', byte 'X', byte 'X', byte '\0' };
3389−
3390−maketmp(): array of byte
3391−{
3392− t := libc0->strdup(temp);
3393− mktemp(t);
3394− return t;
3395−}
3396−
33973379 chgtime(name: array of byte): int
33983380 {
33993381 (ok, nil) := sys->stat(libc0->ab2s(name));
dis/mk.dis+0−0

Binary file not shown.

include/version.h+1−1
@@ -1 +1 @@
1−#define VERSION "Fourth Edition (20090816)"
1+#define VERSION "Fourth Edition (20090819)"

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t