八亿电脑网
游戏盒子
当前位置: 首页 > 八亿电脑 > 电脑知识 >

linux系统中whereis的用法详解(5)

时间:2015-03-01 21:23来源:网络 作者:win8e 点击:
游戏盒子


if (*arg != '-') {
lookup(arg, ls, want);
/*
* The lookup mask ("want") is cumulative and it's
* resetable only when it has been already used.
*
* whereis -b -m foo :'foo' mask=BIN|MAN
* whereis -b foo bar :'foo' and 'bar' mask=BIN|MAN
* whereis -b foo -m bar :'foo' mask=BIN; 'bar' mask=MAN
*/
want_resetable = 1;
continue;
}

for (++arg; arg && *arg; arg++) {
DBG(ARGV, ul_debug(" arg: %s", arg));

switch (*arg) {
case 'f':
break;
case 'u':
uflag = 1;
break;
case 'B':
if (*(arg + 1))
usage(stderr);
i++;
free_dirlist(&ls, BIN_DIR);
construct_dirlist_from_argv(
&ls, &i, argc, argv, BIN_DIR);
break;
case 'M':
if (*(arg + 1))
usage(stderr);
i++;
free_dirlist(&ls, MAN_DIR);
construct_dirlist_from_argv(
&ls, &i, argc, argv, MAN_DIR);
break;
case 'S':
if (*(arg + 1))
usage(stderr);
i++;
free_dirlist(&ls, SRC_DIR);
construct_dirlist_from_argv(
&ls, &i, argc, argv, SRC_DIR);
break;
case 'b':
if (want_resetable) {
want = ALL_DIRS;
want_resetable = 0;
}
want = want == ALL_DIRS ? BIN_DIR : want | BIN_DIR;
break;
case 'm':
if (want_resetable) {
want = ALL_DIRS;
want_resetable = 0;
}
want = want == ALL_DIRS ? MAN_DIR : want | MAN_DIR;
break;
case 's':
if (want_resetable) {
want = ALL_DIRS;
want_resetable = 0;
}
want = want == ALL_DIRS ? SRC_DIR : want | SRC_DIR;
break;
case 'l':
list_dirlist(ls);
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
usage(stdout);
default:
usage(stderr);
}

if (arg_i < i)/* moved to the next argv[] item */
break;
}
}

free_dirlist(&ls, ALL_DIRS);
return EXIT_SUCCESS;
}


靠,就连代码注释都有错误,懒得折腾了,哥还有事要做。反正 -u 参数实际很少使用的,有兴趣的可以看下这代码。

本篇文章标签: 教程 Win10 win7 软件 Win8
发表评论