~ubuntu-branches/ubuntu/vivid/cctools/vivid

« back to all changes in this revision

Viewing changes to parrot/src/parrot_getacl.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Hanke
  • Date: 2011-05-07 09:05:00 UTC
  • Revision ID: james.westby@ubuntu.com-20110507090500-lqpmdtwndor6e7os
Tags: upstream-3.3.2
ImportĀ upstreamĀ versionĀ 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright (C) 2008- The University of Notre Dame
 
3
This software is distributed under the GNU General Public License.
 
4
See the file COPYING for details.
 
5
*/
 
6
 
 
7
#include "parrot_client.h"
 
8
 
 
9
#include <stdio.h>
 
10
#include <stdlib.h>
 
11
#include <errno.h>
 
12
#include <string.h>
 
13
#include <unistd.h>
 
14
 
 
15
int main( int argc, char *argv[] )
 
16
{
 
17
        const char *path;
 
18
        char buf[4096];
 
19
        int result;
 
20
 
 
21
        if(argc<2) {
 
22
                path = ".";
 
23
        } else {
 
24
                path = argv[1];
 
25
        }
 
26
 
 
27
        if(argc>2 || path[0]=='-') {
 
28
                printf("use: parrot_getacl [path]\n");
 
29
                return 0;
 
30
        }
 
31
 
 
32
        result = parrot_getacl(path,buf,sizeof(buf));
 
33
        if(result>=0) {
 
34
                buf[result] = 0;
 
35
                printf("%s",buf);
 
36
                return 0;
 
37
        } else {
 
38
                if(errno==ENOSYS || errno==EINVAL) {
 
39
                        fprintf(stderr,"getacl: This filesystem does not support Parrot access controls.\n");
 
40
                } else {
 
41
                        fprintf(stderr,"getacl: %s\n",strerror(errno));
 
42
                }
 
43
                return 1;
 
44
        }
 
45
}