]> wimlib.net Git - wimlib/blob - tests/tests-common.sh
4f33f6c1d2844ce131266fb7cb4d3f24fa6ce20a
[wimlib] / tests / tests-common.sh
1 if stat -c %i . &> /dev/null ; then
2         BSD_STAT=0
3 else
4         BSD_STAT=1
5 fi
6
7 get_inode_number()
8 {
9         if [ "$BSD_STAT" -eq 1 ]; then
10                 stat -f %i "$1"
11         else
12                 stat -c %i "$1"
13         fi
14 }
15
16 get_link_count()
17 {
18         if [ "$BSD_STAT" -eq 1 ]; then
19                 stat -f %l "$1"
20         else
21                 stat -c %h "$1"
22         fi
23 }
24
25 get_file_size()
26 {
27         if [ "$BSD_STAT" -eq 1 ]; then
28                 stat -f %z "$1"
29         else
30                 stat -c %s "$1"
31         fi
32 }