Cleanup patch from Vladimir N. Oleynik.
[oweals/busybox.git] / chmod_chown_chgrp.c
index f6ecfd6f86879143039528bdf4f5d207feb34b35..178138a3ba120422a7d15ced1184c7f2a9e3972e 100644 (file)
@@ -3,7 +3,7 @@
  * Mini chown/chmod/chgrp implementation for busybox
  *
  *
- * Copyright (C) 1999,2000 by Lineo, inc.
+ * Copyright (C) 1999,2000,2001 by Lineo, inc.
  * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -29,6 +29,9 @@
 #include "messages.c"
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 
 
 static long uid = -1;
@@ -80,9 +83,9 @@ int chmod_chown_chgrp_main(int argc, char **argv)
        char *p=NULL;
        const char *appUsage;
 
-       whichApp = (strcmp(applet_name, "chown") == 0)? 
-                       CHOWN_APP : (strcmp(applet_name, "chmod") == 0)? 
-                               CHMOD_APP : CHGRP_APP;
+       whichApp = (applet_name[2]=='o')?           /* chown */
+               CHOWN_APP : (applet_name[2]=='m')?      /* chmod */
+               CHMOD_APP : CHGRP_APP;
 
        appUsage = (whichApp == CHOWN_APP)? 
                        chown_usage : (whichApp == CHMOD_APP) ? chmod_usage : chgrp_usage;