version 1.11, 1999/05/10 16:14:07 |
version 1.12, 2001/05/31 16:26:59 |
|
|
int process_file __P((int, char *)); |
int process_file __P((int, char *)); |
int show_archive __P((int, char *, FILE *)); |
int show_archive __P((int, char *, FILE *)); |
int show_objfile __P((int, char *, FILE *)); |
int show_objfile __P((int, char *, FILE *)); |
int show_object __P((int, char *, FILE *)); |
|
void *emalloc __P((size_t)); |
|
void *erealloc __P((void *, size_t)); |
|
void usage __P((void)); |
void usage __P((void)); |
|
|
int |
int |
|
|
|
|
baselen = strlen(fname) + 3; |
baselen = strlen(fname) + 3; |
namelen = sizeof(ar_head.ar_name); |
namelen = sizeof(ar_head.ar_name); |
name = emalloc(baselen + namelen); |
if ((name = malloc(baselen + namelen)) == NULL) |
|
err(1, NULL); |
|
|
rval = 0; |
rval = 0; |
|
|
|
|
int len = atoi(&ar_head.ar_name[3]); |
int len = atoi(&ar_head.ar_name[3]); |
if (len > namelen) { |
if (len > namelen) { |
p -= (long)name; |
p -= (long)name; |
name = (char *)erealloc(name, baselen+len); |
if ((name = realloc(name, baselen+len)) == NULL) |
|
err(1, NULL); |
namelen = len; |
namelen = len; |
p += (long)name; |
p += (long)name; |
} |
} |
if (fread(p, len, 1, fp) != 1) { |
if (fread(p, len, 1, fp) != 1) { |
(void)fprintf(stderr, |
warnx("%s: premature EOF", name); |
"nm: %s: premature EOF.\n", name); |
|
(void)free(name); |
(void)free(name); |
return 1; |
return(1); |
} |
} |
p += len; |
p += len; |
} else |
} else |
|
|
|
|
(void)printf("\n"); |
(void)printf("\n"); |
return (0); |
return (0); |
} |
|
|
|
void * |
|
emalloc(size) |
|
size_t size; |
|
{ |
|
char *p; |
|
|
|
/* NOSTRICT */ |
|
if ((p = malloc(size))) |
|
return(p); |
|
err(1, NULL); |
|
} |
|
|
|
void * |
|
erealloc(p, size) |
|
void *p; |
|
size_t size; |
|
{ |
|
/* NOSTRICT */ |
|
if ((p = realloc(p, size))) |
|
return(p); |
|
err(1, NULL); |
|
} |
} |
|
|
void |
void |