diff options
author | Andy Dougherty <doughera@lafayette.edu> | 1998-04-14 09:04:58 -0400 |
---|---|---|
committer | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1998-05-14 15:09:51 +0000 |
commit | c4f23d77f4b3486a36335c4460cbfd4e81e37892 (patch) | |
tree | c0a1326984d277a8c25f70e7f81765e8a96dcf11 /beos/nm.c | |
parent | 13c745c007f7ab4c05f0dd76e12e5a70c8c0e95b (diff) | |
download | perl-c4f23d77f4b3486a36335c4460cbfd4e81e37892.tar.gz |
[PATCH for 5.004_64] Configure patch Config_64-01
Date: Tue, 14 Apr 1998 13:04:58 -0400 (EDT)
Subject: [PATCH for 5.004_64] Configure patch Config_64-01-02.diff
Date: Fri, 17 Apr 1998 11:01:13 -0400 (EDT)
Subject: [PATCH for 5.004_64] Configure patch Config_64-02-03.diff
Date: Thu, 23 Apr 1998 15:03:20 -0400 (EDT)
Subject: [PATCH 5.004_64] Config_64-03-04.diff
Date: Wed, 13 May 1998 14:33:30 -0400 (EDT)
p4raw-id: //depot/perl@948
Diffstat (limited to 'beos/nm.c')
-rw-r--r-- | beos/nm.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/beos/nm.c b/beos/nm.c new file mode 100644 index 0000000000..4f53f743b2 --- /dev/null +++ b/beos/nm.c @@ -0,0 +1,53 @@ +/* nm.c - a feeble shared-lib library parser + * Copyright 1997, 1998 Tom Spindler + * This software is covered under perl's Artistic license. + */ + +/* $Id: nm.c,v 1.1 1998/02/16 03:51:26 dogcow Exp $ */ + +#include <be/kernel/image.h> +#include <malloc.h> +#include <string.h> +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> + +main(int argc, char **argv) { +char *path, *symname; +image_id img; +int32 n = 0; +volatile int32 symnamelen, symtype; +void *symloc; + +if (argc != 2) { printf("more args, bozo\n"); exit(1); } + +path = (void *) malloc((size_t) 2048); +symname = (void *) malloc((size_t) 2048); + +if (!getcwd(path, 2048)) { printf("aiee!\n"); exit(1); } +if (!strcat(path, "/")) {printf("naah.\n"); exit (1); } +/*printf("%s\n",path);*/ + +if ('/' != argv[1][0]) { + if (!strcat(path, argv[1])) { printf("feh1\n"); exit(1); } +} else { + if (!strcpy(path, argv[1])) { printf("gah!\n"); exit(1); } +} +/*printf("%s\n",path);*/ + +img = load_add_on(path); +if (B_ERROR == img) {printf("Couldn't load_add_on() %s.\n", path); exit(2); } + +symnamelen=2047; + +while (B_BAD_INDEX != get_nth_image_symbol(img, n++, symname, &symnamelen, + &symtype, &symloc)) { + printf("%s |%s |GLOB %Lx | \n", symname, + ((B_SYMBOL_TYPE_ANY == symtype) || (B_SYMBOL_TYPE_TEXT == symtype)) ? "FUNC" : "VAR ", symloc); + symnamelen=2047; +} +printf("number of symbols: %d\n", n); +if (B_ERROR == unload_add_on(img)) {printf("err while closing.\n"); exit(3); } +free(path); +return(0); +} |