make getpeername() return the original socket address which before it was intercepted
[hband-tools.git] / execfuse / contentbyname / readdir
blob7580af872b913b778b558dbf2cab25f4a8225f37
1 #!/bin/bash
3 EPERM=1
4 ENOENT=2
5 EIO=5
6 EBADF=9
7 EAGAIN=11
8 EACCESS=13
9 EBUSY=16
10 EEXIST=17
11 ENOTDIR=20
12 EISDIR=21
13 EINVAL=22
14 EFBIG=27
15 ENOSPC=28
16 ESPIPE=29
17 ENOSYS=38
18 ENOTEMPTY=39
19 EOPNOTSUPP=95
22 GID=0
23 fmode=-rw-r--r--
24 dmode=drwxr-xr-x
26 print_entry_dir()
28 mode=$dmode size=0 print_entry "$@"
31 print_entry_file()
33 mode=$fmode print_entry "$@"
36 print_entry()
38 echo -ne "ino=1 mode=$mode nlink=2 uid=$UID gid=$GID rdev=0 size=${size:-0} blksize=512 blocks=0 atime=0 mtime=0 ctime=0${1:+ $1\0}"
42 fuse_operation=${0##*/}
44 case "$fuse_operation" in
45 readdir)
46 exit 0
47 ;; # readdir
49 getattr)
50 if [ "$1" = / ]
51 then
52 print_entry_dir
53 exit 0
55 content=${1:1}
56 size=${#content}
57 print_entry_file
58 exit 0
59 ;; # getattr
61 read_file)
62 echo -n "${1:1}"
63 exit 0
64 ;; # read_file
65 esac
67 exit $ENOSYS