Project

General

Profile

Bset » History » Version 8

Per Amundsen, 02/06/2019 08:28 PM

1 1 Per Amundsen
_Added in 1.9.0_
2
3 6 Per Amundsen
*/bset [-tac] <&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 6 Per Amundsen
-c - Chops the &binvar at the end of the copied bytes.
18 1 Per Amundsen
19
*Parameters*
20
21
<&binvar> - The &binvar to modify.
22 8 Per Amundsen
<N> - The byte to modify. (one based)
23 2 Per Amundsen
<asciivalue> - The "ASCII":http://www.asciitable.com/ value to insert.
24 1 Per Amundsen
25
*Example*
26
27
<pre>
28
alias example {
29 2 Per Amundsen
  ; Create a binary variable set it to "This is fun!"
30 1 Per Amundsen
  bset -t &Example 1 This is fun!
31
 
32 2 Per Amundsen
  ; Print out the content of the variable
33 1 Per Amundsen
  echo -a $bvar(&Example, 1-).text
34
}
35
</pre>