| 1 |
## our_shell:ysh
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
proc raw-line {
|
| 6 |
read --raw-line (&s)
|
| 7 |
echo len=${#s}
|
| 8 |
write --end '' $s | od -A n -t x1
|
| 9 |
}
|
| 10 |
|
| 11 |
proc all {
|
| 12 |
read --all (&s)
|
| 13 |
echo len=${#s}
|
| 14 |
write --end '' $s | od -A n -t x1
|
| 15 |
}
|
| 16 |
|
| 17 |
proc num-bytes {
|
| 18 |
read --num-bytes 3 (&s)
|
| 19 |
echo len=${#s}
|
| 20 |
write --end '' $s | od -A n -t x1
|
| 21 |
}
|
| 22 |
|
| 23 |
printf '.\000.' | raw-line
|
| 24 |
printf '.\000.' | all
|
| 25 |
printf '.\000.' | num-bytes
|
| 26 |
|
| 27 |
## STDOUT:
|
| 28 |
len=3
|
| 29 |
2e 00 2e
|
| 30 |
len=3
|
| 31 |
2e 00 2e
|
| 32 |
len=3
|
| 33 |
2e 00 2e
|
| 34 |
## END
|
| 35 |
|