- int ret = -1;
- if (argc <= 1){
- fprintf (stderr
- ,"showattr file ...\n"
- "\n"
- "Presents extended file attribute.\n"
- "\n"
- "setattr --immutable --immulink file ...\n"
- "\n"
- "Sets the extended file attributes.\n"
- "\n"
- "These utilities exist as an interim until lsattr and\n"
- "chattr are updated.\n"
- );
- }else if (strstr(argv[0],"showattr")!=NULL){
- int i;
- for (i=1; i<argc; i++){
- long flags;
- ret = getext2flags (argv[i],&flags);
- if (ret == -1){
- break;
- }else{
- printf ("%s\t%08lx\n",argv[i],flags);
- }
- }
- }else if (strstr(argv[0],"setattr")!=NULL){
- long flags = 0;
- int i;
- ret = 0;
- for (i=1; i<argc; i++){
- const char *arg = argv[i];
- if (strncmp(arg,"--",2)==0){
- if (strcmp(arg,"--immutable")==0){
- flags |= EXT2_IMMUTABLE_FILE_FL;
- }else if (strcmp(arg,"--immulink")==0){
- flags |= EXT2_IMMUTABLE_LINK_FL;
- }else{
- fprintf (stderr,"Invalid option %s\n",arg);
- ret = -1;
- break;
- }
- }else{
- ret = setext2flags (arg,flags);
- if (ret == -1){
- break;
- }
- }
- }
- }
- return ret;
+ xid_t xid;
+ *mask = ~0;
+
+ if (vc_get_iattr(name, &xid, flags, mask)==-1) {
+ perror("vc_get_iattr()");
+ return false;
+ }
+
+ return true;