| @@ -55,7 +55,6 @@ modes: int; · 54 unmodified lines |
| 55 | ream: int; | 55 | ream: int; |
| 56 | debug: int; | 56 | debug: int; |
| 57 | xflag: int; | 57 | xflag: int; |
| 58 | qflag := 1; | | |
| 59 | sfd: ref Sys->FD; | 58 | sfd: ref Sys->FD; |
| 60 | fskind: int; # Kfs, Fs, Archive | 59 | fskind: int; # Kfs, Fs, Archive |
| 61 | user: string; | 60 | user: string; |
| @@ -63,12 +62,6 @@ stderr: ref Sys->FD; · 1 unmodified line |
| 63 | usrid, grpid : string; | 62 | usrid, grpid : string; |
| 64 | setuid: int; | 63 | setuid: int; |
| 65 | | 64 | |
| 66 | usage() | | |
| 67 | { | | |
| 68 | fprint(stderr, "usage: %s [-apqrvx] [-d root] [-n kfsname] [-s src-fs] [-u userfile] [-z n] proto ...\n", prog); | | |
| 69 | quit("usage"); | | |
| 70 | } | | |
| 71 | | | |
| 72 | init(nil: ref Draw->Context, args: list of string) | 65 | init(nil: ref Draw->Context, args: list of string) |
| 73 | { | 66 | { |
| 74 | sys = load Sys Sys->PATH; | 67 | sys = load Sys Sys->PATH; |
| @@ -80,7 +73,7 @@ init(nil: ref Draw->Context, args: list of string) · 5 unmodified lines |
| 80 | | 73 | |
| 81 | stderr = sys->fildes(2); | 74 | stderr = sys->fildes(2); |
| 82 | if(arg == nil) | 75 | if(arg == nil) |
| 83 | error(sys->sprint("can't load %s: %r", Arg->PATH)); | 76 | error(sys->sprint("can't load %q: %r", Arg->PATH)); |
| 84 | | 77 | |
| 85 | user = getuser(); | 78 | user = getuser(); |
| 86 | if(user == nil) | 79 | if(user == nil) |
| @@ -95,6 +88,7 @@ init(nil: ref Draw->Context, args: list of string) · 8 unmodified lines |
| 95 | users = nil; | 88 | users = nil; |
| 96 | fskind = Kfs; # i suspect Inferno default should be different | 89 | fskind = Kfs; # i suspect Inferno default should be different |
| 97 | arg->init(args); | 90 | arg->init(args); |
| | 91 | arg->setusage("mkfs [-aprvxS] [-d root] [-n kfscmdname] [-s src-fs] [-u userfile] [-z n] [-G group] [-U user] proto ..."); |
| 98 | while((c := arg->opt()) != 0) | 92 | while((c := arg->opt()) != 0) |
| 99 | case c { | 93 | case c { |
| 100 | 'a' => | 94 | 'a' => |
| @@ -105,49 +99,52 @@ init(nil: ref Draw->Context, args: list of string) · 4 unmodified lines |
| 105 | error(sys->sprint("can't open standard output for archive: %r")); | 99 | error(sys->sprint("can't open standard output for archive: %r")); |
| 106 | 'd' => | 100 | 'd' => |
| 107 | fskind = Fs; | 101 | fskind = Fs; |
| 108 | newroot = reqarg("destination directory (-d)"); | 102 | newroot = arg->earg(); |
| 109 | 'D' => | 103 | 'D' => |
| 110 | debug = 1; | 104 | debug = 1; |
| 111 | 'n' => | 105 | 'n' => |
| 112 | name = reqarg("kfs instance name (-n)"); | 106 | name = arg->earg(); |
| 113 | 'p' => | 107 | 'p' => |
| 114 | modes = 1; | 108 | modes = 1; |
| 115 | 'q' => | 109 | 'q' => |
| 116 | qflag = 0; | 110 | ; |
| 117 | 'r' => | 111 | 'r' => |
| 118 | ream = 1; | 112 | ream = 1; |
| 119 | 's' => | 113 | 's' => |
| 120 | oldroot = reqarg("source directory (-d)"); | 114 | oldroot = arg->earg(); |
| 121 | 'u' => | 115 | 'u' => |
| 122 | users = reqarg("/adm/users file (-u)"); | 116 | users = arg->earg(); |
| 123 | 'v' => | 117 | 'v' => |
| 124 | verb = 1; | 118 | verb = 1; |
| 125 | 'x' => | 119 | 'x' => |
| 126 | xflag = 1; | 120 | xflag = 1; |
| 127 | 'z' => | 121 | 'z' => |
| 128 | (buflen, nil) = str->toint(reqarg("buffer length (-z)"), 10); | 122 | (buflen, nil) = str->toint(arg->earg(), 10); |
| 129 | buflen -= 8; # qid.path and tag at end of each kfs block | 123 | buflen -= 8; # qid.path and tag at end of each kfs block |
| 130 | 'U' => | 124 | 'U' => |
| 131 | usrid = reqarg("user name (-U)"); | 125 | usrid = arg->earg(); |
| 132 | 'G' => | 126 | 'G' => |
| 133 | grpid = reqarg("group name (-G)"); | 127 | grpid = arg->earg(); |
| 134 | 'S' => | 128 | 'S' => |
| 135 | setuid = 1; | 129 | setuid = 1; |
| 136 | * => | 130 | * => |
| 137 | usage(); | 131 | arg->usage(); |
| 138 | } | 132 | } |
| 139 | | 133 | |
| 140 | args = arg->argv(); | 134 | args = arg->argv(); |
| 141 | if(args == nil) | 135 | if(args == nil) |
| 142 | usage(); | 136 | arg->usage(); |
| 143 | | 137 | |
| 144 | buf = array [buflen] of byte; | 138 | buf = array [buflen] of byte; |
| 145 | zbuf = array [buflen] of { * => byte 0 }; | 139 | zbuf = array [buflen] of { * => byte 0 }; |
| 146 | | 140 | |
| 147 | mountkfs(name); | 141 | if(name != nil) |
| | 142 | openkfscmd(name); |
| 148 | kfscmd("allow"); | 143 | kfscmd("allow"); |
| 149 | proto = "users"; | 144 | if(users != nil){ |
| 150 | setusers(); | 145 | proto = "users"; # for diagnostics |
| | 146 | setusers(); |
| | 147 | } |
| 151 | cputype = getenv("cputype"); | 148 | cputype = getenv("cputype"); |
| 152 | if(cputype == nil) | 149 | if(cputype == nil) |
| 153 | cputype = "dis"; | 150 | cputype = "dis"; |
| @@ -159,7 +156,7 @@ init(nil: ref Draw->Context, args: list of string) · 5 unmodified lines |
| 159 | | 156 | |
| 160 | b = bufio->open(proto, Sys->OREAD); | 157 | b = bufio->open(proto, Sys->OREAD); |
| 161 | if(b == nil){ | 158 | if(b == nil){ |
| 162 | fprint(stderr, "%s: can't open %s: %r: skipping\n", prog, proto); | 159 | fprint(stderr, "%s: can't open %q: %r: skipping\n", prog, proto); |
| 163 | errs++; | 160 | errs++; |
| 164 | continue; | 161 | continue; |
| 165 | } | 162 | } |
| @@ -190,15 +187,6 @@ quit(why: string) · 24 unmodified lines |
| 190 | exit; | 187 | exit; |
| 191 | } | 188 | } |
| 192 | | 189 | |
| 193 | reqarg(what: string): string | | |
| 194 | { | | |
| 195 | if((o := arg->arg()) == nil){ | | |
| 196 | sys->fprint(stderr, "%s: missing %s\n", prog, what); | | |
| 197 | quit("usage"); | | |
| 198 | } | | |
| 199 | return o; | | |
| 200 | } | | |
| 201 | | | |
| 202 | mkfs(me: ref File, level: int) | 190 | mkfs(me: ref File, level: int) |
| 203 | { | 191 | { |
| 204 | (child, fp) := getfile(me); | 192 | (child, fp) := getfile(me); |
| @@ -227,7 +215,7 @@ mktree(me: ref File, rec: int, filesonly: int) · 22 unmodified lines |
| 227 | { | 215 | { |
| 228 | fd := sys->open(oldfile, Sys->OREAD); | 216 | fd := sys->open(oldfile, Sys->OREAD); |
| 229 | if(fd == nil){ | 217 | if(fd == nil){ |
| 230 | warn(sys->sprint("can't open %s: %r", oldfile)); | 218 | warn(sys->sprint("can't open %q: %r", oldfile)); |
| 231 | return; | 219 | return; |
| 232 | } | 220 | } |
| 233 | | 221 | |
| @@ -282,7 +270,7 @@ mkfile(f: ref File): int · 48 unmodified lines |
| 282 | { | 270 | { |
| 283 | (i, dir) := sys->stat(oldfile); | 271 | (i, dir) := sys->stat(oldfile); |
| 284 | if(i < 0){ | 272 | if(i < 0){ |
| 285 | warn(sys->sprint("can't stat file %s: %r", oldfile)); | 273 | warn(sys->sprint("can't stat file %q: %r", oldfile)); |
| 286 | skipdir(); | 274 | skipdir(); |
| 287 | return 0; | 275 | return 0; |
| 288 | } | 276 | } |
| @@ -294,7 +282,7 @@ copyfile(f: ref File, d: ref Dir, permonly: int): int · 5 unmodified lines |
| 294 | mode: int; | 282 | mode: int; |
| 295 | | 283 | |
| 296 | if(xflag && bout != nil){ | 284 | if(xflag && bout != nil){ |
| 297 | bout.puts(sys->sprint("%s\t%d\t%bd\n", quoted(f.new), d.mtime, d.length)); | 285 | bout.puts(sys->sprint("%q\t%d\t%bd\n", f.new, d.mtime, d.length)); |
| 298 | return (d.mode & Sys->DMDIR) != 0; | 286 | return (d.mode & Sys->DMDIR) != 0; |
| 299 | } | 287 | } |
| 300 | d.name = f.elem; | 288 | d.name = f.elem; |
| @@ -329,7 +317,7 @@ copyfile(f: ref File, d: ref Dir, permonly: int): int · 28 unmodified lines |
| 329 | mkdir(d); | 317 | mkdir(d); |
| 330 | else { | 318 | else { |
| 331 | if(verb) | 319 | if(verb) |
| 332 | fprint(stderr, "%s\n", f.new); | 320 | fprint(stderr, "%q\n", f.new); |
| 333 | copy(d); | 321 | copy(d); |
| 334 | } | 322 | } |
| 335 | }else if(modes){ | 323 | }else if(modes){ |
| @@ -338,7 +326,7 @@ copyfile(f: ref File, d: ref Dir, permonly: int): int · 2 unmodified lines |
| 338 | nd.mtime = d.mtime; | 326 | nd.mtime = d.mtime; |
| 339 | nd.gid = d.gid; | 327 | nd.gid = d.gid; |
| 340 | if(sys->wstat(newfile, nd) < 0) | 328 | if(sys->wstat(newfile, nd) < 0) |
| 341 | warn(sys->sprint("can't set modes for %s: %r", f.new)); | 329 | warn(sys->sprint("can't set modes for %q: %r", f.new)); |
| 342 | # do the uid separately since different file systems object | 330 | # do the uid separately since different file systems object |
| 343 | nd = sys->nulldir; | 331 | nd = sys->nulldir; |
| 344 | nd.uid = d.uid; | 332 | nd.uid = d.uid; |
| @@ -368,7 +356,7 @@ copy(d: ref Dir) · 23 unmodified lines |
| 368 | | 356 | |
| 369 | f := sys->open(oldfile, Sys->OREAD); | 357 | f := sys->open(oldfile, Sys->OREAD); |
| 370 | if(f == nil){ | 358 | if(f == nil){ |
| 371 | warn(sys->sprint("can't open %s: %r", oldfile)); | 359 | warn(sys->sprint("can't open %q: %r", oldfile)); |
| 372 | return; | 360 | return; |
| 373 | } | 361 | } |
| 374 | t = nil; | 362 | t = nil; |
| @@ -381,7 +369,7 @@ copy(d: ref Dir) · 6 unmodified lines |
| 381 | cptmp := dname+"__mkfstmp"; | 369 | cptmp := dname+"__mkfstmp"; |
| 382 | t = sys->create(cptmp, Sys->OWRITE, 8r666); | 370 | t = sys->create(cptmp, Sys->OWRITE, 8r666); |
| 383 | if(t == nil){ | 371 | if(t == nil){ |
| 384 | warn(sys->sprint("can't create %s: %r", newfile)); | 372 | warn(sys->sprint("can't create %q: %r", newfile)); |
| 385 | return; | 373 | return; |
| 386 | } | 374 | } |
| 387 | } | 375 | } |
| @@ -389,7 +377,7 @@ copy(d: ref Dir) · 1 unmodified line |
| 389 | for(tot := big 0;; tot += big n){ | 377 | for(tot := big 0;; tot += big n){ |
| 390 | n = sys->read(f, buf, buflen); | 378 | n = sys->read(f, buf, buflen); |
| 391 | if(n < 0){ | 379 | if(n < 0){ |
| 392 | warn(sys->sprint("can't read %s: %r", oldfile)); | 380 | warn(sys->sprint("can't read %q: %r", oldfile)); |
| 393 | break; | 381 | break; |
| 394 | } | 382 | } |
| 395 | if(n == 0) | 383 | if(n == 0) |
| @@ -399,9 +387,9 @@ copy(d: ref Dir) · 3 unmodified lines |
| 399 | error(sys->sprint("write error: %r")); | 387 | error(sys->sprint("write error: %r")); |
| 400 | }else if(buf[0:buflen] == zbuf[0:buflen]){ | 388 | }else if(buf[0:buflen] == zbuf[0:buflen]){ |
| 401 | if(sys->seek(t, big buflen, 1) < big 0) | 389 | if(sys->seek(t, big buflen, 1) < big 0) |
| 402 | error(sys->sprint("can't write zeros to %s: %r", newfile)); | 390 | error(sys->sprint("can't write zeros to %q: %r", newfile)); |
| 403 | }else if(sys->write(t, buf, n) < n) | 391 | }else if(sys->write(t, buf, n) < n) |
| 404 | error(sys->sprint("can't write %s: %r", newfile)); | 392 | error(sys->sprint("can't write %q: %r", newfile)); |
| 405 | } | 393 | } |
| 406 | f = nil; | 394 | f = nil; |
| 407 | if(tot != d.length){ | 395 | if(tot != d.length){ |
| @@ -420,11 +408,11 @@ copy(d: ref Dir) · 12 unmodified lines |
| 420 | nd.mode = d.mode; | 408 | nd.mode = d.mode; |
| 421 | nd.mtime = d.mtime; | 409 | nd.mtime = d.mtime; |
| 422 | if(sys->fwstat(t, nd) < 0) | 410 | if(sys->fwstat(t, nd) < 0) |
| 423 | error(sys->sprint("can't move tmp file to %s: %r", newfile)); | 411 | error(sys->sprint("can't move tmp file to %q: %r", newfile)); |
| 424 | nd = sys->nulldir; | 412 | nd = sys->nulldir; |
| 425 | nd.gid = d.gid; | 413 | nd.gid = d.gid; |
| 426 | if(sys->fwstat(t, nd) < 0) | 414 | if(sys->fwstat(t, nd) < 0) |
| 427 | warn(sys->sprint("can't set group id of %s to %s: %r", newfile, d.gid)); | 415 | warn(sys->sprint("can't set group id of %q to %q: %r", newfile, d.gid)); |
| 428 | nd.gid = nil; | 416 | nd.gid = nil; |
| 429 | nd.uid = d.uid; | 417 | nd.uid = d.uid; |
| 430 | sys->fwstat(t, nd); | 418 | sys->fwstat(t, nd); |
| @@ -444,16 +432,16 @@ mkdir(d: ref Dir) · 13 unmodified lines |
| 444 | if(fd == nil){ | 432 | if(fd == nil){ |
| 445 | (i, d1) := sys->stat(newfile); | 433 | (i, d1) := sys->stat(newfile); |
| 446 | if(i < 0 || !(d1.mode & Sys->DMDIR)) | 434 | if(i < 0 || !(d1.mode & Sys->DMDIR)) |
| 447 | error(sys->sprint("can't create %s", newfile)); | 435 | error(sys->sprint("can't create %q", newfile)); |
| 448 | if(sys->wstat(newfile, nd) < 0) | 436 | if(sys->wstat(newfile, nd) < 0) |
| 449 | warn(sys->sprint("can't set modes for %s: %r", newfile)); | 437 | warn(sys->sprint("can't set modes for %q: %r", newfile)); |
| 450 | nd = sys->nulldir; | 438 | nd = sys->nulldir; |
| 451 | nd.uid = d.uid; | 439 | nd.uid = d.uid; |
| 452 | sys->wstat(newfile, nd); | 440 | sys->wstat(newfile, nd); |
| 453 | return; | 441 | return; |
| 454 | } | 442 | } |
| 455 | if(sys->fwstat(fd, nd) < 0) | 443 | if(sys->fwstat(fd, nd) < 0) |
| 456 | warn(sys->sprint("can't set modes for %s: %r", newfile)); | 444 | warn(sys->sprint("can't set modes for %q: %r", newfile)); |
| 457 | nd = sys->nulldir; | 445 | nd = sys->nulldir; |
| 458 | nd.uid = d.uid; | 446 | nd.uid = d.uid; |
| 459 | sys->fwstat(fd, nd); | 447 | sys->fwstat(fd, nd); |
| @@ -461,8 +449,8 @@ mkdir(d: ref Dir) · 1 unmodified line |
| 461 | | 449 | |
| 462 | arch(d: ref Dir) | 450 | arch(d: ref Dir) |
| 463 | { | 451 | { |
| 464 | bout.puts(sys->sprint("%s %s %s %s %ud %bd\n", | 452 | bout.puts(sys->sprint("%q %uo %q %q %ud %bd\n", |
| 465 | quoted(newfile), octal(d.mode), d.uid, d.gid, d.mtime, d.length)); | 453 | newfile, d.mode, d.uid, d.gid, d.mtime, d.length)); |
| 466 | } | 454 | } |
| 467 | | 455 | |
| 468 | mkpath(prefix, elem: string): string | 456 | mkpath(prefix, elem: string): string |
| @@ -543,11 +531,11 @@ getfile(old: ref File): (ref File, big) · 74 unmodified lines |
| 543 | f = ref File; | 531 | f = ref File; |
| 544 | (elem, p) = getname(p); | 532 | (elem, p) = getname(p); |
| 545 | if(debug) | 533 | if(debug) |
| 546 | fprint(stderr, "getfile: %s root %s\n", elem, old.new); | 534 | fprint(stderr, "getfile: %q root %q\n", elem, old.new); |
| 547 | f.new = mkpath(old.new, elem); | 535 | f.new = mkpath(old.new, elem); |
| 548 | (nil, f.elem) = str->splitr(f.new, "/"); | 536 | (nil, f.elem) = str->splitr(f.new, "/"); |
| 549 | if(f.elem == nil) | 537 | if(f.elem == nil) |
| 550 | error(sys->sprint("can't find file name component of %s", f.new)); | 538 | error(sys->sprint("can't find file name component of %q", f.new)); |
| 551 | (f.mode, p) = getmode(p); | 539 | (f.mode, p) = getmode(p); |
| 552 | (f.uid, p) = getname(p); | 540 | (f.uid, p) = getname(p); |
| 553 | if(f.uid == nil) | 541 | if(f.uid == nil) |
| @@ -585,7 +573,7 @@ getname(p: string): (string, string) · 31 unmodified lines |
| 585 | for(; (c = p[0]) != '\n' && (c != ' ' && c != '\t' || quoted); p = p[1:]){ | 573 | for(; (c = p[0]) != '\n' && (c != ' ' && c != '\t' || quoted); p = p[1:]){ |
| 586 | if(quoted && c == '\'' && p[1] == '\'') | 574 | if(quoted && c == '\'' && p[1] == '\'') |
| 587 | p = p[1:]; | 575 | p = p[1:]; |
| 588 | else if(c == '\'' && qflag){ | 576 | else if(c == '\''){ |
| 589 | quoted = !quoted; | 577 | quoted = !quoted; |
| 590 | continue; | 578 | continue; |
| 591 | } | 579 | } |
| @@ -594,7 +582,7 @@ getname(p: string): (string, string) · 2 unmodified lines |
| 594 | if(len s > 0 && s[0] == '$'){ | 582 | if(len s > 0 && s[0] == '$'){ |
| 595 | s = getenv(s[1:]); | 583 | s = getenv(s[1:]); |
| 596 | if(s == nil) | 584 | if(s == nil) |
| 597 | error(sys->sprint("can't read environment variable %s", s)); | 585 | error(sys->sprint("can't read environment variable %q", s)); |
| 598 | } | 586 | } |
| 599 | return (s, p); | 587 | return (s, p); |
| 600 | } | 588 | } |
| @@ -654,13 +642,6 @@ getmode(p: string): (int, string) · 53 unmodified lines |
| 654 | return (m|v, p); | 642 | return (m|v, p); |
| 655 | } | 643 | } |
| 656 | | 644 | |
| 657 | quoted(s: string): string | | |
| 658 | { | | |
| 659 | if(qflag) | | |
| 660 | return sys->sprint("%q", s); | | |
| 661 | return s; | | |
| 662 | } | | |
| 663 | | | |
| 664 | setusers() | 645 | setusers() |
| 665 | { | 646 | { |
| 666 | if(fskind != Kfs) | 647 | if(fskind != Kfs) |
| @@ -693,30 +674,14 @@ setusers() · 26 unmodified lines |
| 693 | modes = m; | 674 | modes = m; |
| 694 | } | 675 | } |
| 695 | | 676 | |
| 696 | # this isn't right for the current #K | 677 | openkfscmd(name: string) |
| 697 | mountkfs(name: string) | | |
| 698 | { | 678 | { |
| 699 | kname: string; | | |
| 700 | | | |
| 701 | if(fskind != Kfs) | 679 | if(fskind != Kfs) |
| 702 | return; | 680 | return; |
| 703 | if(name != nil) | 681 | kname := sys->sprint("/chan/kfs.%s.cmd", name); |
| 704 | kname = sys->sprint("/srv/kfs.%s", name); | | |
| 705 | else | | |
| 706 | kname = "/srv/kfs"; | | |
| 707 | fd := sys->open(kname, Sys->ORDWR); | | |
| 708 | if(fd == nil){ | | |
| 709 | fprint(stderr, "%s: can't open %s: %r\n", prog, kname); | | |
| 710 | quit("open kfs"); | | |
| 711 | } | | |
| 712 | if(sys->mount(fd, nil, "/n/kfs", Sys->MREPL|Sys->MCREATE, "") < 0){ | | |
| 713 | fprint(stderr, "%s: can't mount kfs on /n/kfs: %r\n", prog); | | |
| 714 | quit("mount kfs"); | | |
| 715 | } | | |
| 716 | kname += ".cmd"; | | |
| 717 | sfd = sys->open(kname, Sys->ORDWR); | 682 | sfd = sys->open(kname, Sys->ORDWR); |
| 718 | if(sfd == nil){ | 683 | if(sfd == nil){ |
| 719 | fprint(stderr, "%s: can't open %s: %r\n", prog, kname); | 684 | fprint(stderr, "%s: can't open %q: %r\n", prog, kname); |
| 720 | quit("open kfscmd"); | 685 | quit("open kfscmd"); |
| 721 | } | 686 | } |
| 722 | } | 687 | } |
| @@ -747,7 +712,7 @@ kfscmd(cmd: string) · 24 unmodified lines |
| 747 | | 712 | |
| 748 | error(s: string) | 713 | error(s: string) |
| 749 | { | 714 | { |
| 750 | fprint(stderr, "%s: %s: %d: %s\n", prog, proto, lineno, s); | 715 | fprint(stderr, "%s: %s:%d: %s\n", prog, proto, lineno, s); |
| 751 | kfscmd("disallow"); | 716 | kfscmd("disallow"); |
| 752 | kfscmd("sync"); | 717 | kfscmd("sync"); |
| 753 | quit("error"); | 718 | quit("error"); |
| @@ -755,24 +720,13 @@ error(s: string) · 1 unmodified line |
| 755 | | 720 | |
| 756 | warn(s: string) | 721 | warn(s: string) |
| 757 | { | 722 | { |
| 758 | fprint(stderr, "%s: %s: %d: %s\n", prog, proto, lineno, s); | 723 | fprint(stderr, "%s: %s:%d: %s\n", prog, proto, lineno, s); |
| 759 | } | 724 | } |
| 760 | | 725 | |
| 761 | printfile(f: ref File) | 726 | printfile(f: ref File) |
| 762 | { | 727 | { |
| 763 | if(f.old != nil) | 728 | if(f.old != nil) |
| 764 | fprint(stderr, "%s from %s %s %s %s\n", f.new, f.old, f.uid, f.gid, octal(f.mode)); | 729 | fprint(stderr, "%q from %q %q %q %uo\n", f.new, f.old, f.uid, f.gid, f.mode); |
| 765 | else | 730 | else |
| 766 | fprint(stderr, "%s %s %s %s\n", f.new, f.uid, f.gid, octal(f.mode)); | 731 | fprint(stderr, "%q %q %q %uo\n", f.new, f.uid, f.gid, f.mode); |
| 767 | } | | |
| 768 | | | |
| 769 | octal(i: int): string | | |
| 770 | { | | |
| 771 | s := ""; | | |
| 772 | do { | | |
| 773 | t: string; | | |
| 774 | t[0] = '0' + (i&7); | | |
| 775 | s = t+s; | | |
| 776 | } while((i = (i>>3)&~(7<<29)) != 0); | | |
| 777 | return s; | | |
| 778 | } | 732 | } |