home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: DOS BACKUP file
(archive/dosBackupFile).
You can browse this item here: CPYRTBRO.C
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| DOS BACKUP file (archive/dosBackupFile)
| magic
| Supported |
66%
| dexvert
| Compact Compressed (Unix) (archive/compact)
| ext
| Supported |
100%
| file
| DOS 2.0-3.2 backed up file \CBTREE\LIBRARY\CPYRTBRO.C
| default
| |
99%
| file
| data
| default
| |
51%
| TrID
| DOS 2.0-3.2 backup
| default
| |
48%
| TrID
| MP3 audio
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| ff 01 00 00 00 5c 43 42 | 54 52 45 45 5c 4c 49 42 |.....\CB|TREE\LIB|
|00000010| 52 41 52 59 5c 43 50 59 | 52 54 42 52 4f 2e 43 00 |RARY\CPY|RTBRO.C.|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000050| 00 00 00 1b 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000060| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000080| 2f 2a 20 28 43 29 20 43 | 6f 70 79 72 69 67 68 74 |/* (C) C|opyright|
|00000090| 20 31 39 38 34 2c 38 35 | 2c 38 36 2c 38 37 20 57 | 1984,85|,86,87 W|
|000000a0| 61 6c 74 65 72 20 4c 2e | 20 50 65 61 63 6f 63 6b |alter L.| Peacock|
|000000b0| 20 20 20 41 6c 6c 20 52 | 69 67 68 74 73 20 52 65 | All R|ights Re|
|000000c0| 73 65 72 76 65 64 20 20 | 20 20 2a 2f 0d 0a 2f 2a |served | */../*|
|000000d0| 20 20 43 20 50 20 59 20 | 52 20 54 20 42 20 52 20 | C P Y |R T B R |
|000000e0| 4f 20 2e 20 43 20 20 37 | 2f 32 35 2f 38 34 20 20 |O . C 7|/25/84 |
|000000f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000100| 20 20 20 20 20 20 20 20 | 20 20 20 2a 2f 0d 0a 2f | | */../|
|00000110| 2a 20 54 48 49 53 20 50 | 52 4f 47 52 41 4d 20 42 |* THIS P|ROGRAM B|
|00000120| 45 4c 4f 4e 47 53 20 54 | 4f 20 57 41 4c 54 45 52 |ELONGS T|O WALTER|
|00000130| 20 4c 2e 20 50 45 41 43 | 4f 43 4b 2e 20 20 49 54 | L. PEAC|OCK. IT|
|00000140| 20 49 53 20 43 4f 4e 53 | 49 44 45 52 45 44 20 41 | IS CONS|IDERED A|
|00000150| 20 54 52 41 44 45 20 2a | 2f 0d 0a 2f 2a 20 53 45 | TRADE *|/../* SE|
|00000160| 43 52 45 54 20 41 4e 44 | 20 49 53 20 4e 4f 54 20 |CRET AND| IS NOT |
|00000170| 54 4f 20 42 45 20 44 49 | 56 55 4c 47 45 44 20 4f |TO BE DI|VULGED O|
|00000180| 52 20 55 53 45 44 20 42 | 59 20 50 41 52 54 49 45 |R USED B|Y PARTIE|
|00000190| 53 20 57 48 4f 20 48 41 | 56 45 20 4e 4f 54 20 20 |S WHO HA|VE NOT |
|000001a0| 20 20 2a 2f 0d 0a 2f 2a | 20 52 45 43 45 49 56 45 | */../*| RECEIVE|
|000001b0| 44 20 57 52 49 54 54 45 | 4e 20 41 55 54 48 4f 52 |D WRITTE|N AUTHOR|
|000001c0| 49 5a 41 54 49 4f 4e 20 | 46 52 4f 4d 20 54 48 45 |IZATION |FROM THE|
|000001d0| 20 4f 57 4e 45 52 2e 20 | 20 20 20 20 20 20 20 20 | OWNER. | |
|000001e0| 20 2a 2f 0d 0a 0d 0a 2f | 2a 2d 2d 2d 2d 2d 2d 2d | */..../|*-------|
|000001f0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000200| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000210| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000220| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000230| 2d 2d 2d 2d 2d 20 0d 0a | 20 2a 20 63 70 79 72 74 |----- ..| * cpyrt|
|00000240| 62 72 6f 28 29 20 77 69 | 6c 6c 20 61 74 74 65 6d |bro() wi|ll attem|
|00000250| 70 74 20 74 6f 20 63 6f | 70 79 20 61 20 63 65 6c |pt to co|py a cel|
|00000260| 6c 20 66 72 6f 6d 20 74 | 68 65 20 72 69 67 68 74 |l from t|he right|
|00000270| 20 62 72 6f 74 68 65 72 | 20 69 6e 64 65 78 20 0d | brother| index .|
|00000280| 0a 20 2a 20 6e 6f 64 65 | 20 77 68 65 6e 20 74 68 |. * node| when th|
|00000290| 65 20 63 75 72 72 65 6e | 74 20 69 6e 64 65 78 20 |e curren|t index |
|000002a0| 6e 6f 64 65 20 75 6e 64 | 65 72 66 6c 6f 77 73 20 |node und|erflows |
|000002b0| 64 75 72 69 6e 67 20 61 | 20 64 65 6c 65 74 65 20 |during a| delete |
|000002c0| 6b 65 79 2e 0d 0a 20 2a | 2d 2d 2d 2d 2d 2d 2d 2d |key... *|--------|
|000002d0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000002e0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000002f0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000300| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000310| 2d 2d 2d 2a 2f 0d 0a 0d | 0a 23 69 6e 63 6c 75 64 |---*/...|.#includ|
|00000320| 65 20 22 63 62 74 72 65 | 65 2e 68 22 0d 0a 0d 0a |e "cbtre|e.h"....|
|00000330| 63 70 79 72 74 62 72 6f | 28 66 64 69 64 78 2c 20 |cpyrtbro|(fdidx, |
|00000340| 70 62 6c 6b 2c 20 62 74 | 70 61 72 6d 73 74 29 0d |pblk, bt|parmst).|
|00000350| 0a 69 6e 74 20 20 20 20 | 20 20 20 66 64 69 64 78 |.int | fdidx|
|00000360| 3b 0d 0a 42 54 49 44 58 | 42 4c 4b 20 2a 70 62 6c |;..BTIDX|BLK *pbl|
|00000370| 6b 3b 0d 0a 42 54 43 20 | 20 20 20 20 20 2a 62 74 |k;..BTC | *bt|
|00000380| 70 61 72 6d 73 74 3b 0d | 0a 7b 0d 0a 20 20 20 65 |parmst;.|.{.. e|
|00000390| 78 74 65 72 6e 20 63 68 | 61 72 20 2a 63 61 6c 6c |xtern ch|ar *call|
|000003a0| 6f 63 28 29 2c 20 2a 73 | 74 72 73 61 76 65 28 29 |oc(), *s|trsave()|
|000003b0| 3b 0d 0a 20 20 20 65 78 | 74 65 72 6e 20 6c 6f 6e |;.. ex|tern lon|
|000003c0| 67 20 70 6f 70 74 6f 70 | 28 29 3b 0d 0a 20 20 20 |g poptop|();.. |
|000003d0| 65 78 74 65 72 6e 20 69 | 6e 74 20 73 74 72 63 6d |extern i|nt strcm|
|000003e0| 70 28 29 2c 20 73 74 72 | 6c 65 6e 28 29 3b 0d 0a |p(), str|len();..|
|000003f0| 20 20 20 65 78 74 65 72 | 6e 20 76 6f 69 64 20 66 | exter|n void f|
|00000400| 72 65 65 28 29 3b 0d 0a | 20 20 20 42 54 49 44 58 |ree();..| BTIDX|
|00000410| 42 4c 4b 20 2a 62 72 6f | 62 6c 6b 3b 0d 0a 20 20 |BLK *bro|blk;.. |
|00000420| 20 6c 6f 6e 67 20 20 6c | 76 6c 6e 6f 64 65 2c 20 | long l|vlnode, |
|00000430| 69 64 78 6e 6f 64 65 2c | 20 70 6f 73 3b 0d 0a 20 |idxnode,| pos;.. |
|00000440| 20 20 63 68 61 72 20 2a | 65 6e 64 69 64 78 6b 79 | char *|endidxky|
|00000450| 3b 0d 0a 20 20 20 72 65 | 67 69 73 74 65 72 20 69 |;.. re|gister i|
|00000460| 6e 74 20 69 3b 0d 0a 0d | 0a 20 20 20 69 66 20 28 |nt i;...|. if (|
|00000470| 70 62 6c 6b 2d 3e 66 77 | 64 70 61 67 65 20 3c 20 |pblk->fw|dpage < |
|00000480| 32 4c 29 20 20 20 20 20 | 20 20 2f 2a 20 74 68 65 |2L) | /* the|
|00000490| 72 65 20 69 73 20 6e 6f | 20 72 69 67 68 74 20 62 |re is no| right b|
|000004a0| 72 6f 74 68 65 72 20 20 | 20 2a 2f 0d 0a 20 20 20 |rother | */.. |
|000004b0| 20 20 20 72 65 74 75 72 | 6e 28 2d 31 29 3b 0d 0a | retur|n(-1);..|
|000004c0| 0d 0a 20 20 20 70 6f 73 | 20 3d 20 28 6c 6f 6e 67 |.. pos| = (long|
|000004d0| 29 20 28 28 70 62 6c 6b | 2d 3e 66 77 64 70 61 67 |) ((pblk|->fwdpag|
|000004e0| 65 20 2d 20 31 4c 29 20 | 2a 20 62 74 70 61 72 6d |e - 1L) |* btparm|
|000004f0| 73 74 2d 3e 62 74 69 64 | 78 6c 65 6e 29 3b 0d 0a |st->btid|xlen);..|
|00000500| 0d 0a 20 20 20 69 20 3d | 20 30 3b 20 20 20 20 20 |.. i =| 0; |
|00000510| 2f 2a 20 6c 6f 63 6b 20 | 74 68 65 20 72 65 63 6f |/* lock |the reco|
|00000520| 72 64 20 77 65 20 61 72 | 65 20 61 62 6f 75 74 20 |rd we ar|e about |
|00000530| 74 6f 20 6d 6f 64 69 66 | 79 20 2a 2f 0d 0a 20 20 |to modif|y */.. |
|00000540| 20 77 68 69 6c 65 20 28 | 6c 6f 63 6b 75 6e 6c 6b | while (|lockunlk|
|00000550| 28 66 64 69 64 78 2c 20 | 28 6c 6f 6e 67 29 20 70 |(fdidx, |(long) p|
|00000560| 6f 73 2c 20 62 74 70 61 | 72 6d 73 74 2d 3e 62 74 |os, btpa|rmst->bt|
|00000570| 69 64 78 6c 65 6e 2c 20 | 4c 4f 43 4b 52 29 20 21 |idxlen, |LOCKR) !|
|00000580| 3d 20 31 29 0d 0a 20 20 | 20 20 20 20 69 66 20 28 |= 1).. | if (|
|00000590| 2b 2b 69 20 3e 20 48 44 | 52 54 52 59 53 29 0d 0a |++i > HD|RTRYS)..|
|000005a0| 20 20 20 20 20 20 20 20 | 20 72 65 74 75 72 6e 28 | | return(|
|000005b0| 2d 31 29 3b 20 09 2f 2a | 20 69 2e 65 2e 20 75 6e |-1); ./*| i.e. un|
|000005c0| 61 62 6c 65 20 74 6f 20 | 6c 6f 63 6b 20 6c 69 6e |able to |lock lin|
|000005d0| 6b 65 64 20 6c 69 73 74 | 20 72 65 63 6f 72 64 20 |ked list| record |
|000005e0| 2a 2f 0d 0a 0d 0a 20 20 | 20 2f 2a 20 70 6c 61 63 |*/.... | /* plac|
|000005f0| 65 20 74 6f 20 72 65 61 | 64 20 72 69 67 68 74 20 |e to rea|d right |
|00000600| 62 72 6f 74 68 65 72 20 | 69 6e 64 65 78 20 6e 6f |brother |index no|
|00000610| 64 65 20 2a 2f 0d 0a 20 | 20 20 69 66 28 20 21 28 |de */.. | if( !(|
|00000620| 62 72 6f 62 6c 6b 20 3d | 20 28 42 54 49 44 58 42 |broblk =| (BTIDXB|
|00000630| 4c 4b 20 2a 29 63 61 6c | 6c 6f 63 28 0d 0a 20 20 |LK *)cal|loc(.. |
|00000640| 20 20 20 20 20 20 20 73 | 69 7a 65 6f 66 28 42 54 | s|izeof(BT|
|00000650| 49 44 58 42 4c 4b 29 20 | 2b 20 62 74 70 61 72 6d |IDXBLK) |+ btparm|
|00000660| 73 74 2d 3e 62 74 63 65 | 6c 6c 73 20 2a 20 53 5a |st->btce|lls * SZ|
|00000670| 42 54 49 44 58 2c 20 53 | 5a 43 48 41 52 29 20 29 |BTIDX, S|ZCHAR) )|
|00000680| 29 0d 0a 20 20 20 20 20 | 20 63 6b 65 72 72 6f 72 |).. | ckerror|
|00000690| 28 2d 20 43 4b 5f 4e 4f | 4d 45 4d 2c 20 22 35 37 |(- CK_NO|MEM, "57|
|000006a0| 22 29 3b 0d 0a 0d 0a 20 | 20 20 67 65 74 69 64 78 |");.... | getidx|
|000006b0| 72 28 66 64 69 64 78 2c | 20 70 62 6c 6b 2d 3e 66 |r(fdidx,| pblk->f|
|000006c0| 77 64 70 61 67 65 2c 20 | 62 72 6f 62 6c 6b 2c 20 |wdpage, |broblk, |
|000006d0| 62 74 70 61 72 6d 73 74 | 2d 3e 62 74 69 64 78 6c |btparmst|->btidxl|
|000006e0| 65 6e 2c 20 20 20 2f 2a | 20 72 65 61 64 20 69 74 |en, /*| read it|
|000006f0| 20 2a 2f 0d 0a 20 20 20 | 20 20 20 20 20 20 62 74 | */.. | bt|
|00000700| 70 61 72 6d 73 74 2d 3e | 62 74 6b 65 79 6c 65 6e |parmst->|btkeylen|
|00000710| 29 3b 0d 0a 0d 0a 20 20 | 20 69 66 20 28 62 72 6f |);.... | if (bro|
|00000720| 62 6c 6b 2d 3e 63 65 6c | 6c 69 63 6e 74 20 3c 3d |blk->cel|licnt <=|
|00000730| 20 28 62 74 70 61 72 6d | 73 74 2d 3e 62 74 63 65 | (btparm|st->btce|
|00000740| 6c 6c 73 20 3e 3e 20 31 | 29 20 29 7b 20 20 20 2f |lls >> 1|) ){ /|
|00000750| 2a 20 75 6e 64 65 72 66 | 6c 6f 77 20 20 2a 2f 0d |* underf|low */.|
|00000760| 0a 20 20 20 20 20 20 6c | 6f 63 6b 75 6e 6c 6b 28 |. l|ockunlk(|
|00000770| 66 64 69 64 78 2c 20 70 | 6f 73 2c 20 62 74 70 61 |fdidx, p|os, btpa|
|00000780| 72 6d 73 74 2d 3e 62 74 | 69 64 78 6c 65 6e 2c 20 |rmst->bt|idxlen, |
|00000790| 55 4e 4c 4f 43 4b 52 29 | 3b 0d 0a 20 20 20 20 20 |UNLOCKR)|;.. |
|000007a0| 20 66 72 65 65 6b 65 79 | 73 28 62 72 6f 62 6c 6b | freekey|s(broblk|
|000007b0| 29 3b 0d 0a 20 20 20 20 | 20 20 46 52 45 45 28 62 |);.. | FREE(b|
|000007c0| 72 6f 62 6c 6b 29 3b 0d | 0a 20 20 20 20 20 20 72 |roblk);.|. r|
|000007d0| 65 74 75 72 6e 28 2d 31 | 29 3b 20 20 20 20 2f 2a |eturn(-1|); /*|
|000007e0| 20 63 61 6e 27 74 20 63 | 6f 70 79 20 61 6e 79 74 | can't c|opy anyt|
|000007f0| 68 69 6e 67 20 66 72 6f | 6d 20 72 69 67 68 74 20 |hing fro|m right |
|00000800| 62 72 6f 74 68 65 72 20 | 2a 2f 0d 0a 20 20 20 7d |brother |*/.. }|
|00000810| 0d 0a 0d 0a 20 20 20 69 | 64 78 6e 6f 64 65 20 3d |.... i|dxnode =|
|00000820| 20 62 72 6f 62 6c 6b 2d | 3e 62 77 64 70 61 67 65 | broblk-|>bwdpage|
|00000830| 3b 20 20 20 20 2f 2a 20 | 70 6f 69 6e 74 20 74 6f |; /* |point to|
|00000840| 20 6f 72 69 67 69 6e 61 | 6c 20 6e 6f 64 65 20 2a | origina|l node *|
|00000850| 2f 0d 0a 0d 0a 20 20 20 | 2f 2a 20 6f 6b 20 74 6f |/.... |/* ok to|
|00000860| 20 63 6f 70 79 20 66 69 | 72 73 74 20 63 65 6c 6c | copy fi|rst cell|
|00000870| 20 66 72 6f 6d 20 72 69 | 67 68 74 20 62 72 6f 74 | from ri|ght brot|
|00000880| 68 65 72 20 74 6f 20 6f | 75 72 20 6c 61 73 74 20 |her to o|ur last |
|00000890| 70 6f 73 74 69 6f 6e 20 | 2a 2f 0d 0a 20 20 20 69 |postion |*/.. i|
|000008a0| 66 20 28 70 62 6c 6b 2d | 3e 62 6c 6b 61 6c 6c 6f |f (pblk-|>blkallo|
|000008b0| 63 20 3e 20 70 62 6c 6b | 2d 3e 63 65 6c 6c 69 63 |c > pblk|->cellic|
|000008c0| 6e 74 29 20 20 20 20 2f | 2a 20 6d 65 6d 6f 72 79 |nt) /|* memory|
|000008d0| 20 61 6c 72 65 61 64 79 | 20 61 6c 6c 6f 63 61 74 | already| allocat|
|000008e0| 65 64 20 20 2a 2f 0d 0a | 20 20 20 20 20 20 46 52 |ed */..| FR|
|000008f0| 45 45 28 70 62 6c 6b 2d | 3e 62 74 70 61 67 65 5b |EE(pblk-|>btpage[|
|00000900| 70 62 6c 6b 2d 3e 63 65 | 6c 6c 69 63 6e 74 5d 2e |pblk->ce|llicnt].|
|00000910| 73 6b 65 79 6e 6d 65 29 | 3b 20 20 2f 2a 20 64 6f |skeynme)|; /* do|
|00000920| 6e 27 74 20 6e 65 65 64 | 20 69 74 20 2a 2f 0d 0a |n't need| it */..|
|00000930| 20 20 20 65 6c 73 65 0d | 0a 20 20 20 20 20 20 2b | else.|. +|
|00000940| 2b 70 62 6c 6b 2d 3e 62 | 6c 6b 61 6c 6c 6f 63 3b |+pblk->b|lkalloc;|
|00000950| 20 2f 2a 20 77 65 27 72 | 65 20 61 64 64 69 6e 67 | /* we'r|e adding|
|00000960| 20 61 6e 20 61 6c 6c 6f | 63 61 74 69 6f 6e 20 66 | an allo|cation f|
|00000970| 72 6f 6d 20 62 72 6f 62 | 6c 6b 20 2a 2f 0d 0a 20 |rom brob|lk */.. |
|00000980| 20 20 62 6c 6b 73 68 66 | 74 28 70 62 6c 6b 2d 3e | blkshf|t(pblk->|
|00000990| 62 74 70 61 67 65 20 2b | 20 70 62 6c 6b 2d 3e 63 |btpage +| pblk->c|
|000009a0| 65 6c 6c 69 63 6e 74 2b | 2b 2c 20 62 72 6f 62 6c |ellicnt+|+, brobl|
|000009b0| 6b 2d 3e 62 74 70 61 67 | 65 2c 20 31 2c 20 53 5a |k->btpag|e, 1, SZ|
|000009c0| 42 54 49 44 58 29 3b 0d | 0a 0d 0a 20 20 20 2f 2a |BTIDX);.|... /*|
|000009d0| 20 63 6f 6d 70 72 65 73 | 73 20 74 68 65 20 72 69 | compres|s the ri|
|000009e0| 67 68 74 20 62 72 6f 74 | 68 65 72 20 62 79 20 6f |ght brot|her by o|
|000009f0| 6e 65 20 63 65 6c 6c 20 | 2a 2f 0d 0a 20 20 20 62 |ne cell |*/.. b|
|00000a00| 6c 6b 73 68 66 74 28 62 | 72 6f 62 6c 6b 2d 3e 62 |lkshft(b|roblk->b|
|00000a10| 74 70 61 67 65 2c 20 62 | 72 6f 62 6c 6b 2d 3e 62 |tpage, b|roblk->b|
|00000a20| 74 70 61 67 65 20 2b 20 | 31 2c 20 2d 2d 62 72 6f |tpage + |1, --bro|
|00000a30| 62 6c 6b 2d 3e 62 6c 6b | 61 6c 6c 6f 63 2c 20 53 |blk->blk|alloc, S|
|00000a40| 5a 42 54 49 44 58 29 3b | 0d 0a 20 20 20 2d 2d 62 |ZBTIDX);|.. --b|
|00000a50| 72 6f 62 6c 6b 2d 3e 63 | 65 6c 6c 69 63 6e 74 3b |roblk->c|ellicnt;|
|00000a60| 20 20 2f 2a 20 77 65 27 | 76 65 20 64 65 61 6c 6c | /* we'|ve deall|
|00000a70| 6f 63 61 74 65 64 20 61 | 20 6b 65 79 20 66 72 6f |ocated a| key fro|
|00000a80| 6d 20 62 72 6f 62 6c 6b | 20 2a 2f 0d 0a 0d 0a 20 |m broblk| */.... |
|00000a90| 20 20 70 75 74 69 64 78 | 72 28 66 64 69 64 78 2c | putidx|r(fdidx,|
|00000aa0| 20 62 72 6f 62 6c 6b 2d | 3e 62 77 64 70 61 67 65 | broblk-|>bwdpage|
|00000ab0| 2c 20 70 62 6c 6b 2c 20 | 62 74 70 61 72 6d 73 74 |, pblk, |btparmst|
|00000ac0| 29 3b 0d 0a 20 20 20 70 | 75 74 69 64 78 72 28 66 |);.. p|utidxr(f|
|00000ad0| 64 69 64 78 2c 20 70 62 | 6c 6b 2d 3e 66 77 64 70 |didx, pb|lk->fwdp|
|00000ae0| 61 67 65 2c 20 62 72 6f | 62 6c 6b 2c 20 62 74 70 |age, bro|blk, btp|
|00000af0| 61 72 6d 73 74 29 3b 0d | 0a 0d 0a 20 20 20 6c 6f |armst);.|... lo|
|00000b00| 63 6b 75 6e 6c 6b 28 66 | 64 69 64 78 2c 20 70 6f |ckunlk(f|didx, po|
|00000b10| 73 2c 20 62 74 70 61 72 | 6d 73 74 2d 3e 62 74 69 |s, btpar|mst->bti|
|00000b20| 64 78 6c 65 6e 2c 20 55 | 4e 4c 4f 43 4b 52 29 3b |dxlen, U|NLOCKR);|
|00000b30| 0d 0a 0d 0a 20 20 20 2f | 2a 20 6e 6f 77 20 75 70 |.... /|* now up|
|00000b40| 64 61 74 65 20 74 72 65 | 65 3a 20 63 68 65 63 6b |date tre|e: check|
|00000b50| 20 74 68 65 20 6e 65 77 | 20 65 6e 64 20 6b 65 79 | the new| end key|
|00000b60| 20 61 67 61 69 6e 73 74 | 20 70 61 72 65 6e 74 20 | against| parent |
|00000b70| 6e 6f 64 65 73 20 2a 2f | 0d 0a 20 20 20 65 6e 64 |nodes */|.. end|
|00000b80| 69 64 78 6b 79 20 3d 20 | 73 74 72 73 61 76 65 28 |idxky = |strsave(|
|00000b90| 70 62 6c 6b 2d 3e 62 74 | 70 61 67 65 5b 70 62 6c |pblk->bt|page[pbl|
|00000ba0| 6b 2d 3e 63 65 6c 6c 69 | 63 6e 74 20 2d 20 31 5d |k->celli|cnt - 1]|
|00000bb0| 2e 73 6b 65 79 6e 6d 65 | 2c 0d 0a 20 20 20 20 20 |.skeynme|,.. |
|00000bc0| 20 20 20 20 62 74 70 61 | 72 6d 73 74 2d 3e 62 74 | btpa|rmst->bt|
|00000bd0| 6b 65 79 6c 65 6e 29 3b | 0d 0a 0d 0a 20 20 20 77 |keylen);|.... w|
|00000be0| 68 69 6c 65 28 20 28 6c | 76 6c 6e 6f 64 65 20 3d |hile( (l|vlnode =|
|00000bf0| 20 70 6f 70 74 6f 70 28 | 29 20 29 20 21 3d 20 30 | poptop(|) ) != 0|
|00000c00| 4c 29 20 20 20 20 2f 2a | 20 6e 6f 64 65 27 73 20 |L) /*| node's |
|00000c10| 70 61 72 65 6e 74 20 2a | 2f 0d 0a 20 20 20 7b 0d |parent *|/.. {.|
|00000c20| 0a 20 20 20 20 20 20 67 | 65 74 69 64 78 72 28 66 |. g|etidxr(f|
|00000c30| 64 69 64 78 2c 20 6c 76 | 6c 6e 6f 64 65 2c 20 62 |didx, lv|lnode, b|
|00000c40| 72 6f 62 6c 6b 2c 20 62 | 74 70 61 72 6d 73 74 2d |roblk, b|tparmst-|
|00000c50| 3e 62 74 69 64 78 6c 65 | 6e 2c 20 2f 2a 20 72 65 |>btidxle|n, /* re|
|00000c60| 61 64 20 70 61 72 65 6e | 74 20 2a 2f 0d 0a 20 20 |ad paren|t */.. |
|00000c70| 20 20 20 20 20 20 20 20 | 20 20 62 74 70 61 72 6d | | btparm|
|00000c80| 73 74 2d 3e 62 74 6b 65 | 79 6c 65 6e 29 3b 0d 0a |st->btke|ylen);..|
|00000c90| 0d 0a 20 20 20 20 20 20 | 69 20 3d 20 30 3b 20 20 |.. |i = 0; |
|00000ca0| 20 20 20 20 2f 2a 20 66 | 69 6e 64 20 63 65 6c 6c | /* f|ind cell|
|00000cb0| 20 77 68 69 63 68 20 70 | 6f 69 6e 74 65 64 20 6f | which p|ointed o|
|00000cc0| 75 72 20 69 6e 64 65 78 | 20 62 6c 6f 63 6b 20 2a |ur index| block *|
|00000cd0| 2f 0d 0a 20 20 20 20 20 | 20 77 68 69 6c 65 20 28 |/.. | while (|
|00000ce0| 62 72 6f 62 6c 6b 2d 3e | 62 74 70 61 67 65 5b 69 |broblk->|btpage[i|
|00000cf0| 2b 2b 5d 2e 62 74 70 74 | 72 20 21 3d 20 69 64 78 |++].btpt|r != idx|
|00000d00| 6e 6f 64 65 29 7b 0d 0a | 20 20 20 20 20 20 20 20 |node){..| |
|00000d10| 20 69 66 20 28 69 20 3e | 3d 20 62 72 6f 62 6c 6b | if (i >|= broblk|
|00000d20| 2d 3e 63 65 6c 6c 69 63 | 6e 74 29 7b 0d 0a 20 20 |->cellic|nt){.. |
|00000d30| 20 20 20 20 20 20 20 20 | 20 20 6c 76 6c 6e 6f 64 | | lvlnod|
|00000d40| 65 20 3d 20 62 72 6f 62 | 6c 6b 2d 3e 66 77 64 70 |e = brob|lk->fwdp|
|00000d50| 61 67 65 3b 0d 0a 20 20 | 20 20 20 20 20 20 20 20 |age;.. | |
|00000d60| 20 20 67 65 74 69 64 78 | 72 28 66 64 69 64 78 2c | getidx|r(fdidx,|
|00000d70| 20 6c 76 6c 6e 6f 64 65 | 2c 20 62 72 6f 62 6c 6b | lvlnode|, broblk|
|00000d80| 2c 20 62 74 70 61 72 6d | 73 74 2d 3e 62 74 69 64 |, btparm|st->btid|
|00000d90| 78 6c 65 6e 2c 0d 0a 20 | 20 20 20 20 20 20 20 20 |xlen,.. | |
|00000da0| 20 20 20 20 20 20 20 20 | 20 62 74 70 61 72 6d 73 | | btparms|
|00000db0| 74 2d 3e 62 74 6b 65 79 | 6c 65 6e 29 3b 0d 0a 20 |t->btkey|len);.. |
|00000dc0| 20 20 20 20 20 20 20 20 | 20 20 20 69 20 3d 20 30 | | i = 0|
|00000dd0| 3b 0d 0a 20 20 20 20 20 | 20 20 20 20 7d 0d 0a 20 |;.. | }.. |
|00000de0| 20 20 20 20 20 7d 0d 0a | 20 20 20 20 20 20 69 2d | }..| i-|
|00000df0| 2d 3b 0d 0a 0d 0a 20 20 | 20 20 20 20 2f 2a 20 69 |-;.... | /* i|
|00000e00| 66 20 74 68 65 20 63 65 | 6c 6c 27 73 20 6b 65 79 |f the ce|ll's key|
|00000e10| 20 70 6f 69 6e 74 73 20 | 42 45 46 4f 52 45 20 74 | points |BEFORE t|
|00000e20| 68 65 20 6e 65 77 20 65 | 6e 64 6b 65 79 2c 20 72 |he new e|ndkey, r|
|00000e30| 65 70 6c 61 63 65 20 77 | 20 65 6e 64 6b 65 79 20 |eplace w| endkey |
|00000e40| 2a 2f 0d 0a 20 20 20 20 | 20 20 69 66 20 28 73 74 |*/.. | if (st|
|00000e50| 72 63 6d 70 28 62 72 6f | 62 6c 6b 2d 3e 62 74 70 |rcmp(bro|blk->btp|
|00000e60| 61 67 65 5b 69 5d 2e 73 | 6b 65 79 6e 6d 65 2c 20 |age[i].s|keynme, |
|00000e70| 65 6e 64 69 64 78 6b 79 | 29 20 3c 20 30 29 7b 0d |endidxky|) < 0){.|
|00000e80| 0a 20 20 20 20 20 20 20 | 20 20 73 74 72 63 70 79 |. | strcpy|
|00000e90| 28 62 72 6f 62 6c 6b 2d | 3e 62 74 70 61 67 65 5b |(broblk-|>btpage[|
|00000ea0| 69 5d 2e 73 6b 65 79 6e | 6d 65 2c 20 65 6e 64 69 |i].skeyn|me, endi|
|00000eb0| 64 78 6b 79 29 3b 0d 0a | 20 20 20 20 20 20 20 20 |dxky);..| |
|00000ec0| 20 70 75 74 69 64 78 72 | 28 66 64 69 64 78 2c 20 | putidxr|(fdidx, |
|00000ed0| 6c 76 6c 6e 6f 64 65 2c | 20 62 72 6f 62 6c 6b 2c |lvlnode,| broblk,|
|00000ee0| 20 62 74 70 61 72 6d 73 | 74 29 3b 0d 0a 20 20 20 | btparms|t);.. |
|00000ef0| 20 20 20 7d 0d 0a 20 20 | 20 20 20 20 2f 2a 20 6e | }.. | /* n|
|00000f00| 6f 77 20 63 68 65 63 6b | 20 70 61 72 65 6e 74 27 |ow check| parent'|
|00000f10| 73 20 65 6e 64 6b 65 79 | 20 2a 2f 0d 0a 20 20 20 |s endkey| */.. |
|00000f20| 20 20 20 2f 2a 20 69 66 | 20 70 61 72 65 6e 74 27 | /* if| parent'|
|00000f30| 73 20 65 6e 64 6b 65 79 | 20 70 6f 69 6e 74 73 20 |s endkey| points |
|00000f40| 41 46 54 45 52 20 6f 75 | 72 20 65 6e 64 6b 65 79 |AFTER ou|r endkey|
|00000f50| 2c 20 72 65 76 69 73 65 | 20 6f 75 72 20 65 6e 64 |, revise| our end|
|00000f60| 6b 65 79 20 2a 2f 0d 0a | 20 20 20 20 20 20 69 66 |key */..| if|
|00000f70| 20 28 73 74 72 63 6d 70 | 28 62 72 6f 62 6c 6b 2d | (strcmp|(broblk-|
|00000f80| 3e 62 74 70 61 67 65 5b | 62 72 6f 62 6c 6b 2d 3e |>btpage[|broblk->|
|00000f90| 63 65 6c 6c 69 63 6e 74 | 20 2d 20 31 5d 2e 73 6b |cellicnt| - 1].sk|
|00000fa0| 65 79 6e 6d 65 2c 20 65 | 6e 64 69 64 78 6b 79 29 |eynme, e|ndidxky)|
|00000fb0| 20 3e 20 30 29 0d 0a 20 | 20 20 20 20 20 20 20 20 | > 0).. | |
|00000fc0| 73 74 72 63 70 79 28 65 | 6e 64 69 64 78 6b 79 2c |strcpy(e|ndidxky,|
|00000fd0| 20 62 72 6f 62 6c 6b 2d | 3e 62 74 70 61 67 65 5b | broblk-|>btpage[|
|00000fe0| 62 72 6f 62 6c 6b 2d 3e | 63 65 6c 6c 69 63 6e 74 |broblk->|cellicnt|
|00000ff0| 20 2d 20 31 5d 2e 73 6b | 65 79 6e 6d 65 29 3b 0d | - 1].sk|eynme);.|
|00001000| 0a 20 20 20 20 20 20 69 | 64 78 6e 6f 64 65 20 3d |. i|dxnode =|
|00001010| 20 6c 76 6c 6e 6f 64 65 | 3b 0d 0a 0d 0a 20 20 20 | lvlnode|;.... |
|00001020| 7d 20 20 20 20 20 2f 2a | 20 63 6f 75 6e 74 69 6e |} /*| countin|
|00001030| 75 65 20 62 61 63 6b 20 | 75 70 20 74 68 65 20 74 |ue back |up the t|
|00001040| 72 65 65 20 2a 2f 0d 0a | 0d 0a 20 20 20 46 52 45 |ree */..|.. FRE|
|00001050| 45 28 65 6e 64 69 64 78 | 6b 79 29 3b 0d 0a 20 20 |E(endidx|ky);.. |
|00001060| 20 66 72 65 65 6b 65 79 | 73 28 62 72 6f 62 6c 6b | freekey|s(broblk|
|00001070| 29 3b 0d 0a 20 20 20 46 | 52 45 45 28 62 72 6f 62 |);.. F|REE(brob|
|00001080| 6c 6b 29 3b 0d 0a 20 20 | 20 0d 0a 20 20 20 72 65 |lk);.. | .. re|
|00001090| 74 75 72 6e 28 31 29 3b | 0d 0a 7d 0d 0a 0d 0a |turn(1);|..}.... |
+--------+-------------------------+-------------------------+--------+--------+