Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/interplane-forge/blob/main/visits/visits.om # interplane-forge INTERPLANE Forge Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `interplane-forge / visits / visits.om` 964 lines ยท 17653 bytes Raw Blame History 1 om2 2 note visits.om: the owner's view of who visited INTERPLANE. Its own program. 3 note visits LOG 4 note LOG is forged's access log, one request per line: 5 note
6 note Lines with another shape are counted as skipped. It writes two files in the working directory, 7 note each to a .tmp name first, readable by the owner only (mode 0600): 8 note visits.tsv every figure as tab-separated lines (T totals, D days, P projects, V visitors) 9 note visits.html the same figures as one page with no script 10 note A visitor is one network address. The log has no browser name, so people and crawlers are not 11 note told apart. A project is the first two segments of the path (/owner/repo), "/" for the home page. 12 note Limits: 65,536 visitors, 8,192 projects, 512 days; past a limit the extra are counted under 13 note "not listed". Requests whose UTC day is before the first request's day or 512 or more days 14 note after it are in the totals and counted as outside the day table. 15 note Exit 0 written, 1 usage, 2 log unreadable, 3 write failed. 16 const NV ulong 65536 17 const NP ulong 8192 18 global rb uchar `1048576` 19 global ln uchar 4096 20 global lnl ulong 1 21 global fp ulong 20 22 global gs ulong 26 23 global vkh ulong 65536 24 global vrq ulong 65536 25 global vby ulong 65536 26 global vfs ulong 65536 27 global vls ulong 65536 28 global vdn ulong 65536 29 global vkd uchar 65536 30 global vip uchar `3145728` 31 global pkh ulong 8192 32 global prq ulong 8192 33 global pun ulong 8192 34 global pdn ulong 8192 35 global ptx uchar 786432 36 global ptl ulong 8192 37 global s1 ulong `2097152` 38 global s2 ulong `1048576` 39 global drq ulong 512 40 global dun ulong 512 41 global ob uchar `2097152` 42 global obl ulong 1 43 global pa uchar 1100 44 global pl uchar 64 45 note gs: 0 requests, 1 bytes, 2 skipped lines, 3 first epoch, 4 last epoch, 5 visitors, 6 projects, 46 note 7 visitors not listed, 8 projects not listed, 9 status 2xx, 10 3xx, 11 4xx, 12 5xx, 13 first day, 47 note 14 line too long flag, 15 new-slot flag, 16 requests outside the day table, 17 requests from 48 note crawlers and tools, 18 from other named agents (browsers), 19 with no agent name, 20 from lines 49 note written before forged logged the agent (seven fields), 21 fields in the current line, 22 visitors 50 note that are crawlers or tools, 23 visitors that are browsers, 24 the current line's visitor slot 51 note vkd: 0 no agent name seen for the visitor, 1 a crawler or tool name seen, 2 only other names seen 52 note kws: an agent that contains one of these words, in any letter case, is a crawler or a tool. Lower 53 note case, one space between words, each at most 32 bytes. GoogleOther is Google's general crawler and 54 note has none of the usual words in it; on the first day of logging it was 525 of 553 named requests. 55 text kws "bot crawl spider slurp googleother google- mediapartners feedfetcher facebookexternalhit preview curl wget python go-http java/ scrapy httpclient libwww headless okhttp aiohttp axios node-fetch" 56 text fhtml "visits.html" 57 text fhtmp "visits.html.tmp" 58 text ftsv "visits.tsv" 59 text fttmp "visits.tsv.tmp" 60 text x01 "" 61 text x02 "Who visited INTERPLANE
\n" 62 text x03 "

Owner only

Who visited INTERPLANE

From the server's own log on your machine. Nothing here leaves it. A visitor is one network address. A crawler or tool is a visitor whose name says so (bot, crawl, spider, GoogleOther, curl, python and the like); any other name counts as a browser, and a tool can still call itself one.

\n
" 63 text x04 "
Requests
" 64 text x05 "
Visitors
" 65 text x06 "
Projects visited
" 66 text x07 "
Megabytes served
" 67 text x08 "
\n

From " 68 text x09 " to " 69 text x10 " UTC. Answers: " 70 text x11 " fine, " 71 text x12 " redirected, " 72 text x13 " refused or not found, " 73 text x14 " server errors. Lines not understood: " 74 text y1 ".

\n

Who asked: " 75 text y2 " requests from crawlers and tools, " 76 text y3 " from browsers, " 77 text y4 " gave no name, " 78 text y5 " are from before names were recorded. Visitors: " 79 text y6 " crawlers and tools, " 80 text y7 " browsers" 81 text ykc "crawler or tool" 82 text yko "browser" 83 text x15 ".

\n

By day

\n" 84 text x16 "
Day (UTC)RequestsVisitors
\n

Most visited projects

\n" 85 text x17 "
ProjectRequestsVisitors
\n

Most active visitors

\n" 86 text x18 "
AddressRequestsMegabytesFirst seen (UTC)Last seen (UTC)Kind
\n

Not listed above: " 87 text x19 " visitors and " 88 text x20 " projects past the table limits; " 89 text x21 " requests outside the 512-day table.

\n" 90 text xtr "" 91 text xtd "" 92 text xte "\n" 93 text xamp "&" 94 text xlt "<" 95 text xgt ">" 96 note ---- output buffer 97 fn wb c uchar to void 98 o = get obl 0 99 if lt o `2097151` 100 put ob o c 101 put obl 0 add o 1 102 end 103 end 104 fn wt t view uchar * to void 105 for i ulong len t bound 400 106 wb get t i 107 end 108 end 109 fn wn v ulong to void 110 d = new uchar 20 0 111 n = ulong 0 112 x = v 113 if eq x 0 114 wb 48 115 end 116 while gt x 0 bound 20 117 put d n uchar add 48 rem x 10 118 x = div x 10 119 n = add n 1 120 end 121 while gt n 0 bound 20 122 n = sub n 1 123 wb get d n 124 end 125 end 126 fn w2 v ulong to void 127 wb uchar add 48 rem div v 10 10 128 wb uchar add 48 rem v 10 129 end 130 note wnc: a number for reading, digits grouped in threes (1,417,491); the page uses it, the TSV does not 131 fn wnc v ulong to void 132 d = new uchar 20 0 133 n = ulong 0 134 x = v 135 if eq x 0 136 wb 48 137 end 138 while gt x 0 bound 20 139 put d n uchar add 48 rem x 10 140 x = div x 10 141 n = add n 1 142 end 143 while gt n 0 bound 20 144 n = sub n 1 145 wb get d n 146 if gt n 0 147 if eq rem n 3 0 148 wb 44 149 end 150 end 151 end 152 end 153 note wesc: one byte, HTML-escaped; a quote or control byte becomes "?" 154 fn wesc c uchar to void 155 if eq c 38 156 wt xamp 157 ret 158 end 159 if eq c 60 160 wt xlt 161 ret 162 end 163 if eq c 62 164 wt xgt 165 ret 166 end 167 if or or lt c 32 gt c 126 or eq c 34 eq c 39 168 wb 63 169 ret 170 end 171 wb c 172 end 173 note wcell: one byte of a name; as it is in the TSV, HTML-escaped in the page 174 fn wcell c uchar tsv bool to void 175 if tsv 176 wb c 177 else 178 wesc c 179 end 180 end 181 fn wymd days ulong to void 182 z = add days 719468 183 era = div z 146097 184 doe = sub z mul era 146097 185 t = sub doe div doe 1460 186 t = add t div doe 36524 187 t = sub t div doe 146096 188 yoe = div t 365 189 y = add yoe mul era 400 190 doy = sub doe sub add mul 365 yoe div yoe 4 div yoe 100 191 mp = div add mul 5 doy 2 153 192 d = add sub doy div add mul 153 mp 2 5 1 193 m = add mp 3 194 if ge mp 10 195 m = sub mp 9 196 end 197 if le m 2 198 y = add y 1 199 end 200 wn y 201 wb 45 202 w2 m 203 wb 45 204 w2 d 205 end 206 fn wtime s ulong to void 207 r = rem s 86400 208 wymd div s 86400 209 wb 32 210 w2 div r 3600 211 wb 58 212 w2 div rem r 3600 60 213 end 214 note ---- the current line 215 note psplit: field starts and ends into fp (start k at 2k, end at 2k+1); true for seven fields (lines 216 note written before forged logged the agent) or nine; the count goes to gs 21 217 fn psplit to bool 218 n = get lnl 0 219 k = ulong 0 220 a = ulong 0 221 i = ulong 0 222 while lt i n bound 4096 223 if eq get ln i 32 224 if ge k 9 225 ret false 226 end 227 put fp mul k 2 a 228 put fp add mul k 2 1 i 229 k = add k 1 230 a = add i 1 231 end 232 i = add i 1 233 end 234 if and ne k 6 ne k 8 235 ret false 236 end 237 put fp mul k 2 a 238 put fp add mul k 2 1 n 239 put gs 21 add k 1 240 ret true 241 end 242 note pnum: field k as a number; a non-digit gives 2^63 243 fn pnum k ulong to ulong 244 a = get fp mul k 2 245 b = get fp add mul k 2 1 246 if ge a b 247 ret `9223372036854775808` 248 end 249 if gt sub b a 18 250 ret `9223372036854775808` 251 end 252 v = ulong 0 253 i = a 254 while lt i b bound 18 255 c = get ln i 256 if or lt c 48 gt c 57 257 ret `9223372036854775808` 258 end 259 v = add mul v 10 ulong sub c 48 260 i = add i 1 261 end 262 ret v 263 end 264 note hspan: FNV-1a 64 of ln a..b, started from seed; never 0 265 fn hspan a ulong b ulong seed ulong to ulong 266 h = seed 267 i = a 268 while lt i b bound 4096 269 h = mul xor h ulong get ln i `1099511628211` 270 i = add i 1 271 end 272 if eq h 0 273 ret 1 274 end 275 ret h 276 end 277 note pkey: the end of the project key in the path a..b: two segments, cut at "?" 278 fn pkey a ulong b ulong to ulong 279 i = add a 1 280 s = ulong 0 281 while lt i b bound 4096 282 c = get ln i 283 if eq c 63 284 ret i 285 end 286 if eq c 47 287 s = add s 1 288 if ge s 2 289 ret i 290 end 291 end 292 i = add i 1 293 end 294 ret b 295 end 296 note sadd1, sadd2: add a hash to a set; true when it was not there. A full set answers false. 297 fn sadd1 h ulong to bool 298 i = and h `2097151` 299 n = ulong 0 300 while lt n `2097152` bound `2097152` 301 k = get s1 i 302 if eq k h 303 ret false 304 end 305 if eq k 0 306 put s1 i h 307 ret true 308 end 309 i = and add i 1 `2097151` 310 n = add n 1 311 end 312 ret false 313 end 314 fn sadd2 h ulong to bool 315 i = and h `1048575` 316 n = ulong 0 317 while lt n `1048576` bound `1048576` 318 k = get s2 i 319 if eq k h 320 ret false 321 end 322 if eq k 0 323 put s2 i h 324 ret true 325 end 326 i = and add i 1 `1048575` 327 n = add n 1 328 end 329 ret false 330 end 331 note vslot: the visitor slot for hash h, claimed when new (gs 15 = 1 then); NV when the table is full 332 fn vslot h ulong to ulong 333 i = and h 65535 334 n = ulong 0 335 put gs 15 0 336 while lt n 65536 bound 65536 337 k = get vkh i 338 if eq k h 339 ret i 340 end 341 if eq k 0 342 put vkh i h 343 put gs 15 1 344 ret i 345 end 346 i = and add i 1 65535 347 n = add n 1 348 end 349 ret NV 350 end 351 fn pslot h ulong to ulong 352 i = and h 8191 353 n = ulong 0 354 put gs 15 0 355 while lt n 8192 bound 8192 356 k = get pkh i 357 if eq k h 358 ret i 359 end 360 if eq k 0 361 put pkh i h 362 put gs 15 1 363 ret i 364 end 365 i = and add i 1 8191 366 n = add n 1 367 end 368 ret NP 369 end 370 note vname: keep the address ln a..b (at most 47 bytes) for visitor slot v 371 fn vname v ulong a ulong b ulong to void 372 n = sub b a 373 if gt n 47 374 n = ulong 47 375 end 376 o = mul v 48 377 i = ulong 0 378 while lt i n bound 47 379 c = get ln add a i 380 put vip add o i c 381 i = add i 1 382 end 383 put vip add o 47 uchar n 384 end 385 note pvisit: count this request for its visitor; the visitor hash 386 fn pvisit t ulong by ulong to ulong 387 a = get fp 2 388 b = get fp 3 389 h = hspan a b `14695981039346656037` 390 v = vslot h 391 put gs 24 v 392 if eq v NV 393 put gs 7 add get gs 7 1 394 ret h 395 end 396 if eq get gs 15 1 397 put gs 5 add get gs 5 1 398 put vfs v t 399 vname v a b 400 end 401 put vrq v add get vrq v 1 402 put vby v add get vby v by 403 put vls v t 404 ret h 405 end 406 note phas: ln[a, b) contains kws[s, e), in any letter case; e - s is at most 32. A position is 407 note left at its first byte that differs, so most positions cost one compare. 408 fn phas a ulong b ulong s ulong e ulong to bool 409 m = sub e s 410 i = a 411 while le add i m b bound 4096 412 hit = true 413 j = ulong 0 414 while and hit lt j m bound 32 415 x = ulong get ln add i j 416 if and ge x 65 le x 90 417 x = add x 32 418 end 419 if ne x ulong get kws add s j 420 hit = false 421 end 422 j = add j 1 423 end 424 if hit 425 ret true 426 end 427 i = add i 1 428 end 429 ret false 430 end 431 note pauto: ln[a, b) contains one of the words of kws 432 fn pauto a ulong b ulong to bool 433 n = len kws 434 s = ulong 0 435 i = ulong 0 436 while le i n bound 512 437 cut = eq i n 438 if lt i n 439 cut = eq get kws i 32 440 end 441 if cut 442 if and gt i s le sub i s 32 443 if phas a b s i 444 ret true 445 end 446 end 447 s = add i 1 448 end 449 i = add i 1 450 end 451 ret false 452 end 453 note pagent: count the request by its agent name (field 8) and mark its visitor. A crawler name 454 note wins over any other name the same address used. 455 fn pagent to void 456 if ne get gs 21 9 457 put gs 20 add get gs 20 1 458 ret 459 end 460 a = get fp 14 461 b = get fp 15 462 v = get gs 24 463 if or ge a b and eq sub b a 1 eq get ln a 45 464 put gs 19 add get gs 19 1 465 ret 466 end 467 if pauto a b 468 put gs 17 add get gs 17 1 469 if lt v NV 470 put vkd v 1 471 end 472 ret 473 end 474 put gs 18 add get gs 18 1 475 if lt v NV 476 if eq get vkd v 0 477 put vkd v 2 478 end 479 end 480 end 481 note pname: keep the project key ln a..e (at most 95 bytes) for project slot p 482 fn pname p ulong a ulong e ulong to void 483 n = sub e a 484 if gt n 95 485 n = ulong 95 486 end 487 o = mul p 96 488 i = ulong 0 489 while lt i n bound 95 490 c = get ln add a i 491 put ptx add o i c 492 i = add i 1 493 end 494 put ptl p n 495 end 496 note pproj: count this request for its project; vh is the visitor hash 497 fn pproj vh ulong to void 498 a = get fp 6 499 b = get fp 7 500 e = pkey a b 501 h = hspan a e `14695981039346656037` 502 p = pslot h 503 if eq p NP 504 put gs 8 add get gs 8 1 505 ret 506 end 507 if eq get gs 15 1 508 put gs 6 add get gs 6 1 509 pname p a e 510 end 511 put prq p add get prq p 1 512 if sadd2 xor mul h `1099511628211` vh 513 put pun p add get pun p 1 514 end 515 end 516 note pline: one log line 517 fn pline to void 518 if not psplit 519 put gs 2 add get gs 2 1 520 ret 521 end 522 t = pnum 0 523 st = pnum 4 524 by = pnum 5 525 if or or ge t `9223372036854775808` ge st `9223372036854775808` ge by `9223372036854775808` 526 put gs 2 add get gs 2 1 527 ret 528 end 529 if ge get fp 6 get fp 7 530 put gs 2 add get gs 2 1 531 ret 532 end 533 if ne get ln get fp 6 47 534 put gs 2 add get gs 2 1 535 ret 536 end 537 if eq get gs 0 0 538 put gs 3 t 539 put gs 13 div t 86400 540 end 541 put gs 0 add get gs 0 1 542 put gs 1 add get gs 1 by 543 put gs 4 t 544 c = div st 100 545 if and ge c 2 le c 5 546 put gs add 7 c add get gs add 7 c 1 547 end 548 vh = pvisit t by 549 pagent 550 day = div t 86400 551 if ge day get gs 13 552 d = sub day get gs 13 553 if lt d 512 554 put drq d add get drq d 1 555 if sadd1 xor mul vh `1099511628211` day 556 put dun d add get dun d 1 557 end 558 else 559 put gs 16 add get gs 16 1 560 end 561 else 562 put gs 16 add get gs 16 1 563 end 564 pproj vh 565 end 566 note pbytes: n bytes of the read buffer 567 fn pbytes n ulong to void 568 i = ulong 0 569 while lt i n bound `1048576` 570 c = get rb i 571 if eq c 10 572 if eq get gs 14 0 573 pline 574 else 575 put gs 2 add get gs 2 1 576 end 577 put lnl 0 0 578 put gs 14 0 579 else 580 m = get lnl 0 581 if lt m 4095 582 put ln m c 583 put lnl 0 add m 1 584 else 585 put gs 14 1 586 end 587 end 588 i = add i 1 589 end 590 end 591 note ---- report 592 fn rdays tsv bool to void 593 d = ulong 0 594 while lt d 512 bound 512 595 if gt get drq d 0 596 if tsv 597 wb 68 598 wb 9 599 wymd add get gs 13 d 600 wb 9 601 wn get drq d 602 wb 9 603 wn get dun d 604 wb 10 605 else 606 wt xtr 607 wymd add get gs 13 d 608 wt xtd 609 wnc get drq d 610 wt xtd 611 wnc get dun d 612 wt xte 613 end 614 end 615 d = add d 1 616 end 617 end 618 note ptop: the unprinted project with the most requests, or NP 619 fn ptop to ulong 620 best = NP 621 m = ulong 0 622 i = ulong 0 623 while lt i 8192 bound 8192 624 if eq get pdn i 0 625 if gt get prq i m 626 m = get prq i 627 best = i 628 end 629 end 630 i = add i 1 631 end 632 ret best 633 end 634 fn rproj tsv bool to void 635 k = ulong 0 636 while lt k 25 bound 25 637 p = ptop 638 if lt p NP 639 put pdn p 1 640 if tsv 641 wb 80 642 wb 9 643 else 644 wt xtr 645 end 646 n = get ptl p 647 i = ulong 0 648 while lt i n bound 96 649 wcell get ptx add mul p 96 i tsv 650 i = add i 1 651 end 652 if tsv 653 wb 9 654 wn get prq p 655 wb 9 656 wn get pun p 657 wb 10 658 else 659 wt xtd 660 wnc get prq p 661 wt xtd 662 wnc get pun p 663 wt xte 664 end 665 end 666 k = add k 1 667 end 668 end 669 fn vtop to ulong 670 best = NV 671 m = ulong 0 672 i = ulong 0 673 while lt i 65536 bound 65536 674 if eq get vdn i 0 675 if gt get vrq i m 676 m = get vrq i 677 best = i 678 end 679 end 680 i = add i 1 681 end 682 ret best 683 end 684 fn rvis tsv bool to void 685 k = ulong 0 686 while lt k 40 bound 40 687 v = vtop 688 if lt v NV 689 put vdn v 1 690 if tsv 691 wb 86 692 wb 9 693 else 694 wt xtr 695 end 696 n = ulong get vip add mul v 48 47 697 i = ulong 0 698 while lt i n bound 48 699 wcell get vip add mul v 48 i tsv 700 i = add i 1 701 end 702 if tsv 703 wb 9 704 wn get vrq v 705 wb 9 706 wn get vby v 707 wb 9 708 wn get vfs v 709 wb 9 710 wn get vls v 711 wb 9 712 wb vkc get vkd v 713 wb 10 714 else 715 wt xtd 716 wnc get vrq v 717 wt xtd 718 wnc div get vby v `1048576` 719 wt xtd 720 wtime get vfs v 721 wt xtd 722 wtime get vls v 723 wt xtd 724 if eq get vkd v 1 725 wt ykc 726 end 727 if eq get vkd v 2 728 wt yko 729 end 730 wt xte 731 end 732 end 733 k = add k 1 734 end 735 end 736 fn rclear to void 737 i = ulong 0 738 while lt i 65536 bound 65536 739 put vdn i 0 740 i = add i 1 741 end 742 j = ulong 0 743 while lt j 8192 bound 8192 744 put pdn j 0 745 j = add j 1 746 end 747 end 748 note rkinds: visitors by kind into gs 22 and 23 749 fn rkinds to void 750 put gs 22 0 751 put gs 23 0 752 i = ulong 0 753 while lt i 65536 bound 65536 754 if ne get vkh i 0 755 if eq get vkd i 1 756 put gs 22 add get gs 22 1 757 end 758 if eq get vkd i 2 759 put gs 23 add get gs 23 1 760 end 761 end 762 i = add i 1 763 end 764 end 765 note vkc: the kind letter of the TSV: c crawler, o other named agent, - no name seen 766 fn vkc k uchar to uchar 767 if eq k 1 768 ret 99 769 end 770 if eq k 2 771 ret 111 772 end 773 ret 45 774 end 775 fn rtsv to void 776 put obl 0 0 777 rkinds 778 wb 65 779 wb 9 780 wn get gs 17 781 wb 9 782 wn get gs 18 783 wb 9 784 wn get gs 19 785 wb 9 786 wn get gs 20 787 wb 9 788 wn get gs 22 789 wb 9 790 wn get gs 23 791 wb 10 792 wb 84 793 wb 9 794 wn get gs 0 795 wb 9 796 wn get gs 5 797 wb 9 798 wn get gs 6 799 wb 9 800 wn get gs 1 801 wb 9 802 wn get gs 3 803 wb 9 804 wn get gs 4 805 wb 9 806 wn get gs 9 807 wb 9 808 wn get gs 10 809 wb 9 810 wn get gs 11 811 wb 9 812 wn get gs 12 813 wb 9 814 wn get gs 2 815 wb 9 816 wn get gs 7 817 wb 9 818 wn get gs 8 819 wb 9 820 wn get gs 16 821 wb 10 822 rdays true 823 rproj true 824 rvis true 825 end 826 fn rhtml to void 827 put obl 0 0 828 wt x01 829 wt x02 830 wt x03 831 wt x04 832 wnc get gs 0 833 wt x05 834 wnc get gs 5 835 wt x06 836 wnc get gs 6 837 wt x07 838 wnc div get gs 1 `1048576` 839 wt x08 840 wtime get gs 3 841 wt x09 842 wtime get gs 4 843 wt x10 844 wnc get gs 9 845 wt x11 846 wnc get gs 10 847 wt x12 848 wnc get gs 11 849 wt x13 850 wnc get gs 12 851 wt x14 852 wnc get gs 2 853 wt y1 854 wnc get gs 17 855 wt y2 856 wnc get gs 18 857 wt y3 858 wnc get gs 19 859 wt y4 860 wnc get gs 20 861 wt y5 862 wnc get gs 22 863 wt y6 864 wnc get gs 23 865 wt y7 866 wt x15 867 rdays false 868 wt x16 869 rproj false 870 wt x17 871 rvis false 872 wt x18 873 wnc get gs 7 874 wt x19 875 wnc get gs 8 876 wt x20 877 wnc get gs 16 878 wt x21 879 end 880 note ---- files 881 fn wren a view uchar * b view uchar * to bool 882 la = len a 883 lb = len b 884 put pl 0 2 885 put pl 1 0 886 put pl 2 uchar la 887 put pl 3 0 888 i = ulong 0 889 while lt i la bound 28 890 put pl add 4 i get a i 891 i = add i 1 892 end 893 o = add 4 la 894 put pl o uchar lb 895 put pl add o 1 0 896 k = ulong 0 897 while lt k lb bound 28 898 put pl add add o 2 k get b k 899 k = add k 1 900 end 901 ret eq renames pl 0 add add o 2 lb 0 0 902 end 903 fn wfile tmp view uchar * fin view uchar * to bool 904 fd = int fopen tmp 0 len tmp 577 384 905 if lt fd 0 906 ret false 907 end 908 r = fchmod fd 384 909 n = get obl 0 910 o = ulong 0 911 ok = true 912 while lt o n bound `2097152` 913 k = write fd ob o sub n o 914 if le k 0 915 ok = false 916 o = n 917 else 918 o = add o ulong k 919 end 920 end 921 r = fsync fd 922 r = fclose fd 923 if not ok 924 ret false 925 end 926 ret wren tmp fin 927 end 928 fn main to int 929 if ne argcnt 2 930 ret 1 931 end 932 n = argread 1 pa 0 1023 933 if lt n 1 934 ret 1 935 end 936 fd = int fopen pa 0 ulong n 0 0 937 if lt fd 0 938 ret 2 939 end 940 k = long 1 941 while gt k 0 bound `9223372036854775807` 942 k = read fd rb 0 `1048576` 943 if gt k 0 944 pbytes ulong k 945 end 946 end 947 r = fclose fd 948 if lt k 0 949 ret 2 950 end 951 if gt get lnl 0 0 952 put gs 2 add get gs 2 1 953 end 954 rtsv 955 if not wfile fttmp ftsv 956 ret 3 957 end 958 rclear 959 rhtml 960 if not wfile fhtmp fhtml 961 ret 3 962 end 963 ret 0 964 end