Skip to content
Snippets Groups Projects
Commit ff7e7e3f authored by ja3-saxby's avatar ja3-saxby
Browse files

Add skeleton code unit for argument parsing

parent bc730d56
No related branches found
No related tags found
No related merge requests found
...@@ -55,6 +55,7 @@ lib/kernel_SRC += lib/kernel/console.c # printf(), putchar(). ...@@ -55,6 +55,7 @@ lib/kernel_SRC += lib/kernel/console.c # printf(), putchar().
# User process code. # User process code.
userprog_SRC = userprog/process.c # Process loading. userprog_SRC = userprog/process.c # Process loading.
userprog_SRC += userprog/parse_arguments.c # Parses arguments from command line string.
userprog_SRC += userprog/populate_stack.c # Populates stack with program arguments. userprog_SRC += userprog/populate_stack.c # Populates stack with program arguments.
userprog_SRC += userprog/pagedir.c # Page directories. userprog_SRC += userprog/pagedir.c # Page directories.
userprog_SRC += userprog/exception.c # User exception handler. userprog_SRC += userprog/exception.c # User exception handler.
......
#ifndef USERPROG_ARGUMENT_PARSING_H #ifndef USERPROG_ARGUMENT_PARSING_H
#define USERPROG_ARGUMENT_PARSING_H #define USERPROG_ARGUMENT_PARSING_H
/*
* Given a string containing the command invoking the program `command_line`
* and a pointer to an array of C strings (pointer to `char* argv[]`), parse
* `command_line` into individual arguments, populate `argv` with these and
* return the number of arguments that were parsed (this is the value that can
* be used for `argc`).
*/
int parse_arguments(const char* command_line, char***argv);
/* /*
* Given stack pointer `esp`, argument count `argc` and arguments array `argv`, * Given stack pointer `esp`, argument count `argc` and arguments array `argv`,
* Populates the stack pointed to by the stack pointer with the given arguments. * Populates the stack pointed to by the stack pointer with the given arguments.
......
#include "userprog/argument_parsing.h"
int parse_arguments(const char* command_line, char***argv) {
#warning "Implement me"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment