Bset » History » Version 9
Per Amundsen, 07/27/2022 02:23 AM
| 1 | 1 | Per Amundsen | _Added in 1.9.0_ |
|---|---|---|---|
| 2 | |||
| 3 | 9 | Per Amundsen | */bset [-tacz] <&binvar> <N> <asciivalue> [asciivalue ... asciivalue]* |
| 4 | 1 | Per Amundsen | |
| 5 | Sets the <N>th byte in binary variable &binvar to the specified ascii value. |
||
| 6 | |||
| 7 | 5 | Per Amundsen | _If N = -1, the data is added to the end of the variable._ |
| 8 | |||
| 9 | 1 | Per Amundsen | If the &binvar docent exists it is created. |
| 10 | If <N> is larger than the size of &binvar it will be zero filled up to <N> bytes. |
||
| 11 | 2 | Per Amundsen | If you specify multiple "ASCII":http://www.asciitable.com/ values, they are copied to successive positions after byte position N. |
| 12 | 1 | Per Amundsen | |
| 13 | *Switches* |
||
| 14 | |||
| 15 | -t - Treat values a plain text. |
||
| 16 | 7 | Per Amundsen | -a - Disables UTF-8 encoding of characters in the range 0-255, as long as the text contains no characters > 255. |
| 17 | 1 | Per Amundsen | -c - Chops the &binvar at the end of the copied bytes. |
| 18 | 9 | Per Amundsen | -z - TODO |
| 19 | 1 | Per Amundsen | |
| 20 | *Parameters* |
||
| 21 | |||
| 22 | <&binvar> - The &binvar to modify. |
||
| 23 | 8 | Per Amundsen | <N> - The byte to modify. (one based) |
| 24 | 2 | Per Amundsen | <asciivalue> - The "ASCII":http://www.asciitable.com/ value to insert. |
| 25 | 1 | Per Amundsen | |
| 26 | *Example* |
||
| 27 | |||
| 28 | <pre> |
||
| 29 | alias example { |
||
| 30 | 2 | Per Amundsen | ; Create a binary variable set it to "This is fun!" |
| 31 | 1 | Per Amundsen | bset -t &Example 1 This is fun! |
| 32 | |||
| 33 | 2 | Per Amundsen | ; Print out the content of the variable |
| 34 | 1 | Per Amundsen | echo -a $bvar(&Example, 1-).text |
| 35 | } |
||
| 36 | </pre> |