2007-10-08 19:32:12 +00:00
|
|
|
/* vi: set sw=4 ts=4: */
|
|
|
|
/*
|
2007-10-10 14:41:07 +00:00
|
|
|
* Utility routines.
|
2007-10-08 19:32:12 +00:00
|
|
|
*
|
2007-10-10 14:41:07 +00:00
|
|
|
* Copyright (C) tons of folks. Tracking down who wrote what
|
|
|
|
* isn't something I'm going to worry about... If you wrote something
|
|
|
|
* here, please feel free to acknowledge your work.
|
2007-10-08 19:32:12 +00:00
|
|
|
*
|
2007-10-10 14:41:07 +00:00
|
|
|
* Based in part on code from sash, Copyright (c) 1999 by David I. Bell
|
2010-08-16 20:14:46 +02:00
|
|
|
* Permission has been granted to redistribute this code under GPL.
|
2007-10-10 14:41:07 +00:00
|
|
|
*
|
2010-08-16 20:14:46 +02:00
|
|
|
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
2007-10-08 19:32:12 +00:00
|
|
|
*/
|
|
|
|
|
2009-10-23 01:30:26 +02:00
|
|
|
#include "busybox.h"
|
2011-05-16 12:21:31 +02:00
|
|
|
|
2008-06-27 02:52:20 +00:00
|
|
|
void FAST_FUNC bb_show_usage(void)
|
2007-10-08 19:32:12 +00:00
|
|
|
{
|
2014-10-26 23:30:51 -05:00
|
|
|
xfunc_die();
|
2007-10-10 14:41:07 +00:00
|
|
|
}
|
2014-11-04 16:24:41 -06:00
|
|
|
|
|
|
|
/* check if u is member of group g */
|
|
|
|
int ingroup(uid_t u, gid_t g)
|
|
|
|
{
|
|
|
|
struct group *grp = getgrgid(g);
|
|
|
|
if (grp) {
|
|
|
|
char **mem;
|
|
|
|
for (mem = grp->gr_mem; *mem; mem++) {
|
|
|
|
struct passwd *pwd = getpwnam(*mem);
|
|
|
|
if (pwd && (pwd->pw_uid == u))
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|