more x86_64 work. started to put the mmu bits together in the (former) stage2 loader.
[newos.git] / apps / shell / args.c
blob82e47e238d24b9727821c90af689395a221bea50
1 //#include <types.h>
2 #include <string.h>
3 #include <ctype.h>
4 #include <stdio.h>
6 #include "args.h"
7 #include "shell_defs.h"
8 #include "shell_vars.h"
10 bool af_exit_after_script;
11 char *af_script_file_name;
14 static void handle_option(char *option){
16 switch(option[1]){
17 case 's':// setup script
18 if(option[2] == 0){
19 af_exit_after_script = false;
21 return;
24 printf("unknown option : %s\n",option);
27 void init_arguments(int argc,char **argv){
29 int cnt = 1;
30 int shell_argc = 0;
31 char name[255];
33 af_exit_after_script = true;
34 af_script_file_name = NULL;
36 while((cnt < argc) && (argv[cnt][0] == '-')){
37 handle_option(argv[cnt]);
38 cnt++;
41 if(cnt < argc){
43 af_script_file_name = argv[cnt];
44 cnt++;
46 while(cnt < argc){
48 sprintf(name,NAME_PAR_PRFX,cnt-1);
49 shell_var_set_text(name,argv[cnt]);
50 shell_argc++;
51 cnt++;
54 shell_var_set_number(NAME_VAR_ARGC,shell_argc);