fixing up what my last commit broke, so it compiles on a regular linux again.

platform.h needs some cleanup.
This commit is contained in:
Enno Rehling 2013-12-29 09:31:49 +01:00
parent a112dc908e
commit 478f900b7d
5 changed files with 25 additions and 11 deletions

View File

@ -504,6 +504,8 @@ static unsigned int messagehash(const struct message *msg)
return (unsigned int)var.i;
}
extern int fwritestr(FILE * F, const char *str);
static void render_messages(FILE * F, faction * f, message_list * msgs)
{
struct mlist *m = msgs->begin;

View File

@ -4668,8 +4668,10 @@ int writepasswd(void)
char zText[128];
sprintf(zText, "%s/passwd", basepath());
F = cfopen(zText, "w");
if (F) {
F = fopen(zText, "w");
if (!F) {
perror(zText);
} else {
faction *f;
log_info("writing passwords...");

View File

@ -149,9 +149,11 @@ void report_summary(summary * s, summary * o, bool full)
} else {
sprintf(zText, "%s/parteien", basepath());
}
F = cfopen(zText, "w");
if (!F)
F = fopen(zText, "w");
if (!F) {
perror(zText);
return;
}
#ifdef SUMMARY_BOM
else {
const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf, 0 };

View File

@ -17,6 +17,7 @@ without prior permission by the authors of Eressea.
#include <util/log.h>
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -27,7 +28,7 @@ without prior permission by the authors of Eressea.
/** writes a quoted string to the file
* no trailing space, since this is used to make the creport.
*/
static int fwritestr(FILE * F, const char *str)
int fwritestr(FILE * F, const char *str)
{
int nwrite = 0;
fputc('\"', F);

View File

@ -117,7 +117,6 @@ extern "C" {
# define HAVE_STAT
typedef struct stat stat_type;
# include <string.h>
# define HAVE_STRDUP
# define HAVE_SNPRINTF
#ifdef _POSIX_SOURCE /* MINGW doesn't seem to have these */
# define HAVE_EXECINFO
@ -143,7 +142,6 @@ typedef struct stat stat_type;
typedef struct stat stat_type;
# define HAVE_STRICMP
# define HAVE_STRNICMP
# define HAVE_STRDUP
# define HAVE_SLEEP
# define snprintf _snprintf
# define HAVE_SNPRINTF
@ -175,10 +173,6 @@ typedef struct stat stat_type;
# define stat(a, b) _stat(a, b)
typedef struct _stat stat_type;
/* MSVC has _strdup */
# define strdup _strdup
# define HAVE_STRDUP
# define stricmp(a, b) _stricmp(a, b)
# define HAVE_STRICMP
@ -256,4 +250,17 @@ extern char *strdup(const char *s);
#define isxspace(c) (c==160 || isspace(c))
#define TOLUA_CAST (char*)
#if !defined(HAVE_STRDUP)
# if defined(HAVE__STRDUP)
# define strdup(s) _strdup(s)
# endif
#endif
#if !defined(HAVE__STRDUP)
# if defined(HAVE_STRDUP)
# define _strdup(s) strdup(s)
# endif
#endif
#endif