/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <dlfcn.h>
#include <errno.h>
#include <fnmatch.h>
#include <apptrace.h>
#include <libintl.h>
#include "abienv.h"
static void
{
call);
}
void
{
char *envstr;
char *tok;
return;
}
}
void
{
char *envstr;
char *tok;
return;
/*
* It is possible that we have a single file name,
* in which case the subseqent loop will do nothing
*/
return;
}
}
}
void
{
char *envstr;
char *tok;
return;
}
}
void
{
void *handle;
if (fatal) {
"apptrace: %s: %s\n"),
name,
}
return;
}
if (fatal) {
"apptrace: dlopen on %s failed: %s\n"),
name,
dlerror());
}
return;
}
/* OK, so now add it to the end of the list */
if (*listend)
}
/*
* Called abibasename() to avoid clash with basename(3C)
* Incidentally, basename(3C) is destructive which is why
* we are not using it instead.
*/
char *
{
char *p;
return (p + 1);
else
return ((char *)str);
}
Liblist *
{
return (NULL);
*p2 = '\0';
/* Lose the dirname */
/* Lose the suffix */
*p1 = '\0';
break;
}
}
return (ret);
}
int
{
return (0);
return (1);
}
return (0);
}
char *
{
char *envstr;
return (NULL);
while (*envstr == ' ')
envstr++;
if (*envstr == '\0')
return (NULL);
return (envstr);
}
int
{
char *p, *t, *f;
#if defined(_LP64)
char *m;
#endif
int ret;
/* Duplicate the path */
/* Find the last slash, if there ain't one bug out */
ret = 0;
goto done;
}
/*
* Wack the slash to a null byte.
* Thus if we got:
* p now points to /A/B/C
* f is set to point to D.so.1
*/
*t = '\0';
f = ++t;
#if defined(_LP64)
/*
* As above except that in LP64 (for sparc) we'll get:
* thus p now points to:
* so we repeat the wack so that we get:
* /A/B/C
* and retain a pointer, m, to the machine dependent portion.
*/
ret = 0;
goto done;
}
*t = '\0';
m = ++t;
/*
* Now we can build a path name.
* This path is only a guess that'll be checked later in appendlist().
* Some system libraries, like libc.so.1, reside in /lib while their
* true for libraries like libc_psr.so.1 that reside in /platform
* the file in the direct path name we generate exists, and if not,
* we prepend "/usr" to it. This handles all existing cases.
*/
#else
#endif
done:
free(p);
return (ret);
}