c - Query regarding main() of GRUB -
below code of main() of grub. here want know line:
file = fopen(arg_v[1], "rb");
here file fopen opening? file arg v[1] pointing to?
int main(unsigned arg_c, char *arg_v[]) { file *file; if(arg_c < 2) { printf("checks if file multiboot compatible\n"); return 1; } file = fopen(arg_v[1], "rb"); if(file == null) { printf("can't open file '%s'\n", arg_v[1]); return 2; } check_multiboot(arg_v[1], file); fclose(file); return 0; }
if call program with
program arg1 arg2.txt 65
argv[1] pointer "arg1"; argv[2] pointer "arg2.txt", argv[3] pointer "65", argv[4] null
argv[0] either points "program" or "" if os and/or library and/or startup code cannot identify name used call binary executable
in specific case, program tries open file, name provided in first argument program, in read binary mode.
Comments
Post a Comment