This file is indexed.

/usr/include/bobcat/string is in libbobcat-dev 4.08.02-2build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#ifndef INCLUDED_BOBCAT_STRING_
#define INCLUDED_BOBCAT_STRING_

#include <iostream>

#include <strings.h>
#include <string>
#include <vector>

namespace FBB
{

struct String
{
    enum Type
    {
        DQUOTE_UNTERMINATED,    // unterminated d-quoted element
        SQUOTE_UNTERMINATED,    // unterminated s-quoted element
        ESCAPED_END,            // word with plain \ at the end
        SEPARATOR, // separator encountered
        NORMAL, // normal string-element in the original string
        DQUOTE, // string-element originally surrounded by " chars
        SQUOTE, // string-element originally surrounded by ' chars
        END,    // end-of-string immediately encountered 
    };

    enum SplitType
    {
        TOK,            // split acts like strtok (like addEmpty == false)
        TOKSEP,         // same, but return separators (like addEmpty == true)
        STR,            // split acts like strstr
        STRSEP,         // same, but return separators
    };

    struct Unescape
    {
        std::string str;
        size_t      length;
    };

    struct SplitPair: public std::pair<std::string, Type>
    {
        SplitPair();
        SplitPair(char ch, Type type);
    };

    private:
        typedef std::vector<SplitPair> SplitPairVector;
        typedef std::string::const_iterator ConstIter;

        static size_t const s_nSplitTypeSize = 
                                static_cast<size_t>(STRSEP) + 1;

        enum class CharType
        {
            DQUOTE,
            SQUOTE,
            SEPARATOR,
            ESCAPE,
            CHAR,
            EOS,
            size
        };

        static size_t const s_nCharTypes = 
                                    static_cast<size_t>(CharType::size);

        enum State
        {
            START,
            SQSTRING,
            DQSTRING,
        };
        
        struct FSAData
        {
            State state;
            std::string separators;
            SplitPair entry;
            SplitPairVector *entries;
            ConstIter begin;
            ConstIter end;
        };

        static bool (*s_FSAtransition[][s_nCharTypes])(FSAData &);
        static void (*s_tuneToSplitType[s_nSplitTypeSize])(
                            SplitPairVector *entries);
        static std::string (*s_join[])(SplitPairVector const &, char);

    public:
        static constexpr Type *const noType = 0;
    
        static char const **argv(std::vector<std::string> const &lines);
    
        static int casecmp(std::string const &lhs,                  // .f
                           std::string const &rhs); 

        static std::string escape(std::string const &str, 
                            char const *series = "'\"\\");
    
        static std::string join(std::vector<std::string> const &words, // 1
                                char sep);

        static std::string join(SplitPairVector const &entries, char sep, // 2
                                bool all = true);

        static std::string lc(std::string const &str);


        static SplitPairVector split(std::string const &str,        // 1
                    SplitType stype, char const *separators = " \t");

        static SplitPairVector split(std::string const &str,        // 2
                    char const *separators = " \t", 
                    bool addEmpty = false);
    

        static size_t split(SplitPairVector *entries,               // 3
                    std::string const &str, SplitType stype,
                    char const *separators = " \t");

        static size_t split(SplitPairVector *entries,               // 4
                    std::string const &str, char const *separators = " \t", 
                    bool addEmpty = false);
    

        static std::vector<std::string> split(                      // 5
                        Type *type, std::string const &str, SplitType stype, 
                    char const *separators = " \t");
    
        static std::vector<std::string> split(                      // 6
                    Type *type, std::string const &str, 
                    char const *separators = " \t", 
                    bool addEmpty = false);


        static size_t split(std::vector<std::string> *words,        // 7
                    std::string const &str, SplitType stype,
                    char const *separators = " \t");

        static size_t split(std::vector<std::string> *words,        // 8
                    std::string const &str, char const *separators = " \t",
                    bool addEmpty = false);
                                                                    

        static std::string trim(std::string const &str);
        static std::string uc(std::string const &str);
    
        static std::string unescape(std::string const &str);        
        static Unescape unescape(ConstIter begin,               // 2
                                 ConstIter const &end);
    
        static std::string urlDecode(std::string const &str);
        static std::string urlEncode(std::string const &str);
    
    private:
        static void tolower(char &chr);             // .f
        static void toupper(char &chr);             // .f

        static FSAData process(SplitPairVector *entries, SplitType stype,
                               std::string const &str, char const *sep);

        static CharType peek(FSAData &data);
        static bool dqIn(FSAData &data);
        static bool sqIn(FSAData &data);
        static bool sepIn(FSAData &data);
        static bool escIn(FSAData &data);
        static bool chIn(FSAData &data);
        static bool eosIn(FSAData &data);
        static bool qEnd(FSAData &data);
        static bool eosSq(FSAData &data);
        static bool eosDq(FSAData &data);

        static void tok(SplitPairVector *entries);  // tuning members
        static void toksep(SplitPairVector *entries);
        static void str(SplitPairVector *entries);
        static void strsep(SplitPairVector *entries);   // see data.cc

        static std::string joinAll(SplitPairVector const &entries, char sep);
        static std::string joinIgnoreSEPARATOR(SplitPairVector const &entries, 
                                               char sep);
};

inline int String::casecmp(std::string const &lhs, std::string const &rhs)
{
    return strcasecmp(lhs.c_str(), rhs.c_str());
}

} // FBB


#endif