eHag-FRU / Group1-SeccuredProgramming

0 stars 0 forks source link

LogAppend - Batch file execution #6

Open eHag-FRU opened 1 day ago

eHag-FRU commented 1 day ago

Documentation:

-B file Specifies a batch file of commands. file contains one or more command lines, not including the logappend command itself (just its options), separated by \n (newlines). These commands should be processed by logappend individually, in order. This allows logappend to add data to the file without forking or re-invoking. Of course, option -B cannot itself appear in one of these command lines. Commands specified in a batch file include the log name. If a single line in a batch file is invalid, print the appropriate error message for that line and continue processing the rest of the batch file

eHag-FRU commented 1 day ago

The bool commandExecuter(int argc, char* argv[], map<string, string>& sanatizedResult) function has been made that executes one command. True if successful, false if not!

Need to open file, grab each line, tokenize it with strtok (https://cplusplus.com/reference/cstring/strtok/) based on the space delimiter. Then count how many and pass that in with the blank result map to the command executor function.

Do this as many times as lines in batch file. Exit and close file stream when done or invalid result is made.