OpenCoverage

file-type.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/file-type.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/* Return a string describing the type of a file.-
2-
3 Copyright (C) 1993-1994, 2001-2002, 2004-2006, 2009-2018 Free Software-
4 Foundation, Inc.-
5-
6 This program is free software: you can redistribute it and/or modify-
7 it under the terms of the GNU General Public License as published by-
8 the Free Software Foundation; either version 3 of the License, or-
9 (at your option) any later version.-
10-
11 This program is distributed in the hope that it will be useful,-
12 but WITHOUT ANY WARRANTY; without even the implied warranty of-
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-
14 GNU General Public License for more details.-
15-
16 You should have received a copy of the GNU General Public License-
17 along with this program. If not, see <https://www.gnu.org/licenses/>. */-
18-
19/* Written by Paul Eggert. */-
20-
21#include <config.h>-
22-
23#include "file-type.h"-
24-
25#include <gettext.h>-
26#define _(text) gettext (text)-
27-
28char const *-
29file_type (struct stat const *st)-
30{-
31 /* See POSIX 1003.1-2001 XCU Table 4-8 lines 17093-17107 for some of-
32 these formats.-
33-
34 To keep diagnostics grammatical in English, the returned string-
35 must start with a consonant. */-
36-
37 /* Do these three first, as they're the most common. */-
38-
39 if (S_ISREG (st->st_mode))
(((( st->st_mo... == (0100000))Description
TRUEevaluated 23 times by 2 tests
Evaluated by:
  • rm
  • stat
FALSEevaluated 28 times by 2 tests
Evaluated by:
  • rm
  • stat
23-28
40 return st->st_size == 0 ? _("regular empty file") : _("regular file");
executed 23 times by 2 tests: return st->st_size == 0 ? dcgettext (((void *)0), "regular empty file" , 5) : dcgettext (((void *)0), "regular file" , 5) ;
Executed by:
  • rm
  • stat
23
41-
42 if (S_ISDIR (st->st_mode))
(((( st->st_mo... == (0040000))Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • rm
  • stat
FALSEevaluated 12 times by 2 tests
Evaluated by:
  • rm
  • stat
12-16
43 return _("directory");
executed 16 times by 2 tests: return dcgettext (((void *)0), "directory" , 5) ;
Executed by:
  • rm
  • stat
16
44-
45 if (S_ISLNK (st->st_mode))
(((( st->st_mo... == (0120000))Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • rm
  • stat
FALSEnever evaluated
0-12
46 return _("symbolic link");
executed 12 times by 2 tests: return dcgettext (((void *)0), "symbolic link" , 5) ;
Executed by:
  • rm
  • stat
12
47-
48 /* Do the S_TYPEIS* macros next, as they may be implemented in terms-
49 of S_ISNAM, and we want the more-specialized interpretation. */-
50-
51 if (S_TYPEISMQ (st))
(( st )->st_mo...st )->st_mode)Description
TRUEnever evaluated
FALSEnever evaluated
0
52 return _("message queue");
never executed: return dcgettext (((void *)0), "message queue" , 5) ;
0
53-
54 if (S_TYPEISSEM (st))
(( st )->st_mo...st )->st_mode)Description
TRUEnever evaluated
FALSEnever evaluated
0
55 return _("semaphore");
never executed: return dcgettext (((void *)0), "semaphore" , 5) ;
0
56-
57 if (S_TYPEISSHM (st))
(( st )->st_mo...st )->st_mode)Description
TRUEnever evaluated
FALSEnever evaluated
0
58 return _("shared memory object");
never executed: return dcgettext (((void *)0), "shared memory object" , 5) ;
0
59-
60 if (S_TYPEISTMO (st))
dead code: return dcgettext (((void *)0), "typed memory object" , 5) ;
-
61 return _("typed memory object");
dead code: return dcgettext (((void *)0), "typed memory object" , 5) ;
-
62-
63 /* The remaining are in alphabetical order. */-
64-
65 if (S_ISBLK (st->st_mode))
(((( st->st_mo... == (0060000))Description
TRUEnever evaluated
FALSEnever evaluated
0
66 return _("block special file");
never executed: return dcgettext (((void *)0), "block special file" , 5) ;
0
67-
68 if (S_ISCHR (st->st_mode))
(((( st->st_mo... == (0020000))Description
TRUEnever evaluated
FALSEnever evaluated
0
69 return _("character special file");
never executed: return dcgettext (((void *)0), "character special file" , 5) ;
0
70-
71 if (S_ISCTG (st->st_mode))
dead code: return dcgettext (((void *)0), "contiguous data" , 5) ;
-
72 return _("contiguous data");
dead code: return dcgettext (((void *)0), "contiguous data" , 5) ;
-
73-
74 if (S_ISFIFO (st->st_mode))
(((( st->st_mo... == (0010000))Description
TRUEnever evaluated
FALSEnever evaluated
0
75 return _("fifo");
never executed: return dcgettext (((void *)0), "fifo" , 5) ;
0
76-
77 if (S_ISDOOR (st->st_mode))
dead code: return dcgettext (((void *)0), "door" , 5) ;
-
78 return _("door");
dead code: return dcgettext (((void *)0), "door" , 5) ;
-
79-
80 if (S_ISMPB (st->st_mode))
dead code: return dcgettext (((void *)0), "multiplexed block special file" , 5) ;
-
81 return _("multiplexed block special file");
dead code: return dcgettext (((void *)0), "multiplexed block special file" , 5) ;
-
82-
83 if (S_ISMPC (st->st_mode))
dead code: return dcgettext (((void *)0), "multiplexed character special file" , 5) ;
-
84 return _("multiplexed character special file");
dead code: return dcgettext (((void *)0), "multiplexed character special file" , 5) ;
-
85-
86 if (S_ISMPX (st->st_mode))
dead code: return dcgettext (((void *)0), "multiplexed file" , 5) ;
-
87 return _("multiplexed file");
dead code: return dcgettext (((void *)0), "multiplexed file" , 5) ;
-
88-
89 if (S_ISNAM (st->st_mode))
dead code: return dcgettext (((void *)0), "named file" , 5) ;
-
90 return _("named file");
dead code: return dcgettext (((void *)0), "named file" , 5) ;
-
91-
92 if (S_ISNWK (st->st_mode))
dead code: return dcgettext (((void *)0), "network special file" , 5) ;
-
93 return _("network special file");
dead code: return dcgettext (((void *)0), "network special file" , 5) ;
-
94-
95 if (S_ISOFD (st->st_mode))
dead code: return dcgettext (((void *)0), "migrated file with data" , 5) ;
-
96 return _("migrated file with data");
dead code: return dcgettext (((void *)0), "migrated file with data" , 5) ;
-
97-
98 if (S_ISOFL (st->st_mode))
dead code: return dcgettext (((void *)0), "migrated file without data" , 5) ;
-
99 return _("migrated file without data");
dead code: return dcgettext (((void *)0), "migrated file without data" , 5) ;
-
100-
101 if (S_ISPORT (st->st_mode))
dead code: return dcgettext (((void *)0), "port" , 5) ;
-
102 return _("port");
dead code: return dcgettext (((void *)0), "port" , 5) ;
-
103-
104 if (S_ISSOCK (st->st_mode))
(((( st->st_mo... == (0140000))Description
TRUEnever evaluated
FALSEnever evaluated
0
105 return _("socket");
never executed: return dcgettext (((void *)0), "socket" , 5) ;
0
106-
107 if (S_ISWHT (st->st_mode))
dead code: return dcgettext (((void *)0), "whiteout" , 5) ;
-
108 return _("whiteout");
dead code: return dcgettext (((void *)0), "whiteout" , 5) ;
-
109-
110 return _("weird file");
never executed: return dcgettext (((void *)0), "weird file" , 5) ;
0
111}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.1.2