~drizzle-trunk/drizzle/development

1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
1
/* Copyright (C) 2008 PrimeBase Technologies GmbH, Germany
1548.2.1 by Barry.Leslie at PrimeBase
Added the PBMS daemon plugin.
2
 *
3
 * PrimeBase Media Stream for MySQL
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 2 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
1802.10.2 by Monty Taylor
Update all of the copyright headers to include the correct address.
17
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1548.2.1 by Barry.Leslie at PrimeBase
Added the PBMS daemon plugin.
18
 *
19
 * Original author: Paul McCullagh (H&G2JCtL)
20
 * Continued development: Barry Leslie
21
 *
22
 * 2007-05-21
23
 *
24
 * CORE SYSTEM:
25
 * Simple utility functions.
26
 *
27
 */
28
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
29
#pragma once
1548.2.1 by Barry.Leslie at PrimeBase
Added the PBMS daemon plugin.
30
#ifndef __CSUTIL_H__
31
#define __CSUTIL_H__
32
33
#include "CSDefs.h"
34
1841.1.3 by Barry.Leslie at PrimeBase
Merged changes from lp:pbms. These changes should remove any danger
35
const char	*cs_version();
36
1548.2.1 by Barry.Leslie at PrimeBase
Added the PBMS daemon plugin.
37
void		cs_strcpy(size_t size, char *d, const char *s, size_t len);
38
void		cs_strcpy(size_t size, char *d, const char *s);
1841.1.3 by Barry.Leslie at PrimeBase
Merged changes from lp:pbms. These changes should remove any danger
39
void		cs_strcpy_dottt(size_t size, char *d, const char *s, size_t len);
1548.2.1 by Barry.Leslie at PrimeBase
Added the PBMS daemon plugin.
40
void		cs_strcpy_left(size_t size, char *d, const char *s, char ch);
41
void		cs_strcpy_right(size_t size, char *d, const char *s, char ch);
42
void		cs_strcat(size_t size, char *d, const char *s);
43
void		cs_strcat_left(size_t size, char *d, const char *s, char ch);
44
void		cs_strcat_right(size_t size, char *d, const char *s, char ch);
45
void		cs_strcat(size_t size, char *d, char ch);
46
void		cs_strcat(char **to, const char *to_cat);
47
void		cs_strcat(size_t size, char *to, int i);
48
void		cs_strcat(size_t size, char *to, uint32_t i);
49
void		cs_strcat(size_t size, char *to, uint64_t i);
50
void		cs_strcat_hex(size_t size, char *to, uint64_t i);
51
void		cs_format_context(size_t size, char *buffer, const char *func, const char *file, int line);
1841.1.3 by Barry.Leslie at PrimeBase
Merged changes from lp:pbms. These changes should remove any danger
52
int			cs_path_depth(const char *path);
53
bool		cs_fixed_pattern(const char *path);
54
bool		cs_match_patern(const char *pattern, const char *str, bool ignore_case);
1548.2.1 by Barry.Leslie at PrimeBase
Added the PBMS daemon plugin.
55
char		*cs_last_name_of_path(const char *path, int count);
56
char		*cs_last_name_of_path(const char *path);
1841.1.3 by Barry.Leslie at PrimeBase
Merged changes from lp:pbms. These changes should remove any danger
57
char		*cs_last_directory_of_path(const char *path);
1548.2.1 by Barry.Leslie at PrimeBase
Added the PBMS daemon plugin.
58
const char	*cs_find_extension(const char *file_name);
59
void		cs_remove_extension(char *file_name);
60
bool		cs_is_extension(const char *file_name, const char *ext);
61
bool		cs_remove_dir_char(char *dir_name);
62
void		cs_remove_last_name_of_path(char *path);
63
bool		cs_add_dir_char(size_t max, char *path);
64
bool		cs_is_absolute(const char *path);
65
void		cs_add_name_to_path(size_t max, char *path, const char *name);
66
const char	*cs_next_name_of_path(const char *path);
67
void		cs_adjust_path(size_t max, char *path, const char *rel_path);
68
char		*cs_strdup(const char *in_str);
69
char		*cs_strdup(int value);
70
char		*cs_strdup(const char *in_str, size_t len);
71
bool		cs_starts_with(const char *cstr, const char *w_cstr);
1841.1.3 by Barry.Leslie at PrimeBase
Merged changes from lp:pbms. These changes should remove any danger
72
bool		cs_ends_with(const char *cstr, const char *w_cstr);
1548.2.1 by Barry.Leslie at PrimeBase
Added the PBMS daemon plugin.
73
void		cs_make_absolute_path(size_t max, char *path, const char *rel_path, const char *cwd);
1841.1.6 by Barry.Leslie at PrimeBase
Updating PBMS code to match pbms revision 244
74
void		cs_replace_string(size_t size, char *into, const char *find_str, const char *str);
1548.2.1 by Barry.Leslie at PrimeBase
Added the PBMS daemon plugin.
75
void		cs_replace_string(size_t size, char *into, const char ch, const char *str);
76
int64_t		cs_str_to_int8(const char *ptr, bool *overflow);
1841.1.3 by Barry.Leslie at PrimeBase
Merged changes from lp:pbms. These changes should remove any danger
77
int64_t		cs_byte_size_to_int8(const char *ptr, bool *invalid = NULL);
78
uint64_t	cs_str_to_word8(const char *ptr, bool *overflow = NULL);
79
size_t		cs_hex_to_bin(size_t size, void *bin, const char *hex);
1548.2.1 by Barry.Leslie at PrimeBase
Added the PBMS daemon plugin.
80
size_t		cs_hex_to_bin(size_t size, void *bin, size_t len, const char *hex);
1919.3.40 by Barry.Leslie at PrimeBase
Fixed 2 bugs in the S3 protocol code. One caused a jumpstack overflow and the other
81
// NOTE: cs_bin_to_hex() Always null terminates the result.
1841.1.3 by Barry.Leslie at PrimeBase
Merged changes from lp:pbms. These changes should remove any danger
82
void		cs_bin_to_hex(size_t size, char *hex, size_t len, const void *bin);
1548.2.1 by Barry.Leslie at PrimeBase
Added the PBMS daemon plugin.
83
void		cs_strToUpper(char *ptr);
84
void		cs_strToLower(char *ptr);
85
1841.1.3 by Barry.Leslie at PrimeBase
Merged changes from lp:pbms. These changes should remove any danger
86
bool		cs_str_to_value(const char *ptr, uint32_t *value, uint8_t base);
1548.2.1 by Barry.Leslie at PrimeBase
Added the PBMS daemon plugin.
87
#endif