This file is indexed.

/usr/include/OS/string.h is in ivtools-dev 1.2.11a1-2.

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
/*
 * Copyright (c) 1999 Vectaport Inc.
 * Copyright (c) 1991 Stanford University
 * Copyright (c) 1991 Silicon Graphics, Inc.
 *
 * Permission to use, copy, modify, distribute, and sell this software and
 * its documentation for any purpose is hereby granted without fee, provided
 * that the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the names of the copyright holders not be used in
 * advertising or publicity pertaining to distribution of the software
 * without specific, written prior permission.  The copyright holders make
 * no representations about the suitability of this software for any purpose.
 * It is provided "as is" without express or implied warranty.
 *
 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
 * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef os_string_h
#define os_string_h

/*
 * String - simple (non-copying) string class
 */

#include <cstdio>
#include <OS/enter-scope.h>

#include <iosfwd>

class String {
public:
#ifdef _DELTA_EXTENSIONS
#pragma __static_class
#endif
    String();
    String(const char*);
    String(const char*, int length);
    String(const String&);
    virtual ~String();

    const char* string() const;
    int length() const;

    virtual unsigned long hash() const;
    virtual String& operator =(const String&);
    virtual String& operator =(const char*);
    virtual boolean operator ==(const String&) const;
    virtual boolean operator ==(const char*) const;
    virtual boolean operator !=(const String&) const;
    virtual boolean operator !=(const char*) const;
    virtual boolean operator >(const String&) const;
    virtual boolean operator >(const char*) const;
    virtual boolean operator >=(const String&) const;
    virtual boolean operator >=(const char*) const;
    virtual boolean operator <(const String&) const;
    virtual boolean operator <(const char*) const;
    virtual boolean operator <=(const String&) const;
    virtual boolean operator <=(const char*) const;

    virtual boolean case_insensitive_equal(const String&) const;
    virtual boolean case_insensitive_equal(const char*) const;

    u_char operator [](int index) const;
    virtual String substr(int start, int length) const;
    String left(int length) const;
    String right(int start) const;

    virtual void set_to_substr(int start, int length);
    void set_to_left(int length);
    void set_to_right(int start);

    virtual int search(int start, u_char) const;
    int index(u_char) const;
    int rindex(u_char) const;

    virtual boolean convert(int&) const;
    virtual boolean convert(long&) const;
    virtual boolean convert(float&) const;
    virtual boolean convert(double&) const;

    virtual boolean null_terminated() const;

    virtual boolean contains(const char*, int start=0) const;

    String before(const char*) const;
    String from(const char*) const;

    int freq(const char* t) const;

    operator const char*() const;

    friend ostream& operator << (ostream& s, const String&);

protected:
    virtual void set_value(const char*);
    virtual void set_value(const char*, int);
private:
    const char* data_;
    int length_;
};

class CopyString : public String {
public:
#ifdef _DELTA_EXTENSIONS
#pragma __static_class
#endif
    CopyString();
    CopyString(const char*);
    CopyString(const char*, int length);
    CopyString(const String&);
    CopyString(const CopyString&);
    virtual ~CopyString();

    virtual String& operator =(const String&);
    virtual String& operator =(const char*);

    virtual boolean null_terminated() const;
protected:
    virtual void set_value(const char*);
    virtual void set_value(const char*, int);
private:
    void free();
};

class NullTerminatedString : public String {
public:
#ifdef _DELTA_EXTENSIONS
#pragma __static_class
#endif
    NullTerminatedString();
    NullTerminatedString(const String&);
    NullTerminatedString(const NullTerminatedString&);
    virtual ~NullTerminatedString();

    virtual String& operator =(const String&);
    virtual String& operator =(const char*);

    virtual boolean null_terminated() const;
private:
    boolean allocated_;

    void assign(const String&);
    void free();
};

inline const char* String::string() const { return data_; }
inline int String::length() const { return length_; }
inline u_char String::operator [](int index) const {
    return ((u_char*)data_)[index];
}

inline String String::left(int length) const { return substr(0, length); }
inline String String::right(int start) const { return substr(start, -1); }

inline void String::set_to_left(int length) { set_to_substr(0, length); }
inline void String::set_to_right(int start) { set_to_substr(start, -1); }

inline int String::index(u_char c) const { return search(0, c); }
inline int String::rindex(u_char c) const { return search(-1, c); }

extern char* strnew(const char*);   /* return a copy of the given string */

#endif