dagens retur

Roger Larsson (roger.larsson@skelleftea.mail.telia.com)
Tue, 9 Oct 2001 23:24:33 +0200


--------------Boundary-00=_XGJYP8HPVLS451YJDR9Q
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

-- 
Roger Larsson
Skellefteċ
Sweden

--------------Boundary-00=_XGJYP8HPVLS451YJDR9Q Content-Type: text/plain; charset="iso-8859-1"; name="VMS.py" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="VMS.py"

IyBUT0RPOiB3aW5kb3cgcG9zaXRpb25pbmcKZnJvbSB0aHJlYWQgaW1wb3J0ICoKaW1wb3J0IHJh bmRvbQppbXBvcnQgc3RydWN0CmZyb20gY3JjOCBpbXBvcnQgY3JjOCBhcyBjaGVja3N1bQppbXBv cnQgdGltZQppbXBvcnQgc3RyaW5nCgojIHVzZWQgaW4gZGVidWcgb25seQpkZWYgeV90ZXN0KChf ZDEseTEsX2QyKSwgKF9kMyx5MixfZDQpKToKICAgICAgICBpZiB5MSA8IHkyOgogICAgICAgICAg ICAgICAgcmV0dXJuIC0xCiAgICAgICAgZWxpZiB5MSA9PSB5MjoKICAgICAgICAgICAgICAgIHJl dHVybiAwCiAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgIHJldHVybiAxCgpjbGFzcyBWTVNS ZXN0YXJ0ZWQoSU9FcnJvcik6CiAgICAgICAgcGFzcwoKY2xhc3MgVk1TRXJyb3IoSU9FcnJvcik6 CgogICAgICAgIGVycm9yX2NvZGUgPSAwCgogICAgICAgIGRlZiBfX2luaXRfXyhzZWxmLCBlcnJv cl9jb2RlKToKICAgICAgICAgICAgICAgIHNlbGYuZXJyb3JfY29kZSA9IGVycm9yX2NvZGUKCmNs YXNzIFZNUzoKICAgICAgICBjcyA9IGFsbG9jYXRlX2xvY2soKQoKICAgICAgICBzdGF0ZSA9IDAK ICAgICAgICBzdGF0ZV90ZXh0ID0gKCdyZWFkeScsICdtZWFzdXJpbmcnLCAndHJhbnNmZXIgY2Fs aWJyYXRpb24nLCAnbGFzZXIgb3BlcmF0aW9ucycpCgogICAgICAgIHNlcmlhbF9ubyA9ICgyKjEw KSonMDAnCiAgICAgICAgdGVzdCA9IHt9ICMgc2VsZi50ZXN0IHJlc3VsdHMKCiAgICAgICAgZmQg PSAwCiAgICAgICAgX2ltYWdlX2lkX3RhZyA9IGludCh0aW1lLnRpbWUoKSkKICAgICAgICBpbWFn ZV9maWxlcyA9IFsnRm9nZ3kxLmpwZyddCgogICAgICAgIGRlZiBnZXRfaW1hZ2VfZGF0YShzZWxm LCB0eXBlcyk6CiAgICAgICAgICAgICAgICBzZWxmLl9zdGF0ZSgxKQogICAgICAgICAgICAgICAg aW1hZ2VfbGlzdCA9IHNlbGYuX2dldF9pbWFnZV9kYXRhKHR5cGVzKQogICAgICAgICAgICAgICAg c2VsZi5fc3RhdGUoMCkKICAgICAgICAgICAgICAgIHJldHVybiBpbWFnZV9saXN0CgogICAgICAg IGRlZiBnZXRfaW1hZ2VfZmlsZXMoc2VsZiwgdHlwZXMpOgogICAgICAgICAgICAgICAgc2VsZi5f c3RhdGUoMSkKICAgICAgICAgICAgICAgIGltYWdlX2xpc3QgPSBzZWxmLl9nZXRfaW1hZ2VfZGF0 YSh0eXBlcykKICAgICAgICAgICAgICAgIGZpbGVzID0gW10KICAgICAgICAgICAgICAgIGZvciAo aWQsIGZpbGVfdHlwZSwgZGF0YSkgaW4gaW1hZ2VfbGlzdDoKICAgICAgICAgICAgICAgICAgICAg ICAgZmlsZW5hbWUgPSB0ZW1wZmlsZS5ta3RlbXAoIi4iICsgZmlsZV90eXBlKQogICAgICAgICAg ICAgICAgICAgICAgICB3ZmQgPSBvcy5vcGVuKGZpbGVuYW1lLCAid2IiKQogICAgICAgICAgICAg ICAgICAgICAgICB3ZmQud3JpdGUoZGF0YSkKICAgICAgICAgICAgICAgICAgICAgICAgd2ZkLmNs b3NlKCkKICAgICAgICAgICAgICAgICAgICAgICAgZmlsZXMuYXBwZW5kKGZpbGVuYW1lKQoKICAg ICAgICAgICAgICAgIHNlbGYuaW1hZ2VfZmlsZXMgPSBmaWxlcwogICAgICAgICAgICAgICAgc2Vs Zi5fc3RhdGUoMCkKCiAgICAgICAgICAgICAgICByZXR1cm4gZmlsZXMKCgogICAgICAgIGRlZiBt ZWFzdXJlKHNlbGYsIGxhc2VyKToKICAgICAgICAgICAgICAgIHNlbGYuX3N0YXRlKDEpCiAgICAg ICAgICAgICAgICBzZWxmLmxhc2VyX29uKGxhc2VyKQogICAgICAgICAgICAgICAgc2VsZi5fcmVx dWVzdF9tZWFzdXJlKCkKICAgICAgICAgICAgICAgICh1c2VkX2xhc2VyLCBtZWFzdXJlZCkgPSBz ZWxmLl9yZWFkX21lYXN1cmUoKQogICAgICAgICAgICAgICAgYXNzZXJ0IHVzZWRfbGFzZXIgPT0g bGFzZXIsICJWTVM6IE1lYXN1cmUgZGF0YSBhcnJpdmluZyBmcm9tIHdyb25nIGxhc2VyICglZCwg ZXhwZWN0ZWQgJWQpIiAlICh1c2VkX2xhc2VyLCBsYXNlcikKICAgICAgICAgICAgICAgIHNlbGYu bGFzZXJfb2ZmKGxhc2VyKQogICAgICAgICAgICAgICAgc2VsZi5fc3RhdGUoMCkKICAgICAgICAg ICAgICAgIHJldHVybiBtZWFzdXJlZAoKICAgICAgICBkZWYgcmF3X21lYXN1cmUoc2VsZiwgbGFz ZXIpOgogICAgICAgICAgICAgICAgc2VsZi5fc3RhdGUoMSkKICAgICAgICAgICAgICAgIHNlbGYu bGFzZXJfb24obGFzZXIpCiAgICAgICAgICAgICAgICBzZWxmLl9yZXF1ZXN0X29iamVjdF9saXN0 KCkKICAgICAgICAgICAgICAgICh1c2VkX2xhc2VyLCBtZWFzdXJlZCkgPSBzZWxmLl9yZWFkX29i amVjdF9saXN0KCkKICAgICAgICAgICAgICAgIGFzc2VydCB1c2VkX2xhc2VyID09IGxhc2VyLCAi Vk1TOiBNZWFzdXJlIGRhdGEgYXJyaXZpbmcgZnJvbSB3cm9uZyBsYXNlciAoJWQsIGV4cGVjdGVk ICVkKSIgJSAodXNlZF9sYXNlciwgbGFzZXIpCiAgICAgICAgICAgICAgICBzZWxmLl9yZWFkX3N0 b3BfbGlzdHMoKSAjIGFsd2F5cyBmb2xsb3dzIGEgb2JqZWN0IGxpc3QKICAgICAgICAgICAgICAg IHNlbGYubGFzZXJfb2ZmKGxhc2VyKQogICAgICAgICAgICAgICAgc2VsZi5fc3RhdGUoMCkKICAg ICAgICAgICAgICAgIHJldHVybiBtZWFzdXJlZAoKICAgICAgICBkZWYgcmVhZHkoc2VsZik6CiAg ICAgICAgICAgICAgICByZXR1cm4gc3RhdGUgPT0gMAoKCiAgICAgICAgZGVmIHNldF9jYWxpYnJh dGlvbihzZWxmLCBsYXNlciwgeF9jYWxpYl9wYXJhbXMsIHlfY2FsaWJfcGFyYW1zKToKICAgICAg ICAgICAgICAgIHNlbGYuX3N0YXRlKDIpCiAgICAgICAgICAgICAgICAjIFRPRE8KICAgICAgICAg ICAgICAgIHNlbGYuX3N0YXRlKDApCiAgICAgICAgICAgICAgICByZXR1cm4KCiAgICAgICAgZGVm IGdldF9jYWxpYnJhdGlvbihzZWxmLCBsYXNlcik6CiAgICAgICAgICAgICAgICBzZWxmLl9zdGF0 ZSgyKQogICAgICAgICAgICAgICAgIyBUT0RPCiAgICAgICAgICAgICAgICBzZWxmLl9zdGF0ZSgw KQogICAgICAgICAgICAgICAgcmV0dXJuIDExKihsYXNlciwpCgogICAgICAgIGRlZiBtb2Rlcyhz ZWxmKToKICAgICAgICAgICAgICAgIHJldHVybiBbMSwgMl0gIyBMYXNlcnMKCiAgICAgICAgZGVm IGxhc2VyX29uKHNlbGYsIGxhc2VyKToKICAgICAgICAgICAgICAgIHNhdmVfc3RhdGUgPSBzZWxm Ll9zdGF0ZSgzKQogICAgICAgICAgICAgICAgYXNzZXJ0IGxhc2VyIGluIHNlbGYubW9kZXMoKSwg IkVycm9yOiB0cnlpbmcgdG8gbGl0IGxhc2VyICVkIiAlIGxhc2VyCiAgICAgICAgICAgICAgICBz ZWxmLl9zZXRfbGFzZXIobGFzZXIpCiAgICAgICAgICAgICAgICBzZWxmLl9zdGF0ZShzYXZlX3N0 YXRlKQogICAgICAgICAgICAgICAgcHJpbnQgIkxhc2VyICIsIGxhc2VyLCAiIG9uIgoKICAgICAg ICBkZWYgbGFzZXJfb2ZmKHNlbGYsIGxhc2VyKToKICAgICAgICAgICAgICAgIHNhdmVfc3RhdGUg PSBzZWxmLl9zdGF0ZSgzKQogICAgICAgICAgICAgICAgc2VsZi5fc2V0X2xhc2VyKDApCiAgICAg ICAgICAgICAgICBzZWxmLl9zdGF0ZShzYXZlX3N0YXRlKQogICAgICAgICAgICAgICAgcHJpbnQg Ikxhc2VyICIsIGxhc2VyLCAiIG9mZiIKCiAgICAgICAgIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIwogICAgICAgICMgUHJvdG9j b2wgZnVuY3Rpb25zCiAgICAgICAgIwoKICAgICAgICAjCiAgICAgICAgIyAxOiBVcGxvYWQgaW1h Z2UKICAgICAgICAjCiAgICAgICAgX2Zvcm1hdHMgPSBbJycsICdyYXcnLCAnZ2lmJywgJ2pwZydd CiAgICAgICAgX3R5cGVzID0gWycnLCAnQmluYXJ5IGxhc2VyIGltYWdlJywgJ0JpbmFyeSBiYWNr Z3JvdW5kIGltYWdlJywKICAgICAgICAgICAgICAgICAgICdHcmF5c2NhbGUgbGFzZXIgaW1hZ2Un LCAnR3JheXNjYWxlIGJhY2tncm91bmQgaW1hZ2UnXQogICAgICAgIF90eXBlc19mb3JtYXRzID0g KDAsIDEsIDEsIDMsIDMpCgogICAgICAgIGRlZiBfZ2V0X2ltYWdlcyhzZWxmLCByZXF1ZXN0X2xp c3QsIGZvcm1hdF9saXN0PVtdLCBleHBvc2U9MSwgY291bnQ9MSk6CiAgICAgICAgICAgICAgICAi IiIgRXhhbXBsZTogX3JlcXVlc3RfaW1hZ2VzKFsoNTIsICdHcmF5c2NhbGUgbGFzZXIgaW1hZ2Un KV0pCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuczogWyg1MiwgJ0pQRUcnLCAuLi4pXSAiIiIK ICAgICAgICAgICAgICAgIGRhdGEgPSBzdHJ1Y3QucGFjaygiQkIiLCBleHBvc2UsIGNvdW50KQoK ICAgICAgICAgICAgICAgICMgbWFrZSBmb3JtYXRfbGlzdCBlcXVhbCBsZW5ndCBvZiByZXF1ZXN0 X2xpc3QKICAgICAgICAgICAgICAgIGlmIGxlbihmb3JtYXRfbGlzdCkgPCBsZW4ocmVxdWVzdF9s aXN0KToKICAgICAgICAgICAgICAgICAgICAgICAgZm9ybWF0X2xpc3QgKz0gKGxlbihyZXF1ZXN0 X2xpc3QpIC0gbGVuKGZvcm1hdF9saXN0KSkgKiBbJyddCgogICAgICAgICAgICAgICAgIyMjICAg ICAgQlVHIGluIFB5dGhvbj8KICAgICAgICAgICAgICAgICNmb3IgKGlkLCB0KSwgZiBpbiByZXF1 ZXN0X2xpc3QsIGZvcm1hdF9saXN0OgogICAgICAgICAgICAgICAgcmVxdWVzdF9saXN0ID0gbWFw KChsYW1iZGEgKGlkLCB0KSwgZjogKGlkLCB0LCBmKSksIHJlcXVlc3RfbGlzdCwgZm9ybWF0X2xp c3QpCiAgICAgICAgICAgICAgICBiaW5hcnlfcmVxdWVzdF9saXN0ID0gW10KICAgICAgICAgICAg ICAgIGZvciAoaWQsIHQsIGYpIGluIHJlcXVlc3RfbGlzdDoKICAgICAgICAgICAgICAgICAgICAg ICAgIyBjb252ZXJ0IHRvIGludHMKICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHNlbGYuX3R5 cGVzLmluZGV4KHQpCgogICAgICAgICAgICAgICAgICAgICAgICBpZiBmID09ICcnOgogICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBzZWxmLl90eXBlc19mb3JtYXRzW3RdCiAgICAg ICAgICAgICAgICAgICAgICAgIGVsc2U6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ZiA9IHNlbGYuX2Zvcm1hdHMuaW5kZXgoZikKCiAgICAgICAgICAgICAgICAgICAgICAgIGJpbmFy eV9yZXF1ZXN0X2xpc3QuYXBwZW5kKCAoaWQsIHQsIGYpICkKCiAgICAgICAgICAgICAgICAgICAg ICAgICMgcGFjawogICAgICAgICAgICAgICAgICAgICAgICBkYXRhICs9IHN0cnVjdC5wYWNrKCJC QkIiLCB0LCBpZCwgZikKCiAgICAgICAgICAgICAgICBzZWxmLl93cml0ZV9tc2coMSwgZGF0YSkK CiAgICAgICAgICAgICAgICBpbWFnZXMgPSBbXQogICAgICAgICAgICAgICAgZm9yIChpZCwgXywg ZikgaW4gYmluYXJ5X3JlcXVlc3RfbGlzdDoKICAgICAgICAgICAgICAgICAgICAgICAgaW1hZ2Vz LmFwcGVuZCggKGlkLCBzZWxmLl9mb3JtYXRzW2ZdLCBzZWxmLl9yZWFkX2ltYWdlKGlkKSkgKQoK ICAgICAgICAgICAgICAgIHJldHVybiBpbWFnZXMKCiAgICAgICAgZGVmIF9yZWFkX2ltYWdlKHNl bGYsIGlkKToKICAgICAgICAgICAgICAgIG5vID0gMAogICAgICAgICAgICAgICAgcGFja2V0ID0g c2VsZi5fcmVhZF9wYWNrZXQoaWQsIG5vKQogICAgICAgICAgICAgICAgd2hpbGUgcGFja2V0Lmxl bigpID4gMDogIyBlYWNoIGltYWdlIGVuZHMgd2l0aCBhbiBlbXB0eSBwYWNrZXQKICAgICAgICAg ICAgICAgICAgICAgICAgZGF0YSArPSBwYWNrZXQKICAgICAgICAgICAgICAgICAgICAgICAgbm8g Kz0gMQogICAgICAgICAgICAgICAgICAgICAgICBwYWNrZXQgPSBzZWxmLl9yZWFkX3BhY2tldChp ZCwgbm8pCiAgICAgICAgICAgICAgICByZXR1cm4gZGF0YQoKICAgICAgICBkZWYgX3JlYWRfcGFj a2V0KHNlbGYsIGlkLCBubyk6CiAgICAgICAgICAgICAgICBwYWNrZXQgPSBzZWxmLl9yZWFkX21z ZygxKQogICAgICAgICAgICAgICAgKHJlYWRfaWQsIHJlYWRfbm8pID0gc3RydWN0LnVucGFjaygi QkIiLCBwYWNrZXRbMDoyXSkKICAgICAgICAgICAgICAgIGFzc2VydCByZWFkX2lkID09IGlkLCAi Vk1TOiBJZGVudGl0eSBtaXNtYXRjaCwgZXhwZWN0ZWQgJWQgZ290ICVkIiAlIChpZCwgcmVhZF9p ZCkKICAgICAgICAgICAgICAgIGFzc2VydCByZWFkX25vID09IG5vLCAiVk1TOiBOdW1iZXIgbWlz bWF0Y2gsIGV4cGVjdGVkICVkIGdvdCAlZCIgJSAobm8sIHJlYWRfbm8pCgogICAgICAgICAgICAg ICAgcmV0dXJuIHBhY2tldFsyOl0KCgoKCiAgICAgICAgIwogICAgICAgICMgNDogU2V0IGxhc2Vy IGxpbmUgb24vb2ZmCiAgICAgICAgIwogICAgICAgIGRlZiBfc2V0X2xhc2VyKHNlbGYpOgogICAg ICAgICAgICAgICAgZGF0YSA9IHN0cnVjdC5wYWNrKCJCIiwgc2VsZi5fbGFzZXIpCiAgICAgICAg ICAgICAgICBzZWxmLl93cml0ZV9tc2coNCwgZGF0YSkKICAgICAgICAgICAgICAgIGRhdGEgPSBz ZWxmLl9yZWFkX21zZyg0KQoKICAgICAgICAjCiAgICAgICAgIyAxMDogTGlzdHMgKFgsWSx3aWR0 aCkKICAgICAgICAjCiAgICAgICAgZGVmIF9yZXF1ZXN0X21lYXN1cmUoc2VsZiwgbm9fb2ZfbGlz dHM9MSk6CiAgICAgICAgICAgICAgICAiIiIgbm9fb2ZfbGlzdHMgPT0gMDogbWVhbnMgY29udGlu b3VzbHkKICAgICAgICAgICAgICAgICIiIgogICAgICAgICAgICAgICAgZGF0YSA9IHN0cnVjdC5w YWNrKCJCIiwgbm9fb2ZfbGlzdHMpCiAgICAgICAgICAgICAgICBzZWxmLl93cml0ZV9tc2coMTAs IGRhdGEpCgogICAgICAgIGRlZiBfcmVhZF9tZWFzdXJlKHNlbGYpOgogICAgICAgICAgICAgICAg IiIiIHJlYWQgb2JqZWN0IGxpc3QgIiIiCiAgICAgICAgICAgICAgICAodHlwZSwgbGVuLCBkYXRh KSA9IHNlbGYuX3JlYWRfbXNnKDEwKQogICAgICAgICAgICAgICAgbGFzZXIgPSBvcmQoZGF0YVsw XSkKICAgICAgICAgICAgICAgIG1lYXN1cmVkID0gW10KICAgICAgICAgICAgICAgIGZvciBpeCBp biByYW5nZSgxLCBsZW4sIDUpOgogICAgICAgICAgICAgICAgICAgICAgICBvYmplY3QgPSBzdHJ1 Y3QudW5wYWNrKCI8aGhCIiwgZGF0YVtpeDppeCs1XSkKICAgICAgICAgICAgICAgICAgICAgICAg bWVhc3VyZWQuYXBwZW5kKG9iamVjdCkKCiAgICAgICAgICAgICAgICByZXR1cm4gKGxhc2VyLCBt ZWFzdXJlZCkKCgogICAgICAgICMKICAgICAgICAjIDExOiBTdG9wIGxpc3RzCiAgICAgICAgIwog ICAgICAgIGRlZiBfcmVxdWVzdF9zdG9wX2xpc3RzKHNlbGYpOgogICAgICAgICAgICAgICAgc2Vs Zi5fd3JpdGVfbXNnKDExKQoKICAgICAgICBkZWYgX3JlYWRfc3RvcF9saXN0cyhzZWxmKToKICAg ICAgICAgICAgICAgIHNlbGYuX3JlYWRfbXNnKDExKQoKICAgICAgICAjCiAgICAgICAgIyAxNjog U2VsZiB0ZXN0CiAgICAgICAgIwogICAgICAgIGRlZiBfcGVyZm9ybV9zZWxmX3Rlc3Qoc2VsZik6 CiAgICAgICAgICAgICAgICBzZWxmLl93cml0ZV9tc2coMTYpCiAgICAgICAgICAgICAgICAodHlw ZSwgbGVuLCBkYXRhKSA9IHNlbGYuX3JlYWRfbXNnKDE2KQogICAgICAgICAgICAgICAgX2RlY29k ZV9zZWxmX3Rlc3QoZGF0YSkKCiAgICAgICAgZGVmIF9kZWNvZGVfc2VsZl90ZXN0KHNlbGYsIGRh dGEpOgogICAgICAgICAgICAgICAgIyBTZWxmIHRlc3QgZGF0YSBtaWdodCBjb21lIG9uIHdhdGNo ZG9nIHJlc3RhcnQKICAgICAgICAgICAgICAgIChzZWxmLnRlc3RbJ3N0YXR1cyddKSA9IHN0cnVj dC51bnBhY2soIjxIIiwgZGF0YVswOjJdKQogICAgICAgICAgICAgICAgc2VsZi50ZXN0Wydwcm90 b2NvbCddID0gc3RydWN0LnVucGFjaygiQkIiLCBkYXRhWzI6NF0pCiAgICAgICAgICAgICAgICBz ZWxmLnRlc3RbJ0ZQR0EnXSA9IHN0cnVjdC51bnBhY2soIkJCIiwgZGF0YVs0OjZdKQogICAgICAg ICAgICAgICAgc2VsZi50ZXN0WydEU1AnXSA9IHN0cnVjdC51bnBhY2soIkJCIiwgZGF0YVs2Ojhd KQogICAgICAgICAgICAgICAgc2VsZi5zZXJpYWxfbm8gPSByZWR1Y2UoKGxhbWJkYSBzLCBjOiBz ICsgIiUwMngiICUgb3JkKGMpKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIHN0cnVjdC51bnBhY2soIjEwQiIsIGRhdGFbODo4KzEwXSkpCgogICAgICAgICMKICAgICAg ICAjIDY0OiBCbG9iIG9mZnNldAogICAgICAgICMKICAgICAgICBkZWYgX3JlcXVlc3Rfb2JqZWN0 X2xpc3Qoc2VsZiwgcmVwZWF0cz0xLCBvZmZzZXQ9MCk6CiAgICAgICAgICAgICAgICBkYXRhID0g c3RydWN0LnBhY2soIkJCIiwgcmVwZWF0cywgb2Zmc2V0KQogICAgICAgICAgICAgICAgc2VsZi5f d3JpdGVfbXNnKDY0LCBkYXRhKQogICAgICAgICAgICAgICAgIyBOb3RlOiBhbHdheXMgZm9sbG93 ZWQgYnkgU3RvcCBsaXN0IGZvciBzb21lIHJlYXNvbi4KCiAgICAgICAgZGVmIF9yZWFkX29iamVj dF9saXN0KHNlbGYpOgogICAgICAgICAgICAgICAgKHR5cGUsIGxlbiwgZGF0YSkgPSBzZWxmLl9y ZWFkX21zZyg2NCkKCiAgICAgICAgICAgICAgICAjIGlnbm9yZSBibG9iIG9mZnNldCBhbmQgdG90 YWwgYmxvYiBjb3VudAogICAgICAgICAgICAgICAgbGFzZXIgPSBvcmQoZGF0YVsyXSkKCiAgICAg ICAgICAgICAgICBtZWFzdXJlZCA9IFtdCiAgICAgICAgICAgICAgICBmb3IgaXggaW4gcmFuZ2Uo MywgbGVuLCA1KToKICAgICAgICAgICAgICAgICAgICAgICAgb2JqZWN0ID0gc3RydWN0LnVucGFj aygiPGhoQiIsIGRhdGFbaXg6aXgrNV0pCiAgICAgICAgICAgICAgICAgICAgICAgIG1lYXN1cmVk LmFwcGVuZChvYmplY3QpCgogICAgICAgICAgICAgICAgcmV0dXJuIChsYXNlciwgbWVhc3VyZWQp CgoKCiAgICAgICAgIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj IyMjIyMjIyMjIyMjIyMjIyMjIyMKICAgICAgICAjICBDb21tdW5pY2F0aW9uIGhlbHBlciBmdW5j dGlvbnMKICAgICAgICAjCgogICAgICAgIGRlZiBfd3JpdGVfbXNnKHNlbGYsIHR5cGUsIGRhdGE9 IiIpOgogICAgICAgICAgICAgICAgYnVpbGQgPSBzdHJ1Y3QucGFjaygiQkJCIiwgMjU1LCB0eXBl LCBsZW4oZGF0YSkpCiAgICAgICAgICAgICAgICBidWlsZCArPSBkYXRhCiAgICAgICAgICAgICAg ICBidWlsZCArPSBjaHIoY2hlY2tzdW0oYnVpbGQpKQogICAgICAgICAgICAgICAgcHJpbnQgIlZN UyB3cml0ZSIsIHR5cGUKICAgICAgICAgICAgICAgIHNlbGYuZmQud3JpdGUoYnVpbGQpCiAgICAg ICAgICAgICAgICBzZWxmLmZkLmZsdXNoKCkKCiAgICAgICAgZGVmIF9yZWFkX21zZyhzZWxmLCBl eHBlY3RlZF90eXBlPTApOgogICAgICAgICAgICAgICAgc3luYyA9IHN0cnVjdC51bnBhY2soIkIi LCBzZWxmLmZkLnJlYWQoMSkpCiAgICAgICAgICAgICAgICBpZiBzeW5jICE9IDI1NToKICAgICAg ICAgICAgICAgICAgICAgICAgcHJpbnQgIldhcm5pbmc6IFN5bmMgbG9zdCEgcmVzeW5jaW5nIChn b3QiLCBzeW5jLCAiKSIKICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgc3luYyAhPSAyNTU6 CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3luYyA9IHN0cnVjdC51bnBhY2soIkIi LCBzZWxmLmZkLnJlYWQoMSkpCgogICAgICAgICAgICAgICAgKHR5cGUsIGxlbikgPSBzdHJ1Y3Qu dW5wYWNrKCJCQiIsIHNlbGYuZmQucmVhZCgyKSkKCiAgICAgICAgICAgICAgICBkYXRhID0gc2Vs Zi5mZC5yZWFkKGxlbikKCiAgICAgICAgICAgICAgICBjc3VtID0gc3RydWN0LnVucGFjaygiQiIs IHNlbGYuZmQucmVhZCgxKSkKICAgICAgICAgICAgICAgIGlmIGNzdW0gIT0gY2hlY2tzdW0oc3Ry dWN0LnBhY2soIkJCQiIsIDI1NSwgdHlwZSwgbGVuKSArIGRhdGEpOgogICAgICAgICAgICAgICAg ICAgICAgICByYWlzZSBJT0Vycm9yCgogICAgICAgICAgICAgICAgaWYgdHlwZSAhPSBleHBlY3Rl ZF90eXBlOgogICAgICAgICAgICAgICAgICAgICAgICBpZiB0eXBlID09IDE2OiAjIHNlbGYgdGVz dCBkYXRhLCBzcG9udGFuZW91cyByZXN0YXJ0IQogICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIHByaW50ICJXYXJuaW5nOiBWTVMgcmVzdGFydGVkIHNwb250YW5lb3VzbHkhIgogICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuX2RlY29kZV9zZWxmX3Rlc3QoZGF0YSkKICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICByYWlzZSBWTVNSZXN0YXJ0ZWQKICAgICAgICAg ICAgICAgICAgICAgICAgaWYgdHlwZSA9PSAyNToKICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICBlcnJvcl9jb2RlID0gc3RydWN0LnVucGFjaygiPEgiLCBkYXRhKQogICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIHByaW50ICJWTVMgRXJyb3IgbWVzc2FnZToiLCBlcnJvcl9jb2Rl CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmFpc2UgVk1TRXJyb3IoZXJyb3JfY29k ZSkKCiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2U6CiAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgcHJpbnQgIlJlYWQgdW5leHBlY3RlZCBtZXNzYWdlICh0eXBlPSVkLCBsZW49JWQp IiAlICh0eXBlLCBsZW4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmFpc2UgSU9F cnJvcgoKICAgICAgICAgICAgICAgIHByaW50ICJWTVMgcmVhZCIsIHR5cGUsIGxlbgogICAgICAg ICAgICAgICAgcmV0dXJuICh0eXBlLCBsZW4sIGRhdGEpCgogICAgICAgICMKICAgICAgICAjIFdl YmIgaW50ZXJmYWNlCiAgICAgICAgIwogICAgICAgIGRlZiBodG1sX2FjdGlvbihzZWxmLCBhY3Rp b24sIHF1ZXJ5KToKICAgICAgICAgICAgICAgIGlmIGFjdGlvbiA9PSAiT0siOgogICAgICAgICAg ICAgICAgICAgICAgICBwYXNzCiMgICAgICAgICAgICAgICAgICAgICAgICBmb3IgYXNzaWdubWVu dCBpbiBxdWVyeS5zcGxpdCgnJicpOgojICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAo dmFyLCB2YWx1ZSkgPSBhc3NpZ25tZW50LnNwbGl0KCc9JykKIyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgaWYgdmFyICE9ICJhY3Rpb24iOgojICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIGV4ZWMgInNlbGYuIiArIHZhciArICI9IGludCh2YWx1ZSkiCiAgICAg ICAgICAgICAgICBlbGlmIGFjdGlvbiA9PSAiUkVGUkVTSCI6CiAgICAgICAgICAgICAgICAgICAg ICAgIHBhc3MKICAgICAgICAgICAgICAgIGVsaWYgYWN0aW9uID09ICJHUkFCIjoKICAgICAgICAg ICAgICAgICAgICAgICAgc2VsZi5nZXRfaW1hZ2VfZmlsZXMoWydCaW5hcnkgbGFzZXIgaW1hZ2Un LCAnQmluYXJ5IGJhY2tncm91bmQgaW1hZ2UnLCAnR3JheXNjYWxlIGxhc2VyIGltYWdlJywgJ0dy YXlzY2FsZSBiYWNrZ3JvdW5kIGltYWdlJ10pCiAgICAgICAgICAgICAgICAgICAgICAgICMgaWdu b3JlIHJldHVybmVkIHZhbHVlcwogICAgICAgICAgICAgICAgZWxpZiBhY3Rpb24gPT0gIiI6CiAg ICAgICAgICAgICAgICAgICAgICAgIHBhc3MKIyAgICAgICAgICAgICAgICAgICAgICAgIHRyeToK IyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5zZXR0aW5nc19hY3Rpb24oIkdP VE8iLCBxdWVyeSkKIyAgICAgICAgICAgICAgICAgICAgICAgIGV4Y2VwdCBBdHRyaWJ1dGVFcnJv cjoKIyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5zZXR0aW5nc19hY3Rpb24o Ik9LIiwgcXVlcnkpCiAgICAgICAgICAgICAgICBlbHNlOgogICAgICAgICAgICAgICAgICAgICAg ICByYWlzZSB1bmtub3duX2FjdGlvbgoKCgogICAgICAgIGRlZiBodG1sX3BhZ2Uoc2VsZiwgZik6 CiAgICAgICAgICAgICAgICBmLndyaXRlKCc8Zm9ybT4nKQogICAgICAgICAgICAgICAgZi53cml0 ZSgnPEgyPjxicj5DdXJyZW50bHkgJyArIHNlbGYuc3RhdGVfdGV4dFtzZWxmLnN0YXRlXSArICc8 YnI+PC9IMj4nKQogICAgICAgICAgICAgICAgZi53cml0ZSgnPC9mb3JtPicpCgogICAgICAgICAg ICAgICAgZi53cml0ZSgnPGhyPicpCiAgICAgICAgICAgICAgICBmLndyaXRlKCc8Zm9ybT4nKQog ICAgICAgICAgICAgICAgZi53cml0ZSgnPEgyPkFjdGlvbnM8L0gyPicpCiAgICAgICAgICAgICAg ICBmLndyaXRlKCc8SU5QVVQgVFlQRT1zdWJtaXQgTkFNRT1hY3Rpb24gVkFMVUU9IlJFRlJFU0gi PicpCiAgICAgICAgICAgICAgICBmLndyaXRlKCc8SU5QVVQgVFlQRT1zdWJtaXQgTkFNRT1hY3Rp b24gVkFMVUU9IkdSQUIiPicpCiAgICAgICAgICAgICAgICBmLndyaXRlKCc8L2Zvcm0+JykKCiAg ICAgICAgICAgICAgICBmLndyaXRlKCc8YnI+PGhyPjxmb3JtPicpCiAgICAgICAgICAgICAgICBm LndyaXRlKCc8SDI+Q29uc3RhbnRzPC9IMj4nKQogICAgICAgICAgICAgICAgZi53cml0ZSgnU2Vy aWFuIG5vOiAweCcgKyBzZWxmLnNlcmlhbF9ubykKICAgICAgICAgICAgICAgIGYud3JpdGUoJzxi cj5TZWxmIHRlc3Q6ICcgKyBzdHIoc2VsZi50ZXN0KSkKICAgICAgICAgICAgICAgIGYud3JpdGUo JzwvZm9ybT4nKQoKICAgICAgICAgICAgICAgIGltYWdlX2ZpbGVzID0gc2VsZi5pbWFnZV9maWxl cwogICAgICAgICAgICAgICAgaWYgaW1hZ2VfZmlsZXM6CiAgICAgICAgICAgICAgICAgICAgICAg IGYud3JpdGUoJzxocj4nKQogICAgICAgICAgICAgICAgZm9yIGZpbGUgaW4gaW1hZ2VfZmlsZXM6 CiAgICAgICAgICAgICAgICAgICAgICAgIGYud3JpdGUoJzxpbWcgc3JjPSJzdGF0aWM/JXMiIHdp ZHRoPSIxMDUiIGhlaWdodD0iMTQwIj4nICUgZmlsZSkKCiAgICAgICAgIwogICAgICAgICMgT3Ro ZXIgaGVscGVyIGZ1bmN0aW9ucwogICAgICAgICMKICAgICAgICBkZWYgX19pbml0X18oc2VsZiwg ZmQpOgogICAgICAgICAgICAgICAgc2VsZi5mZCA9IGZkCgogICAgICAgIGRlZiBfc3RhdGUoc2Vs Ziwgc3RhdGUpOgogICAgICAgICAgICAgICAgIiIiIFNldCBuZXcgc3RhdGUsIHJldHVybiBvbGQg KGludGVybmFsIHVzZSkgIiIiCiAgICAgICAgICAgICAgICBzZWxmLmNzLmFjcXVpcmUoKQogICAg ICAgICAgICAgICAgc2F2ZV9zdGF0ZSA9IHNlbGYuc3RhdGUKICAgICAgICAgICAgICAgIHNlbGYu c3RhdGUgPSBzdGF0ZQogICAgICAgICAgICAgICAgc2VsZi5jcy5yZWxlYXNlKCkKICAgICAgICAg ICAgICAgIHJldHVybiBzYXZlX3N0YXRlCgogICAgICAgIGRlZiBfbmV4dF9pZF90YWcoc2VsZik6 CiAgICAgICAgICAgICAgICBzZWxmLmNzLmFjcXVpcmUoKQogICAgICAgICAgICAgICAgdGFnID0g c2VsZi5faW1hZ2VfaWRfdGFnID0gKHNlbGYuX2ltYWdlX2lkX3RhZyArIDEpICUgMjU2CiAgICAg ICAgICAgICAgICBzZWxmLmNzLnJlbGVhc2UoKQogICAgICAgICAgICAgICAgcmV0dXJuIHRhZwoK ICAgICAgICBkZWYgX2dldF9pbWFnZV9kYXRhKHNlbGYsIHR5cGVzKToKICAgICAgICAgICAgICAg IHJlcXVlc3RfbGlzdCA9IFtdCiAgICAgICAgICAgICAgICBmb3IgdCBpbiB0eXBlczoKICAgICAg ICAgICAgICAgICAgICAgICAgdGFnID0gc2VsZi5fbmV4dF9pZF90YWcoKQogICAgICAgICAgICAg ICAgICAgICAgICByZXF1ZXN0X2xpc3QuYXBwZW5kKCAodGFnLCB0KSApCgogICAgICAgICAgICAg ICAgaW1hZ2VfbGlzdCA9IHNlbGYuX2dldF9pbWFnZXMocmVxdWVzdF9saXN0KQogICAgICAgICAg ICAgICAgcmV0dXJuIGltYWdlX2xpc3QKCgpjbGFzcyBTaW11bGF0ZWRWTVMoVk1TKToKCiAgICAg ICAgZGVmIGdldF9pbWFnZV9maWxlcyhzZWxmLCB0eXBlcyk6CiAgICAgICAgICAgICAgICBzZWxm LmltYWdlX2ZpbGVzID0gWydGb2dneTEuanBnJywgJ01hcmJsZTAxLmpwZyddCiAgICAgICAgICAg ICAgICByZXR1cm4gc2VsZi5pbWFnZV9maWxlcwoKICAgICAgICBkZWYgbWVhc3VyZShzZWxmLCBs YXNlcik6CiAgICAgICAgICAgICAgICBzZWxmLmxhc2VyX29uKGxhc2VyKQogICAgICAgICAgICAg ICAgbWVhc3VyZWQgPSBbXQogICAgICAgICAgICAgICAgZm9yIGl0ZW0gaW4gcmFuZ2UoMTApOgog ICAgICAgICAgICAgICAgICAgICAgICB4X21tID0gMjAgKiBpdGVtCiAgICAgICAgICAgICAgICAg ICAgICAgIHlfbW0gPSA1MiArIHJhbmRvbS5yYW5kcmFuZ2UoLTUsIDUpCiAgICAgICAgICAgICAg ICAgICAgICAgIGlmIGl0ZW0gPT0gNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3 X21tID0gcmFuZG9tLnJhbmRyYW5nZSg5LDExKQogICAgICAgICAgICAgICAgICAgICAgICBlbHNl OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdfbW0gPSByYW5kb20ucmFuZHJhbmdl KDYsOCkKCiAgICAgICAgICAgICAgICAgICAgICAgIG1lYXN1cmVkLmFwcGVuZCgoeF9tbSx5X21t LHdfbW0pKQoKICAgICAgICAgICAgICAgIHNlbGYubGFzZXJfb2ZmKGxhc2VyKQogICAgICAgICAg ICAgICAgcmV0dXJuIG1lYXN1cmVkCgogICAgICAgIGRlZiByYXdfbWVhc3VyZShzZWxmLCBsYXNl cik6CiAgICAgICAgICAgICAgICBzZWxmLmxhc2VyX29uKGxhc2VyKQogICAgICAgICAgICAgICAg bWVhc3VyZWQgPSBbXQogICAgICAgICAgICAgICAgZm9yIGl0ZW0gaW4gcmFuZ2UoMTApOgogICAg ICAgICAgICAgICAgICAgICAgICB4cGl4ID0gMTAgKiBpdGVtICsgcmFuZG9tLnJhbmRyYW5nZSgt MSwxKQogICAgICAgICAgICAgICAgICAgICAgICB5cGl4ID0gNTIgKyByYW5kb20ucmFuZHJhbmdl KC01LCA1KQogICAgICAgICAgICAgICAgICAgICAgICBpZiBpdGVtID09IDQ6CiAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgd3BpeCA9IHJhbmRvbS5yYW5kcmFuZ2UoMzAsIDUwKQogICAg ICAgICAgICAgICAgICAgICAgICBlbHNlOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IHdwaXggPSByYW5kb20ucmFuZHJhbmdlKDE1LCAzMCkKCiAgICAgICAgICAgICAgICAgICAgICAg IG1lYXN1cmVkLmFwcGVuZCgoeHBpeCx5cGl4LHdwaXgpKQoKICAgICAgICAgICAgICAgIHNlbGYu bGFzZXJfb2ZmKGxhc2VyKQogICAgICAgICAgICAgICAgbWVhc3VyZWQuc29ydCh5X3Rlc3QpCgog ICAgICAgICAgICAgICAgcmV0dXJuIG1lYXN1cmVkCgoKICAgICAgICBkZWYgX3NldF9sYXNlcihz ZWxmLCBsYXNlcik6CiAgICAgICAgICAgICAgICBwYXNzCgogICAgICAgIGRlZiBfcmVhZF9tc2co c2VsZiwgZXhwZWN0ZWRfdHlwZT0wKToKCiAgICAgICAgICAgICAgICBpZiBleHBlY3RlZF90eXBl ID09IDE6CiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEgPSBzdHJ1Y3QucGFjaygiQkIiLCAw LCAwKQogICAgICAgICAgICAgICAgZWxpZiBleHBlY3RlZF90eXBlID09IDQ6CiAgICAgICAgICAg ICAgICAgICAgICAgIGRhdGEgPSAiIgogICAgICAgICAgICAgICAgZWxpZiBleHBlY3RlZF90eXBl ID09IDEwOgogICAgICAgICAgICAgICAgICAgICAgICBkYXRhID0gc3RydWN0LnBhY2soIkIiLCAx KQogICAgICAgICAgICAgICAgICAgICAgICAjIGxpc3QKICAgICAgICAgICAgICAgIGVsaWYgZXhw ZWN0ZWRfdHlwZSA9PSAxNjoKICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSA9IDE4KidcMCcg IyB3aHkgbm90Li4uIDotKQogICAgICAgICAgICAgICAgZWxpZiBleHBlY3RlZF90eXBlID09IDY0 OgogICAgICAgICAgICAgICAgICAgICAgICBkYXRhID0gIiIgIyBUT0RPOiBpbXBsZW1lbnQKICAg ICAgICAgICAgICAgIGVsc2U6CiAgICAgICAgICAgICAgICAgICAgICAgIHByaW50ICdXYXJuaW5n OiB1bmV4cGVjdGVkIHR5cGUnLCBleHBlY3RlZF90eXBlCiAgICAgICAgICAgICAgICAgICAgICAg IHJldHVybiBzZWxmLl9yZWFkX21zZygxNikKCiAgICAgICAgICAgICAgICBkYXRhID0gc3RydWN0 LnBhY2soIkJCQiIsIDI1NSwgZXhwZWN0ZWRfdHlwZSwgbGVuKGRhdGEpKSArIGRhdGEKCiAgICAg ICAgICAgICAgICByZXR1cm4gZGF0YQo=

--------------Boundary-00=_XGJYP8HPVLS451YJDR9Q Content-Type: text/plain; charset="iso-8859-1"; name="Calibrate.py" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="Calibrate.py"

ZnJvbSB0aHJlYWQgaW1wb3J0ICoKaW1wb3J0IG9zDQppbXBvcnQgcmFuZG9tDQppbXBvcnQgcmUK aW1wb3J0IHN0cmluZwoNCmNsYXNzIENhbGlicmF0ZToNCiAgICAgICAgY3MgPSBhbGxvY2F0ZV9s b2NrKCkNCiAgICAgICAgc3RhdGUgPSAwDQogICAgICAgIHN0YXRlX2hlYWRpbmcgPSAoImNhbGli cmF0aW5nIiwgInJlYWR5IiwgImNhbGlicmF0ZWQiLCAidmVyaWZ5aW5nIiwgInZlcmlmaWVkIikN CiAgICAgICAgYXV0byA9IDENCg0KICAgICAgICAjIHBpcGVzIHRvIG9jdGF2ZSBwcm9jZXNzDQog ICAgICAgIG9jdGF2ZV9pbiA9IDANCiAgICAgICAgb2N0YXZlX291dCA9IDANCg0KICAgICAgICBk ZWYgcmVhZHkoc2VsZik6DQogICAgICAgICAgICAgICAgcmV0dXJuIHNlbGYuc3RhdGUgbm90IGlu ICgxLCAzKQ0KDQogICAgICAgICMgUHJvdGVjdGVkIGJ5IGxvY2ssIGtleWVkIGJ5IG1vZGUNCiAg ICAgICAgcmF3X2RhdGEgPSB7fQ0KICAgICAgICB2ZXJpZnlfbW0gPSBbXQ0KICAgICAgICB2ZXJp ZnlfZGF0YSA9IHt9DQoNCiAgICAgICAgIyBOb3QgcHJvdGVjdGVkIGJ5IGxvY2sNCiAgICAgICAg bW90b3IgPSBOb25lDQogICAgICAgIHNlbnNvciA9IE5vbmUNCg0KDQogICAgICAgIGRlZiBfX2lu aXRfXyhzZWxmLCBtb3Rvciwgc2Vuc29yKToNCiAgICAgICAgICAgICAgICBzZWxmLmNzLmFjcXVp cmUoKQ0KICAgICAgICAgICAgICAgIHNlbGYubW90b3IgPSBtb3Rvcg0KICAgICAgICAgICAgICAg IHNlbGYuc2Vuc29yID0gc2Vuc29yDQogICAgICAgICAgICAgICAgDQogICAgICAgICAgICAgICAg aWYgb3MubmFtZSA9PSAicG9zaXgiOg0KICAgICAgICAgICAgICAgICAgICAgICAgKHNlbGYub2N0 YXZlX2luLCBzZWxmLm9jdGF2ZV9vdXQpPW9zLnBvcGVuMignb2N0YXZlIC0tc2lsZW50IC0tbm8t aGlzdG9yeSAtLXBhdGggOi4uL01hdGxhYjouLi9NYXRsYWIvT2N0YXZlJykKICAgICAgICAgICAg ICAgIGVsaWYgb3MubmFtZSA9PSAibnQiOg0KICAgICAgICAgICAgICAgICAgICAgICAgKHNlbGYu b2N0YXZlX2luLCBzZWxmLm9jdGF2ZV9vdXQpPW9zLnBvcGVuMihyJ0g6XFBST0dSQU1cR05VXE9D VEFWRVxcYmluXGJhc2guZXhlIiAtLWxvZ2luIC1jICJyeHZ0IC1lIG9jdGF2ZSAtLXNpbGVudCAt LW5vLWhpc3RvcnkgLS1wYXRoIDovY3lnZHJpdmUvYy92bXMvTWF0bGFiOi9jeWdkcml2ZS9jL3Zt cy9NYXRsYWIvT2N0YXZlJykNCiAgICAgICAgICAgICAgICAgICAgICAgIA0KICAgICAgICAgICAg ICAgIHNlbGYub2N0YXZlX2luLndyaXRlKCJnbnVwbG90X2hhc19mcmFtZXM9MTtcbiIpDQogICAg ICAgICAgICAgICAgc2VsZi5vY3RhdmVfaW4uZmx1c2goKQ0KICAgICAgICAgICAgICAgIHNlbGYu Y3MucmVsZWFzZSgpDQoNCiAgICAgICAgZGVmIGNhbGlicmF0ZV9yYW5nZV9tbShzZWxmKToNCiAg ICAgICAgICAgICAgICByZXR1cm4gcmFuZ2Uoc2VsZi5tb3Rvci5ob21lX21tLCBzZWxmLm1vdG9y LmFsdF9tbSwgMTApDQoNCgogICAgICAgIG51bWJlcl9yZSA9IHJlLmNvbXBpbGUociIoW1wtXT9b XGRdKltcLltcZF0rXT8pIikNCg0KICAgICAgICBkZWYgY2FsaWJyYXRlX3RocmVhZChzZWxmKToN CiAgICAgICAgICAgICAgICBwcmludCAiY2FsaWJyYXRlX3RocmVhZCINCiAgICAgICAgICAgICAg ICBzZWxmLmNzLmFjcXVpcmUoKQ0KDQogICAgICAgICAgICAgICAgYXNzZXJ0KHNlbGYuc3RhdGUg IT0gMSkNCiAgICAgICAgICAgICAgICBzZWxmLnN0YXRlID0gMQ0KCiAgICAgICAgICAgICAgICBz ZW5zb3IgPSBzZWxmLnNlbnNvcg0KICAgICAgICAgICAgICAgIG1vZGVzID0gc2Vuc29yLm1vZGVz KCkNCg0KICAgICAgICAgICAgICAgIHNlbGYucmF3X2RhdGEuY2xlYXIoKQ0KICAgICAgICAgICAg ICAgIHNlbGYudmVyaWZ5X2RhdGEuY2xlYXIoKQ0KDQogICAgICAgICAgICAgICAgc2VsZi5zdGF0 aXN0aWNzID0ge30NCiAgICAgICAgICAgICAgICBmb3IgbW9kZSBpbiBtb2RlczoNCiAgICAgICAg ICAgICAgICAgICAgICAgIHNlbGYucmF3X2RhdGFbbW9kZV0gPSBbXQ0KICAgICAgICAgICAgICAg ICAgICAgICAgc2VsZi5zdGF0aXN0aWNzW21vZGVdID0ge30NCiAgICAgICAgICAgICAgICBzZWxm LmNzLnJlbGVhc2UoKQ0KDQogICAgICAgICAgICAgICAgIyBBbHdheXMgc3RhcnQgbWVhc3VyZW1l bnRzIGZyb20gaG9tZQ0KICAgICAgICAgICAgICAgIHNlbGYubW90b3IuaG9tZSgpDQogICAgICAg ICAgICAgICAgc2VsZi5tb3Rvci53YWl0KCkNCg0KICAgICAgICAgICAgICAgIGZvciB4X21tIGlu IHNlbGYuY2FsaWJyYXRlX3JhbmdlX21tKCk6DQogICAgICAgICAgICAgICAgICAgICAgICBzZWxm Lm1vdG9yLmdvdG9fbW0oeF9tbSkNCiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYubW90b3Iu d2FpdCgpDQoNCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciBtb2RlIGluIG1vZGVzOg0KICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmNzLmFjcXVpcmUoKQ0KICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICByYXdfZGF0YSA9IHNlbnNvci5yYXdfbWVhc3VyZShtb2Rl KQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnN0YXRpc3RpY3NbbW9kZV1b J1kgcGl4IG1pbiddID0gcmVkdWNlKChsYW1iZGEgbSwgKF9kMSwgeSwgX2QyKTogbWluKG0sIHkp KSwgcmF3X2RhdGEsIDk5OTkpDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYu c3RhdGlzdGljc1ttb2RlXVsnWSBwaXggbWF4J10gPSByZWR1Y2UoKGxhbWJkYSBtLCAoX2QxLCB5 LCBfZDIpOiBtYXgobSwgeSkpLCByYXdfZGF0YSwgLTEpDQogICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIHJhd19kYXRhLnNvcnQoKSAjIGluIFggb3JkZXIsIG5vdCBhcHJveGltYXRlbHkg WS4uLg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnJhd19kYXRhW21vZGVd LmFwcGVuZCggcmF3X2RhdGEgKQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxm LmNzLnJlbGVhc2UoKQ0KDQogICAgICAgICAgICAgICAgZm9yIG1vZGUgaW4gbW9kZXM6DQogICAg ICAgICAgICAgICAgICAgICAgICBzZWxmLmNzLmFjcXVpcmUoKQ0KICAgICAgICAgICAgICAgICAg ICAgICAgcmF3X2RhdGEgPSBzZWxmLnJhd19kYXRhW21vZGVdDQogICAgICAgICAgICAgICAgICAg ICAgICBzZWxmLmNzLnJlbGVhc2UoKQ0KDQogICAgICAgICAgICAgICAgICAgICAgICB3cml0ZV9v Y3RhdmVfZGF0YShzZWxmLm9jdGF2ZV9pbiwgc2VsZi5jYWxpYnJhdGVfcmFuZ2VfbW0oKSwgcmF3 X2RhdGEpDQogICAgICAgICAgICAgICAgICAgICAgICBzZWxmLm9jdGF2ZV9pbi53cml0ZSgia2Fs aWJyZXJpbmdcbiIpDQogICAgICAgICAgICAgICAgICAgICAgICBzZWxmLm9jdGF2ZV9pbi5mbHVz aCgpDQogICAgICAgICAgICAgICAgICAgICAgICBjYWxpYl9wYXJhbXNfeCA9IHJlYWRfb2N0YXZl X2RhdGEoc2VsZi5vY3RhdmVfb3V0LCAiWENvZWZmOiIsIHNlbGYubnVtYmVyX3JlLCAxMSkNCiAg ICAgICAgICAgICAgICAgICAgICAgIHByaW50ICJjYWxpYl9wYXJhbXNfeCIsIGNhbGliX3BhcmFt c194DQogICAgICAgICAgICAgICAgICAgICAgICBjYWxpYl9wYXJhbXNfeSA9IHJlYWRfb2N0YXZl X2RhdGEoc2VsZi5vY3RhdmVfb3V0LCAiWUNvZWZmOiIsIHNlbGYubnVtYmVyX3JlLCAxMSkNCiAg ICAgICAgICAgICAgICAgICAgICAgIHByaW50ICJjYWxpYl9wYXJhbXNfeSIsIGNhbGliX3BhcmFt c195DQogICAgICAgICAgICAgICAgICAgICAgICAjIFR3byBlbXB0eSBsaW5lcw0KICAgICAgICAg ICAgICAgICAgICAgICAgc2VsZi5vY3RhdmVfb3V0LnJlYWRsaW5lKCkNCiAgICAgICAgICAgICAg ICAgICAgICAgIHNlbGYub2N0YXZlX291dC5yZWFkbGluZSgpDQogICAgICAgICAgICAgICAgICAg ICAgICAjIEZvdXIgbGluZXMgd2l0aCBzdGF0aXN0aWNzDQoNCiAgICAgICAgICAgICAgICAgICAg ICAgIHNlbGYuc3RhdGlzdGljc1ttb2RlXVsnWCBlcnIgbWVhbiddID0gZmxvYXQoc2VsZi5udW1i ZXJfcmUuc2VhcmNoKHNlbGYub2N0YXZlX291dC5yZWFkbGluZSgpKS5ncm91cCgwKSkNCiAgICAg ICAgICAgICAgICAgICAgICAgIHNlbGYuc3RhdGlzdGljc1ttb2RlXVsnWCBlcnIgbWF4J10gPSBm bG9hdChzZWxmLm51bWJlcl9yZS5zZWFyY2goc2VsZi5vY3RhdmVfb3V0LnJlYWRsaW5lKCkpLmdy b3VwKDApKQogICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnN0YXRpc3RpY3NbbW9kZV1bJ1kg ZXJyIG1lYW4nXSA9IGZsb2F0KHNlbGYubnVtYmVyX3JlLnNlYXJjaChzZWxmLm9jdGF2ZV9vdXQu cmVhZGxpbmUoKSkuZ3JvdXAoMCkpDQogICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnN0YXRp c3RpY3NbbW9kZV1bJ1kgZXJyIG1heCddID0gZmxvYXQoc2VsZi5udW1iZXJfcmUuc2VhcmNoKHNl bGYub2N0YXZlX291dC5yZWFkbGluZSgpKS5ncm91cCgwKSkNCiAgICAgICAgICAgICAgICAgICAg ICAgIHByaW50IHNlbGYuc3RhdGlzdGljcw0KDQogICAgICAgICAgICAgICAgICAgICAgICBzZW5z b3Iuc2V0X2NhbGlicmF0aW9uKG1vZGUsIGNhbGliX3BhcmFtc194LCBjYWxpYl9wYXJhbXNfeSkN Cg0KICAgICAgICAgICAgICAgIGlmIG5vdCBzZWxmLmF1dG86DQogICAgICAgICAgICAgICAgICAg ICAgICBzZWxmLmNzLmFjcXVpcmUoKQ0KICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5zdGF0 ZSA9IDINCiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuY3MucmVsZWFzZSgpDQogICAgICAg ICAgICAgICAgZWxzZToNCiAgICAgICAgICAgICAgICAgICAgICAgICMgYXV0byBjb250aW51ZSwg bm8gbm90IHBhc3Mgc3RhdGUgMiAhDQogICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnZlcmlm eV90aHJlYWQoKQ0KDQogICAgICAgIGRlZiB2ZXJpZnlfdGhyZWFkKHNlbGYpOg0KICAgICAgICAg ICAgICAgIHByaW50ICJ2ZXJpZnlfdGhyZWFkIg0KICAgICAgICAgICAgICAgIHNlbGYuY3MuYWNx dWlyZSgpDQogICAgICAgICAgICAgICAgc2VsZi5zdGF0ZSA9IDMKDQogICAgICAgICAgICAgICAg c2Vuc29yID0gc2VsZi5zZW5zb3INCiAgICAgICAgICAgICAgICBtb2RlcyA9IHNlbnNvci5tb2Rl cygpDQoNCiAgICAgICAgICAgICAgICBzZWxmLnZlcmlmeV9kYXRhLmNsZWFyKCkNCiAgICAgICAg ICAgICAgICBmb3IgbW9kZSBpbiBtb2RlczoNCiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYu dmVyaWZ5X2RhdGFbbW9kZV0gPSBbXQ0KICAgICAgICAgICAgICAgIHNlbGYuY3MucmVsZWFzZSgp DQoNCiAgICAgICAgICAgICAgICBzZWxmLmNzLmFjcXVpcmUoKQ0KICAgICAgICAgICAgICAgIHNl bGYudmVyaWZ5X21tID0gWzBdICMgYXdheXMgdmVyaWZ5IGF0IDAgbW0NCiAgICAgICAgICAgICAg ICBmb3IgcG9zIGluIHJhbmdlKDMpOg0KICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi52ZXJp ZnlfbW0uYXBwZW5kKHJhbmRvbS5yYW5kcmFuZ2Uoc2VsZi5tb3Rvci5ob21lX21tLCBzZWxmLm1v dG9yLmFsdF9tbSkpDQoNCiAgICAgICAgICAgICAgICBzZWxmLnZlcmlmeV9tbS5zb3J0KCkNCiAg ICAgICAgICAgICAgICBzZWxmLmNzLnJlbGVhc2UoKQ0KDQogICAgICAgICAgICAgICAgIyBBbHdh eXMgc3RhcnQgbWVhc3VyZW1lbnRzIGZyb20gaG9tZQogICAgICAgICAgICAgICAgc2VsZi5tb3Rv ci5ob21lKCkNCiAgICAgICAgICAgICAgICBzZWxmLm1vdG9yLndhaXQoKQ0KDQogICAgICAgICAg ICAgICAgZm9yIHhfbW0gaW4gc2VsZi52ZXJpZnlfbW06DQogICAgICAgICAgICAgICAgICAgICAg ICBzZWxmLm1vdG9yLmdvdG9fbW0oeF9tbSkNCiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYu bW90b3Iud2FpdCgpDQoNCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciBtb2RlIGluIG1vZGVz Og0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmNzLmFjcXVpcmUoKQ0KICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLnZlcmlmeV9kYXRhW21vZGVdLmFwcGVu ZChzZW5zb3IubWVhc3VyZShtb2RlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBz ZWxmLmNzLnJlbGVhc2UoKQoNCiAgICAgICAgICAgICAgICBzZWxmLmNzLmFjcXVpcmUoKQ0KICAg ICAgICAgICAgICAgIHNlbGYuc3RhdGUgPSA0DQogICAgICAgICAgICAgICAgc2VsZi5jcy5yZWxl YXNlKCkKDQogICAgICAgIGRlZiBodG1sX2FjdGlvbihzZWxmLCBhY3Rpb24sIHF1ZXJ5KToNCiAg ICAgICAgICAgICAgICBzZWxmLmNzLmFjcXVpcmUoKQ0KDQoNCiAgICAgICAgICAgICAgICBmb3Ig YXNzaWdubWVudCBpbiBxdWVyeS5zcGxpdCgnJicpOg0KICAgICAgICAgICAgICAgICAgICAgICAg KHZhciwgdmFsdWUpID0gYXNzaWdubWVudC5zcGxpdCgnPScpDQogICAgICAgICAgICAgICAgICAg ICAgICBpZiB2YXIgIT0gImFjdGlvbiI6DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IGV4ZWMgInNlbGYuc2V0XyIgKyB2YXIgKyAiKHZhbHVlKSINCg0KICAgICAgICAgICAgICAgIGlm IGFjdGlvbiA9PSAiQ0FMSUJSQVRFIjoNCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIHNlbGYu c3RhdGUgaW4gKDAsIDIsIDQpOg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFy dF9uZXdfdGhyZWFkKHNlbGYuY2FsaWJyYXRlX3RocmVhZCwoKSkNCiAgICAgICAgICAgICAgICBl bGlmIGFjdGlvbiA9PSAiVkVSSUZZIjoNCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIHNlbGYu c3RhdGUgaW4gKDAsIDIsIDQpOg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFy dF9uZXdfdGhyZWFkKHNlbGYudmVyaWZ5X3RocmVhZCwoKSkNCiAgICAgICAgICAgICAgICBlbGlm IGFjdGlvbiA9PSAiUkVGUkVTSCI6DQogICAgICAgICAgICAgICAgICAgICAgICBwYXNzDQogICAg ICAgICAgICAgICAgc2VsZi5jcy5yZWxlYXNlKCkNCg0KICAgICAgICBkZWYgaHRtbF9wYWdlKHNl bGYsIGYpOg0KICAgICAgICAgICAgICAgICMgc2VsZi5jcy5hY3F1aXJlKCkNCg0KICAgICAgICAg ICAgICAgIGlmIHNlbGYuc3RhdGUgaW4gKDEsMiwzKToNCiAgICAgICAgICAgICAgICAgICAgICAg IGYud3JpdGUoJzxtZXRhIEhUVFAtRVFVSVY9IlJFRlJFU0giIENPTlRFTlQ9IjE7Ij4nKQ0KDQog ICAgICAgICAgICAgICAgZi53cml0ZSgnPC9IRUFEPlxuJykNCiAgICAgICAgICAgICAgICAjIGZy b20gSEVBRCB0byBCT0RZDQogICAgICAgICAgICAgICAgZi53cml0ZSgnPEJPRFk+XG4nKQ0KICAg ICAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgIGYud3JpdGUoJzxIMT5DYWxpYnJhdGU8L0gx Pjxicj4nKQogICAgICAgICAgICAgICAgZi53cml0ZSgiPEgyPkN1cnJlbnRseSAiICsgc2VsZi5z dGF0ZV9oZWFkaW5nW3NlbGYuc3RhdGVdICsgIjwvSDI+IikNCg0KICAgICAgICAgICAgICAgICMg QWN0aW9ucw0KICAgICAgICAgICAgICAgIGYud3JpdGUoIjxmb3JtIGFjdGlvbj1DYWxpYnJhdGU+ IikgIyBUT0RPOiBtYWtlIGEgZm9ybSByZWNlcHRvciBwYWdlDQoNCiAgICAgICAgICAgICAgICBp ZiBzZWxmLnN0YXRlIG5vdCBpbiAoMSwyLDMpOg0KICAgICAgICAgICAgICAgICAgICAgICAgY2hl Y2tlZF90ZXh0ID0gKCIiLCAiQ0hFQ0tFRCIpDQogICAgICAgICAgICAgICAgICAgICAgICBmLndy aXRlKCc8SU5QVVQgVFlQRT1yYWRpbyBOQU1FPWF1dG8gVkFMVUU9ImN2ciIgJyArIGNoZWNrZWRf dGV4dFtzZWxmLmF1dG9dICsgJz5BdXRvIGNhbGlicmF0ZSBhbmQgdmVyaWZ5PEJSPicpDQogICAg ICAgICAgICAgICAgICAgICAgICBmLndyaXRlKCc8SU5QVVQgVFlQRT1yYWRpbyBOQU1FPWF1dG8g VkFMVUU9Im1hbnVhbCIgJyArIGNoZWNrZWRfdGV4dFsxIC0gc2VsZi5hdXRvXSArICc+TWFudWFs bHkgc2VsZWN0IGFjdGlvbiBhbmQgcmVmcmVzaDxCUj4nKQ0KICAgICAgICAgICAgICAgICAgICAg ICAgZi53cml0ZSgnPElOUFVUIFRZUEU9c3VibWl0IE5BTUU9YWN0aW9uIFZBTFVFPSJSRUZSRVNI Ij4nKQ0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgc2VsZi5zdGF0ZSBpbiAoMCwgMiwgNCk6 DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYud3JpdGUoIjxJTlBVVCBUWVBFPXN1 Ym1pdCBOQU1FPWFjdGlvbiBWQUxVRT1cIkNBTElCUkFURVwiPiIpDQoNCiAgICAgICAgICAgICAg ICAgICAgICAgIGlmIHNlbGYuc3RhdGUgaW4gKDAsIDIsIDQpOg0KICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBmLndyaXRlKCI8SU5QVVQgVFlQRT1zdWJtaXQgTkFNRT1hY3Rpb24gVkFM VUU9XCJWRVJJRllcIj4iKQ0KICAgICAgICAgICAgICAgIGYud3JpdGUoIjwvZm9ybT48aHI+IikN Cg0KICAgICAgICAgICAgICAgIHNlbnNvciA9IHNlbGYuc2Vuc29yDQogICAgICAgICAgICAgICAg bW9kZXMgPSBzZW5zb3IubW9kZXMoKQ0KDQogICAgICAgICAgICAgICAgIyBSZXN1bHRzDQogICAg ICAgICAgICAgICAgaWYgc2VsZi5zdGF0ZSBpbiAoMCwgMiwgNCk6DQogICAgICAgICAgICAgICAg ICAgICAgICBmLndyaXRlKCc8SDM+Q2FsaWIgcGFyYW1zPC9IMz4nKQ0KDQogICAgICAgICAgICAg ICAgICAgICAgICBmb3IgbW9kZSBpbiBtb2RlczoNCiAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgZi53cml0ZShzdHIobW9kZSkgKyAnOiAnICsgc3RyKHNlbnNvci5nZXRfY2FsaWJyYXRp b24obW9kZSkpICsgJzxicj4nKQ0KICAgICAgICAgICAgICAgICAgICAgICAgZi53cml0ZSgnPGhy PicpDQoNCiAgICAgICAgICAgICAgICBpZiBzZWxmLnN0YXRlID49IDI6DQogICAgICAgICAgICAg ICAgICAgICAgICBmLndyaXRlKCc8VEFCTEUgYm9yZGVyPSIxIjxDQVBUSU9OPjxFTT5TdGF0aXN0 aWNzPC9FTT48L0NBUFRJT04+JykNCiAgICAgICAgICAgICAgICAgICAgICAgIGYud3JpdGUoJzxU Uj48VEg+JykNCiAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVscyA9IHNlbGYuc3RhdGlzdGlj c1ttb2Rlc1swXV0ua2V5cygpDQogICAgICAgICAgICAgICAgICAgICAgICBsYWJlbHMuc29ydCgp DQogICAgICAgICAgICAgICAgICAgICAgICBzZWxmLndyaXRlX2xpc3QoZiwgJzxUSD4nLCBsYWJl bHMpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciBtb2RlIGluIG1vZGVzOg0KICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBmLndyaXRlKCc8VFI+PFRIPicgKyBzdHIobW9kZSkpDQog ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpY3QgPSBzZWxmLnN0YXRpc3RpY3NbbW9k ZV0NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzID0gbWFwKChsYW1iZGEg bGFiZWwsIEQ9ZGljdDogRFtsYWJlbF0pLCBsYWJlbHMpCiAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgc2VsZi53cml0ZV9saXN0KGYsICc8VEQ+JywgdmFsdWVzKQ0KICAgICAgICAgICAg ICAgICAgICAgICAgZi53cml0ZSgnPC9UQUJMRT4nKQ0KDQogICAgICAgICAgICAgICAgaWYgc2Vs Zi5zdGF0ZSA+PSAxOg0KICAgICAgICAgICAgICAgICAgICAgICAgZi53cml0ZSgnPFRBQkxFIGJv cmRlcj0iMSI8Q0FQVElPTj48RU0+UmF3IGRhdGE8L0VNPjwvQ0FQVElPTj4nKQ0KICAgICAgICAg ICAgICAgICAgICAgICAgZi53cml0ZSgnPFRSPjxUSD5tbScpCiAgICAgICAgICAgICAgICAgICAg ICAgIHNlbGYud3JpdGVfbGlzdChmLCAnPFRIPicsIHNlbGYuY2FsaWJyYXRlX3JhbmdlX21tKCkp CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciBtb2RlIGluIG1vZGVzOgogICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIGYud3JpdGUoJzxUUj48VEg+JyArIHN0cihtb2RlKSkKICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLndyaXRlX2xpc3QoZiwgJzxURD4nLCBzZWxm LnJhd19kYXRhW21vZGVdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg KGxhbWJkYSBzdWI6IHN0cmluZy5qb2luKG1hcChzdHIsIHN1YiksJyw8YnI+JykpKQogICAgICAg ICAgICAgICAgICAgICAgICBmLndyaXRlKCc8L1RBQkxFPicpCgogICAgICAgICAgICAgICAgaWYg c2VsZi5zdGF0ZSA+PSAzOgogICAgICAgICAgICAgICAgICAgICAgICBmLndyaXRlKCc8VEFCTEUg Ym9yZGVyPSIxIjxDQVBUSU9OPjxFTT5WZXJpZnkgZGF0YTwvRU0+PC9DQVBUSU9OPicpCiAgICAg ICAgICAgICAgICAgICAgICAgIGYud3JpdGUoJzxUUj48VEg+bW0nKQogICAgICAgICAgICAgICAg ICAgICAgICBzZWxmLndyaXRlX2xpc3QoZiwgJzxUSD4nLCBzZWxmLnZlcmlmeV9tbSkKICAgICAg ICAgICAgICAgICAgICAgICAgZm9yIG1vZGUgaW4gbW9kZXM6CiAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgZi53cml0ZSgnPFRSPjxUSD4nICsgc3RyKG1vZGUpKQogICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIHNlbGYud3JpdGVfbGlzdChmLCAnPFREPicsIHNlbGYudmVyaWZ5 X2RhdGFbbW9kZV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobGFt YmRhIHN1Yjogc3RyaW5nLmpvaW4obWFwKHN0ciwgc3ViKSwnLDxicj4nKSkpCgogICAgICAgICAg ICAgICAgIyBzZWxmLmNzLnJlbGVhc2UoKQoKICAgICAgICBkZWYgd3JpdGVfbGlzdChzZWxmLCBm LCBkZWxpbWl0ZXIsIGl0ZW1fbGlzdCwgaXRlbV9mb3JtYXRlcj1zdHIpOgogICAgICAgICAgICAg ICAgZm9yIGl0ZW0gaW4gaXRlbV9saXN0OgogICAgICAgICAgICAgICAgICAgICAgICBmLndyaXRl KGRlbGltaXRlcikKICAgICAgICAgICAgICAgICAgICAgICAgZi53cml0ZShpdGVtX2Zvcm1hdGVy KGl0ZW0pKQoKICAgICAgICAjIGV2YWwgbWV0aG9kcwogICAgICAgIGRlZiBzZXRfYXV0byhzZWxm LCBtb2RlKToKICAgICAgICAgICAgICAgIGlmIG1vZGU9PSJjdnIiOgogICAgICAgICAgICAgICAg ICAgICAgICBzZWxmLmF1dG8gPSAxCiAgICAgICAgICAgICAgICBlbGlmIG1vZGUgPT0gIm1hbnVh bCI6CiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYuYXV0byA9IDAKICAgICAgICAgICAgICAg IGVsc2U6CiAgICAgICAgICAgICAgICAgICAgICAgIHByaW50ICJXYXJuaW5nOiBVbmV4cGVjdGVk IGF1dG9tb2RlOiIsIG1vZGUKICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5hdXRvID0gMAoK aW1wb3J0IHN5cyAjIHVzZWQgaW4gZGVidWcgY29kZQpkZWYgd3JpdGVfb2N0YXZlX2RhdGEodG8s IHhzX21tLCByYXdfZGF0YSk6CiAgICAgICAgIyBUT0RPIHJlbW92ZQogICAgICAgIGlmIHJhbmRv bS5yYW5kcmFuZ2UoMik6ICMgMCBvciAxCiAgICAgICAgICAgICAgICB0by53cml0ZSgieHljYWxp Yl9wYV9wcm90b3R5cDNcbiIpCiAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgIHRvLndyaXRl KCJ4eWNhbGliX3BhX3Byb3RvdHlwNFxuIikKICAgICAgICB0by5mbHVzaCgpCiAgICAgICAgdG8g PSBzeXMuc3Rkb3V0CgogICAgICAgIHRvLndyaXRlKCJjYWwgPSBbXG4iKQogICAgICAgIGZvciBp eCBpbiByYW5nZShsZW4oeHNfbW0pKToKICAgICAgICAgICAgICAgIHhfbW0gPSB4c19tbVtpeF0K ICAgICAgICAgICAgICAgIG1lYXN1cmVkID0gcmF3X2RhdGFbaXhdCiAgICAgICAgICAgICAgICB5 X3BpbnMgPSB5X3JhbmdlKCBtYXAoKGxhbWJkYSAoeCx5LHcpOiB3KSwgbWVhc3VyZWQpICkgIyBv YmplY3QgYXQgeV9tbSA9IDAgaXMgd2lkZXIuCiAgICAgICAgICAgICAgICB5c19tbSA9IG1hcCgo bGFtYmRhIHk6IDIwKnkpLCB5X3BpbnMpCiAgICAgICAgICAgICAgICBmb3IgaXkgaW4gcmFuZ2Uo bGVuKHlzX21tKSk6CiAgICAgICAgICAgICAgICAgICAgICAgIG0gPSBtZWFzdXJlZFtpeV0KICAg ICAgICAgICAgICAgICAgICAgICAgeV9tbSA9IHlzX21tW2l5XQogICAgICAgICAgICAgICAgICAg ICAgICB0by53cml0ZSgiJWQgJWQgJWQgJWQgJWQ7XG4iICUgKG1bMF0sIG1bMV0sIG1bMl0sIHhf bW0sIHlfbW0pKQogICAgICAgIHRvLndyaXRlKCJdO1xuIikKICAgICAgICB0by5mbHVzaCgpCiAg ICAgICAgcmV0dXJuCgpkZWYgcmVhZF9vY3RhdmVfZGF0YShyZCwgbGFiZWwsIHJleHAsIGxpbmVz KToKICAgICAgICByZXQgPSBbXQogICAgICAgIHJlYWQgPSByZC5yZWFkbGluZSgpCiAgICAgICAg d2hpbGUgcmVhZC5maW5kKGxhYmVsKSA9PSAtMToKICAgICAgICAgICAgICAgIHJlYWQgPSByZC5y ZWFkbGluZSgpDQogICAgICAgIGZvciBpeCBpbiByYW5nZShsaW5lcyk6DQogICAgICAgICAgICAg ICAgcmVhZCA9IHJkLnJlYWRsaW5lKCkNCiAgICAgICAgICAgICAgICBwcmludCAnPCcsIHJlYWQs ICc+Jw0KICAgICAgICAgICAgICAgIG1hdGNoID0gcmV4cC5zZWFyY2gocmVhZCkNCiAgICAgICAg ICAgICAgICBhc3NlcnQgbWF0Y2gsICJFeHBlY3RlZCBudW1iZXIgbm90IGZvdW5kIGluICciICsg c3RyKHJlYWQpICsiJyINCiAgICAgICAgICAgICAgICByZXQuYXBwZW5kKGZsb2F0KG1hdGNoLmdy b3VwKDApKSkNCg0KICAgICAgICByZXR1cm4gcmV0DQoNCg0KZGVmIHlfcmFuZ2UobHMpOg0KICAg ICAgICAocmQsIHJsKSA9IHlfcmFuZ2VfKGxzWzBdLCAxLCBsc1sxOl0pDQogICAgICAgIHJldHVy biBbcmRdICsgcmwNCg0KZGVmIHlfcmFuZ2VfKG1heCwgbWF4ZCwgbHMpOg0KICAgICAgICBpZiBs cyA9PSBbXToNCiAgICAgICAgICAgICAgICByZXR1cm4gKG1heGQtMSwgW10pDQogICAgICAgIGVs c2U6DQogICAgICAgICAgICAgICAgaWYgbHNbMF0gPiBtYXg6DQogICAgICAgICAgICAgICAgICAg ICAgICAocmQsIHJsKSA9IHlfcmFuZ2VfKGxzWzBdLCAxLCBsc1sxOl0pDQogICAgICAgICAgICAg ICAgZWxzZToNCiAgICAgICAgICAgICAgICAgICAgICAgIChyZCwgcmwpID0geV9yYW5nZV8obWF4 LCBtYXhkKzEsIGxzWzE6XSkNCiAgICAgICAgICAgICAgICByZXR1cm4gKHJkLTEsIFtyZF0gKyBy bCkNCg==

--------------Boundary-00=_XGJYP8HPVLS451YJDR9Q-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/