summaryrefslogtreecommitdiffstats
path: root/src/tape.c
diff options
context:
space:
mode:
authorAnton L. Šijanec <anton@sijanec.eu>2020-05-02 00:57:31 +0200
committerAnton L. Šijanec <anton@sijanec.eu>2020-05-02 00:57:31 +0200
commit270af17cf7848d41033a92feecb1c4c1f695c956 (patch)
tree3569d1b8403d3a23b60c3d90c89d9fc8f4b79a8c /src/tape.c
parentit's not working, DO NOT USE!, fix in next commit (diff)
downloadbverbose-270af17cf7848d41033a92feecb1c4c1f695c956.tar
bverbose-270af17cf7848d41033a92feecb1c4c1f695c956.tar.gz
bverbose-270af17cf7848d41033a92feecb1c4c1f695c956.tar.bz2
bverbose-270af17cf7848d41033a92feecb1c4c1f695c956.tar.lz
bverbose-270af17cf7848d41033a92feecb1c4c1f695c956.tar.xz
bverbose-270af17cf7848d41033a92feecb1c4c1f695c956.tar.zst
bverbose-270af17cf7848d41033a92feecb1c4c1f695c956.zip
Diffstat (limited to 'src/tape.c')
-rw-r--r--src/tape.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/tape.c b/src/tape.c
index 42d736d..f207e8f 100644
--- a/src/tape.c
+++ b/src/tape.c
@@ -64,13 +64,13 @@ int bvr_inline_command_processor(FILE * page_source_file, FILE * temp_output_fil
}
if(copy_buffer[(ftell(page_source_file)-1)% COPY_BUFFER_SIZE] == CLOSING_COMMAND_TAG_CHAR_1 &&
copy_buffer[ftell(page_source_file)% COPY_BUFFER_SIZE] == CLOSING_COMMAND_TAG_CHAR_2) { // end of arguments!
- /// char argument_string[argument_length+1];
- /// strncpy(argument_string, copy_buffer+(ftell(page_source_file)-(argument_length-1))% COPY_BUFFER_SIZE, argument_length);
- copy_buffer[(ftell(page_source_file)-1)% COPY_BUFFER_SIZE] = '\0';
- /// argument_string[argument_length-2] = '\0';
- printf("end of command, command was %c, argument was %s\n", copy_buffer[(ftell(page_source_file)-(1+argument_length))% COPY_BUFFER_SIZE],
- /// argument_string);
- copy_buffer+(ftell(page_source_file)-(argument_length-1))% COPY_BUFFER_SIZE);
+ char argument_string[argument_length+1];
+ for(int i=0; i<argument_length; i++) {
+ argument_string[i] = copy_buffer[0+(ftell(page_source_file)-(argument_length-(1+i)))% COPY_BUFFER_SIZE];
+ }
+ argument_string[argument_length-2] = '\0'; // -2, ker imamo še CLOSING_COMMAND_TAG_CHAR_1 in CLOSING_COMMAND_TAG_CHAR_2
+ printf("end of command, command was %c, argument was \"%s\"\n", copy_buffer[(ftell(page_source_file)-(1+argument_length))% COPY_BUFFER_SIZE],
+ argument_string);
// switch (copy_buffer[(ftell(page_source_file)-(1+argument_length))]) { // switch command
//
// }