-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0-hreadelf.c
More file actions
42 lines (35 loc) · 702 Bytes
/
Copy path0-hreadelf.c
File metadata and controls
42 lines (35 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "holberton.h"
/* fprintf */
#include <stdio.h>
/**
* main - entry point to 0-hreadelf
*
* @argc: command line arg count
* @argv: command line arg array
* Return: 1 on failure, 0 on success
*/
int main(int argc, char **argv)
{
re_state state;
int retval = 0;
if (argc != 2)
{
fprintf(stderr, "Usage: %s <filename>\n", argv[0]);
return (1);
}
initState(&state);
state.exec_name = argv[0];
state.f_name = argv[1];
retval = openELF(&state);
if (retval == 0)
{
retval = getFileHeader(&state);
if (retval == 0)
retval = printFileHeader(&state);
else
errorMsg("%s: Failed to read file header\n",
NULL, &state);
}
closeState(&state);
return (retval);
}