This file is indexed.

/usr/include/libzia/zstr.h is in libzia-dev 4.06-2+b1.

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
/*
    string utilities
    Copyright (C) 2011 Ladislav Vaiz <ok1zia@nagano.cz>

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    version 2 as published by the Free Software Foundation.

*/

#ifndef __ZSTR_H
#define __ZSTR_H

#include <libziaint.h>
#include <glib.h>

#include <ctype.h>
#include <string.h>

gint z_compare_string (gconstpointer a, gconstpointer b);
char *z_strstr(const char *, const char *);
char *z_strcasestr(const char *phaystack, const char *pneedle);
int z_levenshtein(const char *s, const char*t);
char *z_string_hex(GString *gs, char *data, int len);

static inline char z_char_uc(char a)
{
    if (a >= 'a' && a <= 'z') a -= 0x20;
    return a;
}

static inline char z_char_lc(char a)
{
    if (a >= 'A' && a <= 'Z') a += 0x20;
    return a;
}

static inline char *z_str_lc(char *str){
    register char *c;
    
    if (!str) return str;
    for (c = str; *c != '\0'; c++){
        if (*c >= 'A' && *c <= 'Z') *c += 0x20;
    }
    return str;
}

static inline char *z_str_uc(char *str){
    register char *c;
    
    if (!str) return str;
    for (c = str; *c != '\0'; c++){
        if (*c >= 'a' && *c <= 'z') *c -= 0x20;
    }
    return str;
}

static inline char *z_strlcpy(gchar *dest, const gchar *src, gsize dest_size){
    if (dest == NULL){
        g_strlcpy(dest, "", dest_size);
    }else{
        g_strlcpy(dest, src, dest_size);
    }
    return dest;
}

static inline char *z_char_replace(char *src, char find, char replacewith){
    char *c;

    for (c = src; *c != '\0'; c++){
        if (*c == find) *c = replacewith;
    }
    return src;
}

#ifdef Z_MSC
#define strtok_r strtok_s
#endif

#ifdef Z_MINGW
char *strtok_r(char *str, const char *delim, char **saveptr);
#endif

char *z_strip_crlf(char *str);
char *z_strip_from(char *str, char charfrom);

char *z_1250_to_8859_2(char *src);

void *z_strtop(const char *str);

#ifndef Z_HAVE_G_STRING_APPEND_VPRINTF
void g_string_append_vprintf(GString *gs, const gchar *format, va_list args);
#endif

double z_qrg_parse(const char *s);
void z_qrg_format(char *s, int size, double qrg);

char *z_html2txt(char *html);


#define ZSR_ALL 0x01 // all occurences
#define ZSR_CI  0x02 // case insensitive
// returns last replace position
int z_string_replace(GString *gs, char *pattern, char *newstr, int flags);

int z_string_replace_from_to(GString *gs, char *from, char *to, char *newstr, int flags);

#ifdef Z_MSC_MINGW
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#endif


static inline char *z_trim(char *s){
    char *c;

    if (!s || !*s) return s;
    for (c = s + strlen(s) - 1; c > s; c--) {
        if (!isspace((unsigned char)*c)) break;
        *c = '\0';
    }
    for (c = s; *c != '\0'; c++) if (!isspace((unsigned char)*c)) break;
    
    if (c[0] == '\xef' && c[1] == '\xbb' && c[2] == '\xbf'){
        for (c += 3; *c != '\0'; c++) if (!isspace((unsigned char)*c)) break;
    }
    return c;
}

static inline char *z_trim_end(char *s){
    char *c;

    if (!s || !*s) return s;
    for (c = s + strlen(s) - 1; c > s; c--) {
        if (!isspace((unsigned char)*c)) break;
        *c = '\0';
    }
    return s;
}

static inline const char *z_trim_beg(const char *s){
    const char *c;

    for (c = s; *c != '\0'; c++) if (!isspace((unsigned char)*c)) break;
    
    if (c[0] == '\xef' && c[1] == '\xbb' && c[2] == '\xbf'){
        for (c += 3; *c != '\0'; c++) if (!isspace((unsigned char)*c)) break;
    }
    return c;
}



static inline gchar *z_strdup_trim(gchar *s){
    char *c1, *c2;
    c1 = g_strdup(s);
    c2 = g_strdup(z_trim(c1));
    g_free(c1);
    return c2;
}

#define ZSPL_NSTRIP 0x01
void z_split2(char *src, char delimiter, char **key, char **val, int flags);

int zstr_begins_with(const char *haystack, const char *needle, int casesensitive);

static inline char *z_trimdup(const char *src){
    return z_trim_end(g_strdup(z_trim_beg(src)));
}

char *zstr_shorten(const char *src, int maxlen);
void z_string_bytes(GString *gs, long long bytes);

#endif