Makefile.in - conditionally run ranlib

sys_unix.c - copied Sys_DebugLog() from sys_linux.c
This commit is contained in:
Loring Holden 2000-01-29 23:24:16 +00:00
parent 3c8f2939af
commit ff664f9b75
2 changed files with 27 additions and 1 deletions

View file

@ -268,7 +268,7 @@ $(COMMON_LIB): common_lib_DIR $(BUILD_DIR)/common_lib.a
$(BUILD_DIR)/common_lib.a: $(ALL_COMMON_LIB_OBJS)
ar cru $@ $(ALL_COMMON_LIB_OBJS)
ranlib $@
@RANLIB@ $@
# X11 software target

View file

@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// sys_unix.c -- Unix system driver
#include "quakedef.h"
#include "sys.h"
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
@ -173,6 +174,31 @@ int Sys_FileWrite (int handle, void *data, int count)
return fwrite (data, 1, count, sys_handles[handle].hFile);
}
void Sys_DebugLog(char *file, char *fmt, ...) {
va_list argptr;
static char data[1024];
FILE *stream;
unsigned char *p;
//int fd;
va_start(argptr, fmt);
vsnprintf(data, sizeof(data), fmt, argptr);
va_end(argptr);
// fd = open(file, O_WRONLY | O_BINARY | O_CREAT | O_APPEND, 0666);
stream = fopen(file, "a");
for (p = (unsigned char *) data; *p; p++) {
putc(trans_table[*p], stream);
}
fclose(stream);
/*
fd = open(file, O_WRONLY | O_CREAT | O_APPEND, 0666);
write(fd, data, strlen(data));
close(fd);
*/
}
/*
===============================================================================