FFFF minix/commands/elvis/ref.c at v3.1.0 · devinblood/minix · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
executable file
·
521 lines (467 loc) · 10.9 KB

ref.c

File metadata and controls

executable file
·
521 lines (467 loc) · 10.9 KB
/* parse flags */
for (i = 1; i < argc && argv[i][0] == '-'; i++)
{
switch (argv[i][1])
{
case 't':
taginfo = 1;
break;
case 'f':
if (argv[i][2])
{
def_file = &argv[i][2];
}
else if (++i < argc)
{
def_file = argv[i];
}
else
{
usage();
}
break;
case 'c':
if (argv[i][2])
{
def_class = &argv[i][2];
}
else if (++i < argc)
{
def_class = argv[i];
}
else
{
usage();
}
break;
default:
usage();
}
}
/* if no tag was given, complain */
if (i + 1 != argc)
{
usage();
}
/* does the tag have an explicit class or file? */
colons = countcolons(argv[i]);
/* if not, then maybe try some defaults */
if (colons == 0)
{
/* try a static function in the file first */
if (def_file)
{
sprintf(def_tag, "%s:%s", def_file, argv[i]);
colons = 1;
if (find(def_tag))
{
exit(0);
}
}
/* try a member function for a class */
if (def_class)
{
sprintf(def_tag, "%s::%s", def_class, argv[i]);
colons = 2;
if (find(def_tag))
{
exit(0);
}
}
/* oh, well */
colons = 0;
}
/* find the tag */
if (find(argv[i]))
{
exit(0);
}
exit(1);
/*NOTREACHED*/
}
0