flat assembler
Message board for the users of flat assembler.
Index
> Main > Define symbolic variable on the command line |
Author |
|
revolution 06 Jul 2016, 01:28
When using the command line the spaces need to be "escaped" with a backslash (\)
Code: fasm -d DATE='2016\ 01\ 01' ... ;DATE = '2016 01 01' including the quotes |
|||
06 Jul 2016, 01:28 |
|
HaHaAnonymous 06 Jul 2016, 05:25
It did not work.
This works: "fasm -d DATE="'201601'" /tmp/test.asm" This doesn't: "fasm -d DATE="'2016\ 01'" /tmp/test.asm" Thank you! |
|||
06 Jul 2016, 05:25 |
|
revolution 06 Jul 2016, 05:31
What version of fasm are you using?
Code: C:\Documents and settings\WeAreTheBorg\Our Documents>type test.asm format binary db DATE C:\Documents and settings\WeAreTheBorg\Our Documents>fasm -d DATE="'2016\ 01'" test.asm flat assembler version 1.71.54 (3145344 kilobytes memory) 1 passes, 9 bytes. C:\Documents and settings\WeAreTheBorg\Our Documents>type test.bin '2016 01' |
|||
06 Jul 2016, 05:31 |
|
HaHaAnonymous 06 Jul 2016, 16:14
I'm using "flat assembler version 1.71.54", Linux version (no libc)
In my command the "" has no effect, because of bash. The actual command fasm receives is: Code: fasm -d DATE='2016\ 01' /tmp/test.asm |
|||
06 Jul 2016, 16:14 |
|
HaHaAnonymous 06 Jul 2016, 18:40
If anyone is interested, I could make it work with this:
Code: fasm -d DATE=$(date +'%Y/%m/%d - %H:%M:%S %Z' | hexdump -v -e '/1 "0x%02X,"' | head --bytes -1) /tmp/test.asm It defines the symbol as an array of bytes: Code: fasm -d DATE=0x32,0x30,0x31,0x36,0x2F,0x30,0x37,0x2F,0x30,0x36,0x20,0x2D,0x20,0x31,0x35,0x3A,0x33,0x36,0x3A,0x34,0x30,0x20,0x42,0x52,0x54,0x0A /tmp/test.asm Then, if that was not a bug you can consider this as solved. Thank you! |
|||
06 Jul 2016, 18:40 |
|
Furs 13 Jul 2016, 17:22
Looks like a bug in Fasm to me. Same thing happens on Windows version if you double quote the entire DATE= argument. In effect, Fasm looks for "next" argument on purpose when a space is encountered.
i.e: fasm -d "DATE='2016\ 01\ 01'" fails. Without the double quotes, the above would actually be the following arguments: Code: fasm -d DATE='2016\ 01\ 01' Won't work in bash/unux since it's different when treating arguments. Maybe you could use "eval" but probably not. I use Linux too but Fasm with Wine so still windows syntax. (so I only have one Fasm useable from both Linux and Windows, and VMs, plus I'm more familiar with it and the IDE works fine too) |
|||
13 Jul 2016, 17:22 |
|
revolution 14 Jul 2016, 00:39
Furs: fasm.exe does not use the quotes as special characters in the definition of the variable. All those single and double quotes are passed directly to the code unaltered. The space is always a delimiter unless it is escaped.
However it appears as though in Linux sh, bash, or whatever is the shell processor, will alter what the user types into the command line and try to be smart by expanding some things. So in Linux you have to comply with the shell requirements before fasm will see the command line. |
|||
14 Jul 2016, 00:39 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.