 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
34 #ifndef CF_MXE_CROSS_COMPILE
35 #include <sys/param.h>
72 char *tempname = NULL;
76 const int maxretry = 10;
79 for (i = 0; i < maxretry; i++) {
80 tempname = tempnam(dir, pfx);
88 LOG(
llevError,
"Created file detected in tempnam_secure. Someone hoping for a race condition?\n");
95 file = fdopen(fd,
"w+");
97 LOG(
llevError,
"fdopen() failed in tempnam_secure()!\n");
102 *filename = tempname;
119 char buf[strlen(
path) +
sizeof(dirent::d_name) + 1];
131 if (de->d_name[0] ==
'.')
137 status = stat(de->d_name, &statbuf);
138 if ((status != -1) && (S_ISDIR(statbuf.st_mode))) {
139 snprintf(
buf,
sizeof(
buf),
"%s/%s",
path, de->d_name);
143 snprintf(
buf,
sizeof(
buf),
"%s/%s",
path, de->d_name);
168 if (!filename || !*filename)
172 while ((cp = strchr(cp+1, (
int)
'/'))) {
174 if (stat(
buf, &statbuf) || !S_ISDIR(statbuf.st_mode)) {
202 void safe_strcat(
char *dest,
const char *orig,
size_t *curlen,
size_t maxlen) {
203 assert(curlen != NULL);
204 assert(*curlen < maxlen);
206 *curlen = strlcat(dest, orig, maxlen);
208 if (*curlen == (maxlen-1))
210 strncpy(dest+*curlen, orig, maxlen-*curlen-1);
212 *curlen += strlen(orig);
214 if (*curlen > (maxlen-1))
222 size_t strlcpy(
char *dst,
const char *src,
size_t size) {
223 strncpy(dst, src, size - 1);
224 dst[size - 1] =
'\0';
232 const char *
strcasestr(
const char *s,
const char *find)
237 if ((
c = *find++) != 0) {
242 if ((
sc = *s++) == 0)
245 while ((
char)
tolower((
unsigned char)
sc) !=
c);
247 while (strncasecmp(s, find, len) != 0);
@ llevError
Error, serious thing.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
void safe_strcat(char *dest, const char *orig, size_t *curlen, size_t maxlen)
Simple function we use below to keep adding to the same string but also make sure we don't overwrite ...
static event_registration c
#define tolower(C)
Simple macro to convert a letter to lowercase.
void remove_directory(const char *path)
This function removes everything in the directory, and the directory itself.
DIR * opendir(const char *)
Player Stats effect how well a character can survie and interact inside the crossfire world This section discusses the various what they and how they effect the player s actions Also in this section are the stat modifiers that specific classes professions bring Player and sps the current and maximum the Current and Maximum The Current Sp can go somewhat negative When Sp is negative not all spells can be and a more negative Sp makes spell casting less likey to succeed can affect Damage and how the characters as well as how often the character can attack this affects the prices when buying and selling items if this drops the player will start losing hit points wd Cleric or Dwarf sm Elf wd Fireborn sc
struct dirent * readdir(DIR *)
const char * strcasestr(const char *s, const char *find)
#define MAX_BUF
Used for all kinds of things.
size_t strlcpy(char *dst, const char *src, size_t size)
Portable implementation of strlcpy(3).
pluglist shows those as well as a short text describing each the list will simply appear empty The keyword for the Python plugin is Python plugout< keyword > Unloads a given identified by its _keyword_ So if you want to unload the Python you need to do plugout Python plugin< libname > Loads a given whose _filename_ is libname So in the case of you d have to do a plugin cfpython so Note that all filenames are relative to the default plugin path(SHARE/plugins). Console messages. ----------------- When Crossfire starts
FILE * tempnam_secure(const char *dir, const char *pfx, char **filename)
A replacement for the tempnam_local() function since that one is not very secure.
void make_path_to_file(const char *filename)
Checks if any directories in the given path doesn't exist, and creates if necessary.
@ llevDebug
Only for debugging purposes.