Unified · Split
| @@ -1,5 +1,8 @@ | ||
| 1 | 1 | 20080116 |
| 2 | 2 | add rsa to factotum |
| 3 | + set but not used changes from Acme-sac | |
| 4 | + mdb(1) changes from Acme-sac | |
| 5 | + ftpfs uses new dial(2) | |
| 3 | 6 | 20080115 |
| 4 | 7 | add blowfish to keyring (not yet documented) |
| 5 | 8 | add explicit public and private key types to keyring (in development: not yet documented) |
| @@ -125,7 +125,7 @@ init(nil: ref Draw->Context, args: list of string) · 124 unmodified lines | ||
| 125 | 125 | fatal("can't create pipe"); |
| 126 | 126 | pidch := chan of int; |
| 127 | 127 | spawn serve(p[1], pidch); |
| 128 | − pid := <- pidch; | |
| 128 | + <- pidch; | |
| 129 | 129 | if(sys->mount(p[0], nil, mtpt, flags, nil) < 0) |
| 130 | 130 | fatal(sys->sprint("cannot mount archive on %s: %r", mtpt)); |
| 131 | 131 | } |
| @@ -206,7 +206,6 @@ getuser(id: string): (string, array of byte, int, string) · 205 unmodified lines | ||
| 206 | 206 | if(sys->read(fd, secret, len secret) != len secret) |
| 207 | 207 | return (nil, nil, 0, sys->sprint("error reading %s/secret: %r", id)); |
| 208 | 208 | } |
| 209 | − expiry := 0; | |
| 210 | 209 | fd = sys->open(dbdir+"/expire", Sys->OREAD); |
| 211 | 210 | if(fd == nil) |
| 212 | 211 | return (nil, nil, 0, sys->sprint("can't open %s/expiry: %r", id)); |
| @@ -116,7 +116,7 @@ worker(file: ref Sys->FileIO, user: string, exitc: chan of int) · 115 unmodified lines | ||
| 116 | 116 | for(;;)alt{ |
| 117 | 117 | <-exitc => |
| 118 | 118 | exit; |
| 119 | − (nil, nbytes, fid, rc) := <-file.read => | |
| 119 | + (nil, nil, nil, rc) := <-file.read => | |
| 120 | 120 | if(rc == nil) |
| 121 | 121 | break; |
| 122 | 122 | if(err != nil){ |
| @@ -124,7 +124,7 @@ worker(file: ref Sys->FileIO, user: string, exitc: chan of int) · 1 unmodified line | ||
| 124 | 124 | break; |
| 125 | 125 | } |
| 126 | 126 | rc <-= (nil, nil); |
| 127 | − (nil, data, fid, wc) := <-file.write => | |
| 127 | + (nil, data, nil, wc) := <-file.write => | |
| 128 | 128 | if(wc == nil) |
| 129 | 129 | break; |
| 130 | 130 | if(err != nil){ |
| @@ -80,7 +80,7 @@ init(nil: ref Draw->Context, args: list of string) · 79 unmodified lines | ||
| 80 | 80 | sys->print("key owner: %s\n", ai.mypk.owner); |
| 81 | 81 | |
| 82 | 82 | sys->pctl(Sys->FORKNS|Sys->FORKFD, nil); |
| 83 | − remid := mountsrv(ai); | |
| 83 | + mountsrv(ai); | |
| 84 | 84 | |
| 85 | 85 | # get password |
| 86 | 86 | ok: int; |
| @@ -224,7 +224,7 @@ netmkaddr(addr, net, svc: string): string · 137 unmodified lines | ||
| 224 | 224 | { |
| 225 | 225 | if(net == nil) |
| 226 | 226 | net = "net"; |
| 227 | − (n, l) := sys->tokenize(addr, "!"); | |
| 227 | + (n, nil) := sys->tokenize(addr, "!"); | |
| 228 | 228 | if(n <= 1){ |
| 229 | 229 | if(svc== nil) |
| 230 | 230 | return sys->sprint("%s!%s", net, addr); |
| @@ -156,7 +156,7 @@ netmkaddr(addr, net, svc: string): string · 155 unmodified lines | ||
| 156 | 156 | { |
| 157 | 157 | if(net == nil) |
| 158 | 158 | net = "net"; |
| 159 | − (n, l) := sys->tokenize(addr, "!"); | |
| 159 | + (n, nil) := sys->tokenize(addr, "!"); | |
| 160 | 160 | if(n <= 1){ |
| 161 | 161 | if(svc== nil) |
| 162 | 162 | return sys->sprint("%s!%s", net, addr); |
| @@ -120,7 +120,7 @@ init(nil: ref Draw->Context, args: list of string) · 119 unmodified lines | ||
| 120 | 120 | |
| 121 | 121 | df := bufio->open(file, Sys->OREAD); |
| 122 | 122 | if(df == nil && empty){ |
| 123 | − (rc, d) := sys->stat(file); | |
| 123 | + (rc, nil) := sys->stat(file); | |
| 124 | 124 | if(rc < 0) |
| 125 | 125 | df = bufio->create(file, Sys->OREAD, 8r600); |
| 126 | 126 | } |
| @@ -32,8 +32,7 @@ init(nil: ref Draw->Context, argv: list of string) · 31 unmodified lines | ||
| 32 | 32 | readdir := load Readdir Readdir->PATH; |
| 33 | 33 | if(readdir == nil) |
| 34 | 34 | error(sys->sprint("can't load %s: %r", Readdir->PATH)); |
| 35 | − (a, n) := readdir->init("/env", | |
| 36 | − Readdir->NONE | Readdir->COMPACT | Readdir->DESCENDING); | |
| 35 | + (a, nil) := readdir->init("/env", Readdir->NONE | Readdir->COMPACT | Readdir->DESCENDING); | |
| 37 | 36 | for(i := 0; i < len a; i++){ |
| 38 | 37 | s := a[i].name+"="+env->getenv(a[i].name)+"\n"; |
| 39 | 38 | b := array of byte s; |
| @@ -145,7 +145,7 @@ gzip(nil: string, nil: int, bin, bout: ref Iobuf, fin, fout: string): int · 144 unmodified lines | ||
| 145 | 145 | if (debug) |
| 146 | 146 | param += "dv"; |
| 147 | 147 | rq := deflate->start(param); |
| 148 | − crc := 0; | |
| 148 | + | |
| 149 | 149 | for (;;) { |
| 150 | 150 | pick m := <-rq { |
| 151 | 151 | Fill => |
| @@ -116,7 +116,7 @@ init(ctxt: ref Draw->Context, args: list of string) · 115 unmodified lines | ||
| 116 | 116 | else rs = "s"; |
| 117 | 117 | mreport(0, S_INFO, 2, sys->sprint("Starting tests - %s run%s of %d test%s", reps, rs, len testlist, ts)); |
| 118 | 118 | run := big 1; |
| 119 | − tlist := testlist; | |
| 119 | + | |
| 120 | 120 | if (recroot != nil) |
| 121 | 121 | recn := highest(recroot) + 1; |
| 122 | 122 | while (repcount == 0 || run <= big repcount) { |
| @@ -259,7 +259,7 @@ runtest(t: ref Test) · 136 unmodified lines | ||
| 259 | 259 | { |
| 260 | 260 | if (t.failed) |
| 261 | 261 | return; |
| 262 | − path := t.fullspec; | |
| 262 | + | |
| 263 | 263 | if (cflag != -1) { |
| 264 | 264 | mreport(0, S_INFO, 7, sys->sprint("Setting cflag to %d", cflag)); |
| 265 | 265 | set_cflag(cflag); |
| @@ -270,7 +270,7 @@ runtest(t: ref Test) · 4 unmodified lines | ||
| 270 | 270 | display_file(readme); |
| 271 | 271 | sync := chan of int; |
| 272 | 272 | spawn monitor(t, sync); |
| 273 | − pid := <-sync; | |
| 273 | + <-sync; | |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | monitor(t: ref Test, sync: chan of int) |
| @@ -299,7 +299,7 @@ monitor(t: ref Test, sync: chan of int) · 22 unmodified lines | ||
| 299 | 299 | etime := -1; |
| 300 | 300 | rsync := chan of int; |
| 301 | 301 | spawn runit(t.fullspec, t.stdout, t.stderr, t.spec, pa[0], rsync); |
| 302 | − rpid := <-rsync; | |
| 302 | + <-rsync; | |
| 303 | 303 | pa[0] = nil; |
| 304 | 304 | (nwarns, nerrors, nfatals) := (0, 0, 0); |
| 305 | 305 | while (1) { |
| @@ -144,7 +144,7 @@ replay_msgs(mfile: string, tspec: string, cflag: int) · 143 unmodified lines | ||
| 144 | 144 | return; |
| 145 | 145 | (nwarns, nerrors, nfatals) := (0, 0, 0); |
| 146 | 146 | stime := 0; |
| 147 | − etime := 0; | |
| 147 | + | |
| 148 | 148 | while ((line := mf.gets('\n')) != nil) { |
| 149 | 149 | (whens, rest) := str->splitl(line, ":"); |
| 150 | 150 | when := int whens; |
| @@ -87,7 +87,7 @@ logserver(fio: ref Sys->FileIO, bufsize: int) · 86 unmodified lines | ||
| 87 | 87 | for (;;) alt { |
| 88 | 88 | <-availchan => |
| 89 | 89 | availcount++; |
| 90 | − (off, count, fid, rc) := <-fio.read => | |
| 90 | + (nil, count, fid, rc) := <-fio.read => | |
| 91 | 91 | r := readers.get(fid); |
| 92 | 92 | if (rc == nil) { |
| 93 | 93 | if (r != nil) |
| @@ -112,7 +112,7 @@ logserver(fio: ref Sys->FileIO, bufsize: int) · 18 unmodified lines | ||
| 112 | 112 | r.rq = (count, rc) :: r.rq; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | − (off, data, fid, wc) := <-fio.write => | |
| 115 | + (nil, data, nil, wc) := <-fio.write => | |
| 116 | 116 | if (wc == nil) |
| 117 | 117 | continue; |
| 118 | 118 | if ((n := buf.put(data)) < len data) |
| @@ -11,6 +11,16 @@ include "string.m"; · 10 unmodified lines | ||
| 11 | 11 | include "bufio.m"; |
| 12 | 12 | bufio: Bufio; |
| 13 | 13 | Iobuf: import bufio; |
| 14 | +include "dis.m"; | |
| 15 | + dis: Dis; | |
| 16 | + Inst, Type, Data, Link, Mod: import dis; | |
| 17 | + XMAGIC: import Dis; | |
| 18 | + MUSTCOMPILE, DONTCOMPILE: import Dis; | |
| 19 | + AMP, AFP, AIMM, AXXX, AIND, AMASK: import Dis; | |
| 20 | + ARM, AXNON, AXIMM, AXINF, AXINM: import Dis; | |
| 21 | + DEFB, DEFW, DEFS, DEFF, DEFA, DIND, DAPOP, DEFL: import Dis; | |
| 22 | +disfile: string; | |
| 23 | +m: ref Mod; | |
| 14 | 24 | |
| 15 | 25 | Mdb: module |
| 16 | 26 | { |
| @@ -151,9 +161,29 @@ docmd(s: string) · 134 unmodified lines | ||
| 151 | 161 | writemem(2, s[2:]); |
| 152 | 162 | 'W' => |
| 153 | 163 | writemem(4, s[2:]); |
| 164 | + 'i' => | |
| 165 | + das(); | |
| 154 | 166 | * => |
| 155 | 167 | dumpmem(s[1:], cmd); |
| 156 | 168 | } |
| 169 | + '$' => | |
| 170 | + case s[1] { | |
| 171 | + 'D' => | |
| 172 | + desc(); | |
| 173 | + 'h' => | |
| 174 | + hdr(); | |
| 175 | + 'l' => | |
| 176 | + link(); | |
| 177 | + 'i' => | |
| 178 | + imports(); | |
| 179 | + 'd' => | |
| 180 | + dat(); | |
| 181 | + 'H' => | |
| 182 | + handlers(); | |
| 183 | + 's' => | |
| 184 | + if(m != nil) | |
| 185 | + print("%s\n", m.srcpath); | |
| 186 | + } | |
| 157 | 187 | '=' => |
| 158 | 188 | dumpmem(s[1:], cmd); |
| 159 | 189 | * => |
| @@ -294,6 +324,8 @@ init(nil: ref Draw->Context, argv: list of string) · 134 unmodified lines | ||
| 294 | 324 | sys->fprint(stderr, "mdb: cannot load %s: %r\n", Bufio->PATH); |
| 295 | 325 | raise "fail:bad module"; |
| 296 | 326 | } |
| 327 | + dis = load Dis Dis->PATH; | |
| 328 | + dis->init(); | |
| 297 | 329 | |
| 298 | 330 | if (len argv < 2) |
| 299 | 331 | usage(); |
| @@ -321,6 +353,7 @@ init(nil: ref Draw->Context, argv: list of string) · 21 unmodified lines | ||
| 321 | 353 | sys->fprint(stderr, "mdb: cannot open %s: %r\n", fname); |
| 322 | 354 | raise "fail:cannot open"; |
| 323 | 355 | } |
| 356 | + (m, nil) = dis->loadobj(fname); | |
| 324 | 357 | |
| 325 | 358 | if(cmd != nil) |
| 326 | 359 | docmd(cmd); |
| @@ -333,3 +366,172 @@ init(nil: ref Draw->Context, argv: list of string) · 6 unmodified lines | ||
| 333 | 366 | } |
| 334 | 367 | } |
| 335 | 368 | } |
| 369 | + | |
| 370 | +link() | |
| 371 | +{ | |
| 372 | + if(m == nil || m.magic == 0) | |
| 373 | + return; | |
| 374 | + | |
| 375 | + for(i := 0; i < m.lsize; i++) { | |
| 376 | + l := m.links[i]; | |
| 377 | + print(" link %d,%d, 0x%ux, \"%s\"\n", | |
| 378 | + l.desc, l.pc, l.sig, l.name); | |
| 379 | + } | |
| 380 | +} | |
| 381 | + | |
| 382 | +imports() | |
| 383 | +{ | |
| 384 | + if(m == nil || m.magic == 0) | |
| 385 | + return; | |
| 386 | + | |
| 387 | + mi := m.imports; | |
| 388 | + for(i := 0; i < len mi; i++) { | |
| 389 | + a := mi[i]; | |
| 390 | + for(j := 0; j < len a; j++) { | |
| 391 | + ai := a[j]; | |
| 392 | + print(" import 0x%ux, \"%s\"\n", ai.sig, ai.name); | |
| 393 | + } | |
| 394 | + } | |
| 395 | +} | |
| 396 | + | |
| 397 | +handlers() | |
| 398 | +{ | |
| 399 | + if(m == nil || m.magic == 0) | |
| 400 | + return; | |
| 401 | + | |
| 402 | + hs := m.handlers; | |
| 403 | + for(i := 0; i < len hs; i++) { | |
| 404 | + h := hs[i]; | |
| 405 | + tt := -1; | |
| 406 | + for(j := 0; j < len m.types; j++) { | |
| 407 | + if(h.t == m.types[j]) { | |
| 408 | + tt = j; | |
| 409 | + break; | |
| 410 | + } | |
| 411 | + } | |
| 412 | + print(" %d-%d, o=%d, e=%d t=%d\n", h.pc1, h.pc2, h.eoff, h.ne, tt); | |
| 413 | + et := h.etab; | |
| 414 | + for(j = 0; j < len et; j++) { | |
| 415 | + e := et[j]; | |
| 416 | + if(e.s == nil) | |
| 417 | + print(" %d *\n", e.pc); | |
| 418 | + else | |
| 419 | + print(" %d \"%s\"\n", e.pc, e.s); | |
| 420 | + } | |
| 421 | + } | |
| 422 | +} | |
| 423 | + | |
| 424 | +desc() | |
| 425 | +{ | |
| 426 | + if(m == nil || m.magic == 0) | |
| 427 | + return; | |
| 428 | + | |
| 429 | + for(i := 0; i < m.tsize; i++) { | |
| 430 | + h := m.types[i]; | |
| 431 | + s := sprint(" desc $%d, %d, \"", i, h.size); | |
| 432 | + for(j := 0; j < h.np; j++) | |
| 433 | + s += sprint("%.2ux", int h.map[j]); | |
| 434 | + s += "\"\n"; | |
| 435 | + print("%s", s); | |
| 436 | + } | |
| 437 | +} | |
| 438 | + | |
| 439 | +hdr() | |
| 440 | +{ | |
| 441 | + if(m == nil || m.magic == 0) | |
| 442 | + return; | |
| 443 | + s := sprint("%.8ux Version %d Dis VM\n", m.magic, m.magic - XMAGIC + 1); | |
| 444 | + s += sprint("%.8ux Runtime flags %s\n", m.rt, rtflag(m.rt)); | |
| 445 | + s += sprint("%8d bytes per stack extent\n\n", m.ssize); | |
| 446 | + | |
| 447 | + | |
| 448 | + s += sprint("%8d instructions\n", m.isize); | |
| 449 | + s += sprint("%8d data size\n", m.dsize); | |
| 450 | + s += sprint("%8d heap type descriptors\n", m.tsize); | |
| 451 | + s += sprint("%8d link directives\n", m.lsize); | |
| 452 | + s += sprint("%8d entry pc\n", m.entry); | |
| 453 | + s += sprint("%8d entry type descriptor\n\n", m.entryt); | |
| 454 | + | |
| 455 | + if(m.sign == nil) | |
| 456 | + s += "Module is Insecure\n"; | |
| 457 | + print("%s", s); | |
| 458 | +} | |
| 459 | + | |
| 460 | +rtflag(flag: int): string | |
| 461 | +{ | |
| 462 | + if(flag == 0) | |
| 463 | + return ""; | |
| 464 | + | |
| 465 | + s := "["; | |
| 466 | + | |
| 467 | + if(flag & MUSTCOMPILE) | |
| 468 | + s += "MustCompile"; | |
| 469 | + if(flag & DONTCOMPILE) { | |
| 470 | + if(flag & MUSTCOMPILE) | |
| 471 | + s += "|"; | |
| 472 | + s += "DontCompile"; | |
| 473 | + } | |
| 474 | + s[len s] = ']'; | |
| 475 | + | |
| 476 | + return s; | |
| 477 | +} | |
| 478 | + | |
| 479 | +das() | |
| 480 | +{ | |
| 481 | + if(m == nil || m.magic == 0) | |
| 482 | + return; | |
| 483 | + | |
| 484 | + for(i := dot; count-- > 0 && i < m.isize; i++) { | |
| 485 | + if(i % 10 == 0) | |
| 486 | + print("#%d\n", i); | |
| 487 | + print("\t%s\n", dis->inst2s(m.inst[i])); | |
| 488 | + } | |
| 489 | +} | |
| 490 | + | |
| 491 | +dat() | |
| 492 | +{ | |
| 493 | + if(m == nil || m.magic == 0) | |
| 494 | + return; | |
| 495 | + print(" var @mp, %d\n", m.types[0].size); | |
| 496 | + | |
| 497 | + s := ""; | |
| 498 | + for(d := m.data; d != nil; d = tl d) { | |
| 499 | + pick dat := hd d { | |
| 500 | + Bytes => | |
| 501 | + s = sprint("\tbyte @mp+%d", dat.off); | |
| 502 | + for(n := 0; n < dat.n; n++) | |
| 503 | + s += sprint(",%d", int dat.bytes[n]); | |
| 504 | + Words => | |
| 505 | + s = sprint("\tword @mp+%d", dat.off); | |
| 506 | + for(n := 0; n < dat.n; n++) | |
| 507 | + s += sprint(",%d", dat.words[n]); | |
| 508 | + String => | |
| 509 | + s = sprint("\tstring @mp+%d, \"%s\"", dat.off, mapstr(dat.str)); | |
| 510 | + Reals => | |
| 511 | + s = sprint("\treal @mp+%d", dat.off); | |
| 512 | + for(n := 0; n < dat.n; n++) | |
| 513 | + s += sprint(", %g", dat.reals[n]); | |
| 514 | + break; | |
| 515 | + Array => | |
| 516 | + s = sprint("\tarray @mp+%d,$%d,%d", dat.off, dat.typex, dat.length); | |
| 517 | + Aindex => | |
| 518 | + s = sprint("\tindir @mp+%d,%d", dat.off, dat.index); | |
| 519 | + Arestore => | |
| 520 | + s = "\tapop"; | |
| 521 | + break; | |
| 522 | + Bigs => | |
| 523 | + s = sprint("\tlong @mp+%d", dat.off); | |
| 524 | + for(n := 0; n < dat.n; n++) | |
| 525 | + s += sprint(", %bd", dat.bigs[n]); | |
| 526 | + } | |
| 527 | + print("%s\n", s); | |
| 528 | + } | |
| 529 | +} | |
| 530 | + | |
| 531 | +mapstr(s: string): string | |
| 532 | +{ | |
| 533 | + for(i := 0; i < len s; i++) | |
| 534 | + if(s[i] == '\n') | |
| 535 | + s = s[0:i] + "\\n" + s[i+1:]; | |
| 536 | + return s; | |
| 537 | +} | |
| @@ -217,7 +217,7 @@ memfs(maxsz : int, tc : chan of ref Tmsg, srv : ref Styxserver, sync: chan of in · 216 unmodified lines | ||
| 217 | 217 | c.mode = tm.mode; |
| 218 | 218 | c.qid.vers = mf.qid.vers; |
| 219 | 219 | mf.nopen++; |
| 220 | − if (tm.mode & OTRUNC) { | |
| 220 | + if ((tm.mode & OTRUNC) && !(mf.perm & Sys->DMAPPEND)) { | |
| 221 | 221 | # OTRUNC cannot be set for a directory |
| 222 | 222 | # always at least one blk so don't need to check fs limit |
| 223 | 223 | freeblks += (len mf.data); |
| @@ -321,7 +321,7 @@ memfs(maxsz : int, tc : chan of ref Tmsg, srv : ref Styxserver, sync: chan of in · 97 unmodified lines | ||
| 321 | 321 | } |
| 322 | 322 | srv.reply(ref Rmsg.Clunk(tm.tag)); |
| 323 | 323 | Stat => |
| 324 | − (err, c, mf) := fidtomf(srv, qhash, tm.fid); | |
| 324 | + (err, nil, mf) := fidtomf(srv, qhash, tm.fid); | |
| 325 | 325 | if (err != nil) { |
| 326 | 326 | srv.reply(ref Rmsg.Error(tm.tag, err)); |
| 327 | 327 | continue; |
| @@ -354,7 +354,7 @@ memfs(maxsz : int, tc : chan of ref Tmsg, srv : ref Styxserver, sync: chan of in · 26 unmodified lines | ||
| 354 | 354 | Wstat => |
| 355 | 355 | (err, c, mf) := fidtomf(srv, qhash, tm.fid); |
| 356 | 356 | stat := tm.stat; |
| 357 | − perm := mf.perm & ~Sys->DMDIR; | |
| 357 | + | |
| 358 | 358 | if (err == nil && stat.name != mf.name) { |
| 359 | 359 | parent := mf.parent; |
| 360 | 360 | if (!modeok(OWRITE, parent.perm, c.uname, parent.owner)) |
| @@ -29,7 +29,7 @@ init(nil: ref Draw->Context, argv: list of string) · 28 unmodified lines | ||
| 29 | 29 | for(; argv != nil; argv = tl argv){ |
| 30 | 30 | dir := hd argv; |
| 31 | 31 | if(!pflag){ |
| 32 | − (ok, d) := sys->stat(dir); | |
| 32 | + (ok, nil) := sys->stat(dir); | |
| 33 | 33 | if(ok < 0){ |
| 34 | 34 | if(mkdir(dir) < 0) |
| 35 | 35 | e = "error"; |
| @@ -79,7 +79,7 @@ walk1(c: ref Fid, name: string): string · 78 unmodified lines | ||
| 79 | 79 | decref(c.path); |
| 80 | 80 | c.walk(Sys->Qid(Qroot, 0, Sys->QTDIR)); |
| 81 | 81 | } else if (c.path == Qroot) { |
| 82 | − (d, err) := nav.walk(c.path, name); | |
| 82 | + (d, nil) := nav.walk(c.path, name); | |
| 83 | 83 | if (d == nil) |
| 84 | 84 | d = addentry(name); |
| 85 | 85 | else |
| @@ -49,8 +49,8 @@ init(nil: ref Draw->Context, argv: list of string) · 48 unmodified lines | ||
| 49 | 49 | usage(); |
| 50 | 50 | |
| 51 | 51 | argv = tl argv; |
| 52 | − def := 0; | |
| 53 | − baud := 0; | |
| 52 | + | |
| 53 | + | |
| 54 | 54 | while (argv != nil && len (arg := hd argv) > 1 && arg[0] == '-') { |
| 55 | 55 | case arg[1] { |
| 56 | 56 | 'D' => |
| @@ -113,7 +113,6 @@ mv(from,todir,toelem : string): int · 112 unmodified lines | ||
| 113 | 113 | sys->fprint(stderr, "mv: can't open %s: %r\n", fromname); |
| 114 | 114 | return -1; |
| 115 | 115 | } |
| 116 | − (j,dirt):=sys->stat(toname); | |
| 117 | 116 | fdt := sys->create(toname, Sys->OWRITE, dirb.mode); |
| 118 | 117 | if(fdt == nil){ |
| 119 | 118 | sys->fprint(stderr, "mv: can't create %s: %r\n", toname); |
| @@ -52,7 +52,7 @@ init(nil: ref Draw->Context, argv: list of string) · 51 unmodified lines | ||
| 52 | 52 | server(fio: ref Sys->FileIO, data: array of byte) |
| 53 | 53 | { |
| 54 | 54 | for (;;) alt { |
| 55 | − (offset, count, fid, rc) := <-fio.read => | |
| 55 | + (offset, count, nil, rc) := <-fio.read => | |
| 56 | 56 | if (rc != nil) { |
| 57 | 57 | if (offset > len data) |
| 58 | 58 | rc <-= (nil, nil); |
| @@ -63,7 +63,7 @@ server(fio: ref Sys->FileIO, data: array of byte) · 4 unmodified lines | ||
| 63 | 63 | rc <-= (data[offset:end], nil); |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | − (offset, d, fid, wc) := <-fio.write => | |
| 66 | + (offset, d, nil, wc) := <-fio.write => | |
| 67 | 67 | if (wc != nil) { |
| 68 | 68 | if (offset == 0) |
| 69 | 69 | data = array[0] of byte; |
| @@ -141,7 +141,7 @@ netmkaddr(addr, net, svc: string): string · 140 unmodified lines | ||
| 141 | 141 | { |
| 142 | 142 | if(net == nil) |
| 143 | 143 | net = "net"; |
| 144 | − (n, l) := sys->tokenize(addr, "!"); | |
| 144 | + (n, nil) := sys->tokenize(addr, "!"); | |
| 145 | 145 | if(n <= 1){ |
| 146 | 146 | if(svc== nil) |
| 147 | 147 | return sys->sprint("%s!%s", net, addr); |
| @@ -155,7 +155,7 @@ stdsym(m: ref Module) · 154 unmodified lines | ||
| 155 | 155 | } |
| 156 | 156 | if(dism != nil && (sp := dism->src(dis)) != nil){ |
| 157 | 157 | sp = sp[0: len sp - 1] + "sbl"; |
| 158 | − (sym, err) := debug->sym(sp); | |
| 158 | + (sym, nil) := debug->sym(sp); | |
| 159 | 159 | if (sym != nil) { |
| 160 | 160 | m.addsym(sym); |
| 161 | 161 | return; |
| @@ -167,7 +167,7 @@ stdsym(m: ref Module) · 5 unmodified lines | ||
| 167 | 167 | sblpath = sblpath + dis[len dispath:]; |
| 168 | 168 | if (len sblpath > 4 && sblpath[len sblpath - 4:] == ".dis") |
| 169 | 169 | sblpath = sblpath[0:len sblpath - 4] + ".sbl"; |
| 170 | − (sym, err) := debug->sym(sblpath); | |
| 170 | + (sym, nil) := debug->sym(sblpath); | |
| 171 | 171 | if (sym != nil) { |
| 172 | 172 | m.addsym(sym); |
| 173 | 173 | return; |
| @@ -360,6 +360,8 @@ plist(exp: ref Exp, v: string, w: int, depth: int) · 359 unmodified lines | ||
| 360 | 360 | while(w && v != "nil"){ |
| 361 | 361 | exps := exp.expand(); |
| 362 | 362 | h := getname(exps, "hd"); |
| 363 | + if(h == nil) | |
| 364 | + break; | |
| 363 | 365 | (hv, vw) := h.val(); |
| 364 | 366 | if(pref(v) == 0) |
| 365 | 367 | return; |
| @@ -111,7 +111,7 @@ netmkaddr(addr, net, svc: string): string · 110 unmodified lines | ||
| 111 | 111 | { |
| 112 | 112 | if(net == nil) |
| 113 | 113 | net = "net"; |
| 114 | − (n, l) := sys->tokenize(addr, "!"); | |
| 114 | + (n, nil) := sys->tokenize(addr, "!"); | |
| 115 | 115 | if(n <= 1){ |
| 116 | 116 | if(svc== nil) |
| 117 | 117 | return sys->sprint("%s!%s", net, addr); |
| @@ -250,7 +250,7 @@ netmkaddr(addr, net, svc: string): string · 249 unmodified lines | ||
| 250 | 250 | { |
| 251 | 251 | if(net == nil) |
| 252 | 252 | net = "net"; |
| 253 | − (n, l) := sys->tokenize(addr, "!"); | |
| 253 | + (n, nil) := sys->tokenize(addr, "!"); | |
| 254 | 254 | if(n <= 1){ |
| 255 | 255 | if(svc== nil) |
| 256 | 256 | return sys->sprint("%s!%s", net, addr); |
| @@ -57,7 +57,7 @@ init(nil: ref Draw->Context, argv: list of string) · 56 unmodified lines | ||
| 57 | 57 | else { |
| 58 | 58 | if((file=sys->open(hd argv,sys->OREAD)) == nil ) |
| 59 | 59 | fatal(hd argv); |
| 60 | − (ok, stat) := sys->fstat(file); | |
| 60 | + (nil, stat) := sys->fstat(file); | |
| 61 | 61 | seekable = sys->seek(file,big 0,sys->SEEKSTART) == big 0 && stat.length > big 0; |
| 62 | 62 | } |
| 63 | 63 | |
| @@ -99,7 +99,7 @@ init(nil: ref Draw->Context, argv: list of string) · 35 unmodified lines | ||
| 99 | 99 | |
| 100 | 100 | trunc(length : big) : sys->Dir |
| 101 | 101 | { |
| 102 | − (i,d):=sys->fstat(file); | |
| 102 | + (nil,d):=sys->fstat(file); | |
| 103 | 103 | if(d.length < length) |
| 104 | 104 | d.length = tseek(big 0, sys->SEEKSTART); |
| 105 | 105 | return d; |
| @@ -470,7 +470,7 @@ netmkaddr(addr, net, svc: string): string · 469 unmodified lines | ||
| 470 | 470 | { |
| 471 | 471 | if(net == nil) |
| 472 | 472 | net = "net"; |
| 473 | − (n, l) := sys->tokenize(addr, "!"); | |
| 473 | + (n, nil) := sys->tokenize(addr, "!"); | |
| 474 | 474 | if(n <= 1){ |
| 475 | 475 | if(svc== nil) |
| 476 | 476 | return sys->sprint("%s!%s", net, addr); |
| @@ -60,7 +60,7 @@ input() · 59 unmodified lines | ||
| 60 | 60 | { |
| 61 | 61 | b := bufio->fopen(sys->fildes(0), Sys->OREAD); |
| 62 | 62 | while((line := b.gets('\n')) != nil){ |
| 63 | − (nf, fld) := sys->tokenize(line, " \t\n"); | |
| 63 | + (nil, fld) := sys->tokenize(line, " \t\n"); | |
| 64 | 64 | if(fld != nil){ |
| 65 | 65 | a := finditem(hd fld); |
| 66 | 66 | while((fld = tl fld) != nil) |
| @@ -219,7 +219,7 @@ netmkaddr(addr, net, svc: string): string · 218 unmodified lines | ||
| 219 | 219 | { |
| 220 | 220 | if(net == nil) |
| 221 | 221 | net = "net"; |
| 222 | − (n, l) := sys->tokenize(addr, "!"); | |
| 222 | + (n, nil) := sys->tokenize(addr, "!"); | |
| 223 | 223 | if(n <= 1){ |
| 224 | 224 | if(svc== nil) |
| 225 | 225 | return sys->sprint("%s!%s", net, addr); |
| @@ -781,7 +781,6 @@ gettok(): int · 780 unmodified lines | ||
| 781 | 781 | |
| 782 | 782 | tokname = ""; |
| 783 | 783 | for(;;){ |
| 784 | − reserve := 0; | |
| 785 | 784 | lineno += peekline; |
| 786 | 785 | peekline = 0; |
| 787 | 786 | c = finput.getc(); |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
| @@ -181,7 +181,7 @@ Prints a single byte as a printable character, converting · 180 unmodified lines | ||
| 181 | 181 | it to backslash escaped hex if necessary. |
| 182 | 182 | .RE |
| 183 | 183 | .PD |
| 184 | −There are two other commands: | |
| 184 | +Other commands include: | |
| 185 | 185 | .TP 10 |
| 186 | 186 | .RB [ ?/ ] w\ \fIvalue\fP |
| 187 | 187 | Write the two-byte |
| @@ -192,8 +192,51 @@ to the addressed location. · 4 unmodified lines | ||
| 192 | 192 | Write the four-byte |
| 193 | 193 | .I value |
| 194 | 194 | to the addressed location. |
| 195 | +.TP | |
| 196 | +.RB [ ?/ ] i | |
| 197 | +Disassemble | |
| 198 | +.I count | |
| 199 | +instructions starting at | |
| 200 | +.I address | |
| 201 | +.RI ( dot | |
| 202 | +by default). | |
| 203 | +.TP | |
| 204 | +.BI $ modifier | |
| 205 | +.I File | |
| 206 | +must be a | |
| 207 | +.IR dis (6) | |
| 208 | +file. | |
| 209 | +.I Modifier | |
| 210 | +is one of the following subcommands: | |
| 211 | +.RS | |
| 212 | +.TP | |
| 213 | +.PD 0 | |
| 214 | +.B D | |
| 215 | +Print the descriptor section. | |
| 216 | +.TP | |
| 217 | +.B h | |
| 218 | +Print the file header. | |
| 219 | +.TP | |
| 220 | +.B l | |
| 221 | +Print the links section. | |
| 222 | +.TP | |
| 223 | +.B i | |
| 224 | +Print the import section. | |
| 225 | +.TP | |
| 226 | +.B d | |
| 227 | +Print the data section. | |
| 228 | +.TP | |
| 229 | +.B H | |
| 230 | +Print exception handler tables. | |
| 231 | +.TP | |
| 232 | +.B s | |
| 233 | +Print the name of the source file. | |
| 234 | +.PD | |
| 235 | +.RE | |
| 195 | 236 | .SH SOURCE |
| 196 | 237 | .B /appl/cmd/mdb.b |
| 238 | +.SH SEE ALSO | |
| 239 | +.IR dis (6) | |
| 197 | 240 | .SH BUGS |
| 198 | 241 | Most of the more useful features of |
| 199 | 242 | .IR mdb 's |