blob: da5b1296477548e2b1162a90d91b99dbbb600786 [file] [log] [blame]
Eric Andersen9f0fedb2001-04-24 18:07:19 +00001/* vi: set sw=4 ts=4: */
2/*
Eric Andersenbdfd0d72001-10-24 05:00:29 +00003 * Mini chgrp implementation for busybox
Eric Andersen9f0fedb2001-04-24 18:07:19 +00004 *
Eric Andersenc7bda1c2004-03-15 08:29:22 +00005 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
Eric Andersen9f0fedb2001-04-24 18:07:19 +00006 *
Bernhard Reutner-Fischerb1629b12006-05-19 19:29:19 +00007 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
Eric Andersen9f0fedb2001-04-24 18:07:19 +00008 */
9
Denis Vlasenkoe80e2a32006-10-27 23:28:38 +000010/* BB_AUDIT SUSv3 defects - unsupported options -H, -L, and -P. */
11/* BB_AUDIT GNU defects - unsupported long options. */
Manuel Novoa III cad53642003-03-19 09:13:01 +000012/* http://www.opengroup.org/onlinepubs/007904975/utilities/chgrp.html */
13
Eric Andersen9f0fedb2001-04-24 18:07:19 +000014#include "busybox.h"
Eric Andersen9f0fedb2001-04-24 18:07:19 +000015
Eric Andersen9f0fedb2001-04-24 18:07:19 +000016int chgrp_main(int argc, char **argv)
17{
Denis Vlasenkoe80e2a32006-10-27 23:28:38 +000018 /* "chgrp [opts] abc file(s)" == "chown [opts] :abc file(s)" */
19 char **p = argv;
20 while (*++p) {
21 if (p[0][0] != '-') {
22 p[0] = xasprintf(":%s", p[0]);
23 break;
Eric Andersen9f0fedb2001-04-24 18:07:19 +000024 }
Denis Vlasenkoe80e2a32006-10-27 23:28:38 +000025 }
26 return chown_main(argc, argv);
Eric Andersen9f0fedb2001-04-24 18:07:19 +000027}