예제 #1
0
파일: lsattr.c 프로젝트: emaste/toybox
void chattr_main(void)
{
  char **argv = toys.optargs;

  memset(&chattr, 0, sizeof(struct _chattr));
  parse_cmdline_arg(&argv);
  if (!*argv) help_exit("no file");
  if (chattr.set && (chattr.add || chattr.rm))
    error_exit("no '=' with '-' or '+'");
  if (chattr.rm & chattr.add) error_exit("set/unset same flag");
  if (!(chattr.add || chattr.rm || chattr.set || chattr.vflag))
    error_exit("need '-v', '=', '-' or '+'");
  for (; *argv; argv++) dirtree_read(*argv, update_attr);
  toys.exitval = 0; //always set success at this point.
}
예제 #2
0
파일: lsattr.c 프로젝트: ajs1984/toybox
void chattr_main(void)
{
  char **argv = toys.optargs;

  memset(&chattr, 0, sizeof(struct _chattr));
  parse_cmdline_arg(&argv);
  if (!*argv) chattr_help();
  if (chattr.set && (chattr.add || chattr.rm))
    error_exit("'=' is incompatible with '-' and '+'");
  if (chattr.rm & chattr.add) error_exit("Can't set and unset same flag.");
  if (!(chattr.add || chattr.rm || chattr.set || chattr.vflag))
    error_exit(("Must use '-v', '=', '-' or '+'"));
  for (; *argv; argv++) dirtree_read(*argv, update_attr);
  toys.exitval = 0; //always set success at this point.
}