/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1992-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* dll scan interface
*/
static const char usage[] =
"[-?\n@(#)$Id: dlls (AT&T Research) 2011-04-22 $\n]"
"[+NAME?dlls - list dlls and shared libraries on $PATH]"
"[+DESCRIPTION?\bdlls\b lists the base name and full path, one per line, "
"of \adlls\a and \ashared libraries\a found in the directories or "
"sibling directories in the \bPATH\b environment variable. The "
"\aplugin\a operand matches plugin libraries for the particular "
"\aplugin\a. If omitted or \b-\b then no plugins are matched. The "
"\aname\a operand is the library base name. All base names are matched "
"if omitted or \b-\b. The \aversion\a operand specifies a specific "
"library version and is an implementation specific sequence of decimal "
"digits and dots. The latest version is matched if omitted or \b-\b. "
"Only the first path for each library base name is listed. If no options "
"are specified then \b--base\b \b--path\b is assumed.]"
"[+?\asymbol\a operands, if specified, are searched for in each matched "
"library. The address or lookup error is listed for each library and "
"\asymbol\a.]"
"[b:base?List the \adll\a or \ashared library\a base names.]"
"[c:containing?Only list libraries containing at least one of the "
"\asymbol\a operands.]"
"[i:info?List native dll naming and location information.]"
"[l:long?List the base name, plugin YYYYMMDD version stamp, and full "
"path for each shared library. Libraries with no plugin version stamp "
"have version stamp 00000000.]"
"[p:path?List the \adll\a or \ashared library\a path names.]"
"\n\n"
"[ plugin [ name [ version [ symbol ... ] ] ] ]\n"
"\n"
"[+SEE ALSO?\bfind\b(1), \bdllscan\b(3)]"
;
#include <cmd.h>
#include <dlldefs.h>
int
{
int i;
int r;
int flags;
int only;
unsigned long ver;
char** syms;
void* dll;
void* sym;
flags = 0;
only = 0;
for (;;)
{
{
case 0:
break;
case 'b':
continue;
case 'c':
only = 1;
continue;
case 'i':
continue;
case 'l':
continue;
case 'p':
continue;
case ':':
continue;
case '?':
continue;
}
break;
}
if (error_info.errors)
r = 0;
{
i = 0;
{
i = 1;
}
{
if (i)
}
}
{
for (i = 0; i < elementsof(arg); i++)
argv++;
r = 1;
for (;;)
{
{
{
r = 0;
if (!only)
{
dll = 0;
else
ver = 0;
switch (flags)
{
case LIST_BASE:
break;
break;
break;
case LIST_PATH:
break;
break;
default:
break;
}
{
{
do
{
else
} while (*++syms);
}
else
}
}
{
i = 1;
{
if (i)
{
i = 0;
switch (flags)
{
case LIST_BASE:
break;
case LIST_PATH:
break;
default:
break;
}
}
}
}
}
}
break;
arg[0] = 0;
}
}
return r || error_info.errors;
}