1 /* $NetBSD: buwrapper.c,v 1.1 1999/01/04 22:37:30 tv Exp $ */
10 * Wrapper for binutils programs.
12 * This frontend sets the appropriate environment variables that tell
13 * binutils programs which target will be used.
16 static const char binsubdir
[] = "libexec/binutils";
18 #define PATHLEN sizeof(PREFIX) + sizeof(binsubdir) + 20
20 int main(int argc
, char **argv
) {
21 char path
[PATHLEN
], *p
, *prog
;
23 /* quickly find last part of path component */
24 if (p
= strrchr(argv
[0], '/'))
28 if (prog
= strrchr(p
, '-'))
33 /* make program pathname */
34 snprintf(path
, PATHLEN
, "%s/%s/%s", PREFIX
, binsubdir
, prog
);
36 /* set up environment */
37 setenv("GNUTARGET", GNUTARGET
, 0);
39 setenv("LDEMULATION", LDEMULATION
, 0);
42 setenv("LD_RPATH_LINK", LD_RPATH_LINK
, 1);
48 /* we shouldn't get here. */
49 err(EX_OSERR
, "(buwrapper): exec %s", path
);