# files (and the mask files ('*Maske.gif') to xbm files).
# XPM_INCLUDE_FILE = -DXPM_INCLUDE_FILE="<X11/xpm.h>"
+# EXTRA_X11_LIBS = -lXpm
CONFIG = $(GAME_DIR) $(SOUNDS) $(JOYSTICK) \
$(SCORE_ENTRIES) $(XPM_INCLUDE_FILE)
# # for SunOS and others
# LIBS = -L/usr/X11R6/lib -lXpm -lX11 -lm
-LIBS = -L/usr/X11R6/lib -lX11 -lm
+# LIBS = -L/usr/X11R6/lib -lX11 -lm
+
+LIBS = -L/usr/X11R6/lib $(EXTRA_X11_LIBS) -lX11 -lm
# CFLAGS = -O2 $(CONFIG) $(SYSTEM)
CFLAGS = $(DEBUG) $(CONFIG) $(SYSTEM) $(INCL)
joystick.c \
cartoons.c \
random.c \
- gfxload.c \
gifload.c \
gif.c \
send.c \
joystick.o \
cartoons.o \
random.o \
- gfxload.o \
gifload.o \
gif.o \
send.o \
if (!(file=fopen(filename,"r")))
{
- fprintf(stderr,"%s: cannot load level info '%s'!\n",progname,filename);
+ Error(ERR_RETURN, "cannot load level info '%s'", filename);
return(FALSE);
}
fscanf(file,"%s\n",cookie);
if (strcmp(cookie,LEVELDIR_COOKIE)) /* ungültiges Format? */
{
- fprintf(stderr,"%s: wrong format of level info file!\n",progname);
+ Error(ERR_RETURN, "wrong format of level info file");
fclose(file);
return(FALSE);
}
if (!num_leveldirs)
{
- fprintf(stderr,"%s: empty level info '%s'!\n",progname,filename);
+ Error(ERR_RETURN, "empty level info '%s'", filename);
return(FALSE);
}
sprintf(filename,"%s/%s/%d",
level_directory,leveldir[leveldir_nr].filename,level_nr);
- if (!(file=fopen(filename,"r")))
+ if (!(file = fopen(filename,"r")))
{
/*
- fprintf(stderr,"%s: cannot load level '%s'!\n",progname,filename);
+ Error(ERR_RETURN, "cannot load level '%s'", filename);
*/
}
else
if (strcmp(cookie,LEVEL_COOKIE)) /* ungültiges Format? */
{
- fprintf(stderr,"%s: wrong format of level file '%s'!\n",
- progname,filename);
+ Error(ERR_RETURN, "wrong format of level file '%s'", filename);
fclose(file);
file = NULL;
}
levelrec_10 = TRUE;
else if (strcmp(cookie,LEVELREC_COOKIE)) /* unknown tape format */
{
- fprintf(stderr,"%s: wrong format of level recording file '%s'!\n",
- progname,filename);
+ Error(ERR_RETURN, "wrong format of level recording file '%s'", filename);
fclose(file);
file = NULL;
}
fclose(file);
if (i != tape.length)
- fprintf(stderr,"%s: level recording file '%s' corrupted!\n",
- progname,filename);
+ Error(ERR_RETURN, "level recording file '%s' corrupted", filename);
tape.length_seconds = GetTapeLength();
}
sprintf(filename,"%s/%s/%s",
level_directory,leveldir[leveldir_nr].filename,SCORE_FILENAME);
- if (!(file=fopen(filename,"r")))
+ if (!(file = fopen(filename,"r")))
{
if (!CreateNewScoreFile())
- {
- fprintf(stderr,"%s: cannot create score file '%s'!\n",
- progname,filename);
- }
- else if (!(file=fopen(filename,"r")))
- {
- fprintf(stderr,"%s: cannot load score for level %d!\n",
- progname,level_nr);
- }
+ Error(ERR_RETURN, "cannot create score file '%s'", filename);
+ else if (!(file = fopen(filename,"r")))
+ Error(ERR_RETURN, "cannot load score for level %d", level_nr);
}
if (file)
fgets(cookie,SCORE_COOKIE_LEN,file);
if (strcmp(cookie,SCORE_COOKIE)) /* ungültiges Format? */
{
- fprintf(stderr,"%s: wrong format of score file!\n",progname);
+ Error(ERR_RETURN, "wrong format of score file '%s'", filename);
fclose(file);
file = NULL;
}
new_player = default_player;
- if (!(file=fopen(filename,"r")))
+ if (!(file = fopen(filename,"r")))
{
if (!CreateNewNamesFile(mode))
- {
- fprintf(stderr,"%s: cannot create names file '%s'!\n",
- progname,filename);
- }
- else if (!(file=fopen(filename,"r")))
- {
- fprintf(stderr,"%s: cannot load player information '%s'!\n",
- progname,filename);
- }
+ Error(ERR_RETURN, "cannot create names file '%s'", filename);
+ else if (!(file = fopen(filename,"r")))
+ Error(ERR_RETURN, "cannot load player information file '%s'", filename);
}
if (file)
version_10_file = TRUE;
else if (strcmp(cookie,NAMES_COOKIE)) /* ungültiges Format? */
{
- fprintf(stderr,"%s: wrong format of names file '%s'!\n",
- progname,filename);
+ Error(ERR_RETURN, "wrong format of names file '%s'", filename);
fclose(file);
file = NULL;
}
new_player = default_player;
fclose(file);
- if (!(file=fopen(filename,"a")))
- {
- fprintf(stderr,"%s: cannot append new player to names file '%s'!\n",
- progname,filename);
- }
+ if (!(file = fopen(filename,"a")))
+ Error(ERR_RETURN, "cannot append new player to names file '%s'",
+ filename);
else
{
for(i=0;i<MAX_NAMELEN;i++)
if (!(file=fopen(filename,"w")))
{
- fprintf(stderr,"%s: cannot save level file '%s'!\n",progname,filename);
+ Error(ERR_RETURN, "cannot save level file '%s'", filename);
return;
}
if (!(file=fopen(filename,"w")))
{
- fprintf(stderr,"%s: cannot save level recording file '%s'!\n",
- progname,filename);
+ Error(ERR_RETURN, "cannot save level recording file '%s'", filename);
return;
}
if (!(file=fopen(filename,"r+")))
{
- fprintf(stderr,"%s: cannot save score for level %d!\n",
- progname,level_nr);
+ Error(ERR_RETURN, "cannot save score for level %d", level_nr);
return;
}
else
sprintf(filename,"%s/%s",CONFIG_PATH,NAMES_FILENAME);
- if (!(file=fopen(filename,"r+")))
+ if (!(file = fopen(filename,"r+")))
{
- fprintf(stderr,"%s: cannot save player information '%s'!\n",
- progname,filename);
+ Error(ERR_RETURN, "cannot save player information to file '%s'", filename);
return;
}
version_10_file = TRUE;
else if (strcmp(cookie,NAMES_COOKIE)) /* ungültiges Format? */
{
- fprintf(stderr,"%s: wrong format of names file '%s'!\n",
- progname,filename);
+ Error(ERR_RETURN, "wrong format of names file '%s'", filename);
fclose(file);
return;
}
fscanf(file,"%s",cookie);
if (strcmp(cookie,JOYSTICK_COOKIE)) /* ungültiges Format? */
{
- fprintf(stderr,"%s: wrong format of joystick file!\n",progname);
+ Error(ERR_RETURN, "wrong format of joystick file '%s'", JOYDAT_FILE);
fclose(file);
return;
}
if (!(file=fopen(JOYDAT_FILE,"w")))
{
- fprintf(stderr,"%s: cannot save joystick calibration data!\n",progname);
+ Error(ERR_RETURN, "cannot save joystick calibration data to file '%s'",
+ JOYDAT_FILE);
return;
}
static void InitServer(void);
static void InitLevelAndPlayerInfo(void);
-static void InitDisplay(int, char **);
+static void InitDisplay(void);
static void InitSound(void);
static void InitSoundProcess(void);
static void InitWindow(int, char **);
signal(SIGINT, CloseAll);
signal(SIGTERM, CloseAll);
- InitDisplay(argc, argv);
+ InitDisplay();
InitWindow(argc, argv);
XMapWindow(display, window);
void InitServer()
{
- standalone = FALSE;
+ standalone = FALSE + TRUE;
if (standalone)
return;
if (!ConnectToServer(server_host, server_port))
- {
- fprintf(stderr,"%s: cannot connect to multiplayer server.\n",
- progname);
- exit(-1);
- }
+ Error(ERR_EXIT, "cannot connect to multiplayer server");
SendNicknameToServer(local_player->alias_name);
SendProtocolVersionToServer();
#ifndef MSDOS
if (access(sound_device_name,W_OK)<0)
{
- fprintf(stderr,"%s: cannot access sound device - no sounds\n",progname);
- sound_status=SOUND_OFF;
+ Error(ERR_RETURN, "cannot access sound device - no sounds");
+ sound_status = SOUND_OFF;
return;
}
if ((sound_device=open(sound_device_name,O_WRONLY))<0)
{
- fprintf(stderr,"%s: cannot open sound device - no sounds\n",progname);
- sound_status=SOUND_OFF;
+ Error(ERR_RETURN, "cannot open sound device - no sounds");
+ sound_status = SOUND_OFF;
return;
}
#ifndef MSDOS
if (pipe(sound_pipe)<0)
{
- fprintf(stderr,"%s: cannot create pipe - no sounds\n",progname);
+ Error(ERR_RETURN, "cannot create pipe - no sounds");
sound_status=SOUND_OFF;
return;
}
if ((sound_process_id=fork())<0)
{
- fprintf(stderr,"%s: cannot create child process - no sounds\n",progname);
+ Error(ERR_RETURN, "cannot create child process - no sounds");
sound_status=SOUND_OFF;
return;
}
#ifndef MSDOS
if (access(joystick_device_name[joystick_nr],R_OK)<0)
{
- fprintf(stderr,"%s: cannot access joystick device '%s'\n",
- progname,joystick_device_name[joystick_nr]);
+ Error(ERR_RETURN, "cannot access joystick device '%s'",
+ joystick_device_name[joystick_nr]);
joystick_status = JOYSTICK_OFF;
return;
}
if ((joystick_device=open(joystick_device_name[joystick_nr],O_RDONLY))<0)
{
- fprintf(stderr,"%s: cannot open joystick device '%s'\n",
- progname,joystick_device_name[joystick_nr]);
+ Error(ERR_RETURN, "cannot open joystick device '%s'",
+ joystick_device_name[joystick_nr]);
joystick_status = JOYSTICK_OFF;
return;
}
#endif
}
-void InitDisplay(int argc, char *argv[])
+void InitDisplay()
{
- char *display_name = NULL;
XVisualInfo vinfo_template, *vinfo;
int num_visuals;
unsigned int depth;
- int i;
-
- /* get X server to connect to, if given as an argument */
- for (i=1;i<argc-1;i++)
- {
- char *dispstr="-display";
- int len=MAX(strlen(dispstr),strlen(argv[i]));
-
- if (len<4)
- continue;
- else if (!strncmp(argv[i],dispstr,len))
- {
- display_name=argv[i+1];
- break;
- }
- }
/* connect to X server */
- if (!(display=XOpenDisplay(display_name)))
- {
- fprintf(stderr,"%s: cannot connect to X server %s\n",
- progname, XDisplayName(display_name));
- exit(-1);
- }
-
+ if (!(display = XOpenDisplay(display_name)))
+ Error(ERR_EXIT,"cannot connect to X server %s",XDisplayName(display_name));
+
screen = DefaultScreen(display);
visual = DefaultVisual(display, screen);
depth = DefaultDepth(display, screen);
&icon_width,&icon_height,
&icon_pixmap,&icon_hot_x,&icon_hot_y);
if (!icon_pixmap)
- {
- fprintf(stderr, "%s: cannot read icon bitmap file '%s'.\n",
- progname,icon_filename);
- exit(-1);
- }
+ Error(ERR_EXIT, "cannot read icon bitmap file '%s'", icon_filename);
sprintf(icon_filename,"%s/%s",GFX_PATH,icon_pic.picturemask_filename);
XReadBitmapFile(display,window,icon_filename,
&icon_width,&icon_height,
&iconmask_pixmap,&icon_hot_x,&icon_hot_y);
if (!iconmask_pixmap)
- {
- fprintf(stderr, "%s: cannot read icon bitmap file '%s'.\n",
- progname,icon_filename);
- exit(-1);
- }
+ Error(ERR_EXIT, "cannot read icon bitmap file '%s'", icon_filename);
size_hints.width = size_hints.min_width = size_hints.max_width = width;
size_hints.height = size_hints.min_height = size_hints.max_height = height;
}
if (!XStringListToTextProperty(&window_name, 1, &windowName))
- {
- fprintf(stderr, "%s: structure allocation for windowName failed.\n",
- progname);
- exit(-1);
- }
+ Error(ERR_EXIT, "structure allocation for windowName failed");
if (!XStringListToTextProperty(&icon_name, 1, &iconName))
- {
- fprintf(stderr, "%s: structure allocation for iconName failed.\n",
- progname);
- exit(-1);
- }
+ Error(ERR_EXIT, "structure allocation for iconName failed");
wm_hints.initial_state = NormalState;
wm_hints.input = True;
wm_hints.icon_mask = iconmask_pixmap;
wm_hints.flags = StateHint | IconPixmapHint | IconMaskHint | InputHint;
- class_hints.res_name = progname;
+ class_hints.res_name = program_name;
class_hints.res_class = "Rocks'n'Diamonds";
XSetWMProperties(display, window, &windowName, &iconName,
}
if (!pix[PIX_DB_BACK] || !pix[PIX_DB_DOOR])
- {
- fprintf(stderr, "%s: cannot create additional Pixmaps!\n",progname);
- CloseAll();
- exit(-1);
- }
+ Error(ERR_EXIT, "cannot create additional pixmaps");
for(i=0;i<NUM_PIXMAPS;i++)
{
#endif
if (!pix[pos])
- {
- fprintf(stderr, "%s: cannot get graphics for '%s'.\n",
- progname, pic->picture_filename);
- CloseAll();
- exit(-1);
- }
+ Error(ERR_EXIT, "cannot get graphics for '%s'", pic->picture_filename);
}
/* zugehörige Maske laden (wenn vorhanden) */
#endif
if (!clipmask[pos])
- {
- fprintf(stderr, "%s: cannot get clipmask for '%s'.\n",
- progname, pic->picture_filename);
- CloseAll();
- exit(-1);
- }
+ Error(ERR_EXIT, "cannot get clipmask for '%s'", pic->picture_filename);
}
}
#endif
#include "joystick.h"
+#include "misc.h"
/*
#include "tools.h"
#ifndef MSDOS
if (read(joystick_device, &joy_ctrl, sizeof(joy_ctrl)) != sizeof(joy_ctrl))
{
- fprintf(stderr,"%s: cannot read joystick settings - no joystick support\n",
- progname);
+ Error(ERR_RETURN, "cannot read joystick settings - no joystick support");
joystick_status = JOYSTICK_OFF;
return(0);
}
#include "events.h"
#include "sound.h"
#include "joystick.h"
+#include "misc.h"
#ifdef MSDOS
#include <fcntl.h>
};
int num_bg_loops = sizeof(background_loop)/sizeof(int);
-char *progname;
+char *program_name;
#define MAX_OPTION_LEN 1024
static void fatal_option()
{
fprintf(stderr,"Try '%s --help' for more information.\n",
- progname);
+ program_name);
exit(1);
}
static void fatal_unrecognized_option(char *option)
{
fprintf(stderr,"%s: unrecognized option '%s'\n",
- progname, option);
+ program_name, option);
fatal_option();
}
static void fatal_option_requires_argument(char *option)
{
fprintf(stderr,"%s: option '%s' requires an argument\n",
- progname, option);
+ program_name, option);
fatal_option();
}
-static void fatal_invalid_argument(char *option)
+static void fatal_invalid_option_argument(char *option)
{
fprintf(stderr,"%s: option '%s' has invalid argument\n",
- progname, option);
+ program_name, option);
fatal_option();
}
static void fatal_too_many_arguments()
{
fprintf(stderr,"%s: too many arguments\n",
- progname);
+ program_name);
fatal_option();
}
{
char **options_left = &argv[1];
- progname = &argv[0][strlen(argv[0])];
- while (progname != argv[0])
- if (*progname-- == '/')
- break;
+ program_name = (strrchr(argv[0],'/') ? strrchr(argv[0],'/') + 1 : argv[0]);
- while (options_left)
+ while (*options_left)
{
char option_str[MAX_OPTION_LEN];
char *option = options_left[0];
char *next_option = options_left[1];
char *option_arg = NULL;
- int option_len;
+ int option_len = strlen(option);
- if (strcmp(option, "--") == 0) /* end of argument list */
- break;
+ strcpy(option_str, option); /* copy argument into buffer */
+ option = option_str;
- if (strncmp(option, "--", 2)) /* treat '--' like '-' */
- option++;
- option_len = strlen(option);
+ if (strcmp(option, "--") == 0) /* stop scanning arguments */
+ break;
if (option_len >= MAX_OPTION_LEN)
fatal_unrecognized_option(option);
- strcpy(option_str, option);
- option = option_str;
+ if (strncmp(option, "--", 2) == 0) /* treat '--' like '-' */
+ option++;
option_arg = strchr(option, '=');
if (option_arg == NULL) /* no '=' in option */
{
*option_arg++ = '\0'; /* cut argument from option */
if (*option_arg == '\0') /* no argument after '=' */
- fatal_invalid_argument(option);
+ fatal_invalid_option_argument(option);
}
- if (strncmp(option, "-help", option_len) == 0)
+ option_len = strlen(option);
+
+ if (strcmp(option, "-") == 0)
+ fatal_unrecognized_option(option);
+ else if (strncmp(option, "-help", option_len) == 0)
{
- printf("Usage: rocksndiamonds [options] [server.name [port]]\n"
+ printf("Usage: %s [options] [server.name [port]]\n"
"Options:\n"
" -d, --display machine:0 X server display\n"
" -l, --levels directory alternative level directory\n"
- " -v, --verbose verbose mode\n");
+ " -v, --verbose verbose mode\n",
+ program_name);
exit(0);
}
else if (strncmp(option, "-display", option_len) == 0)
{
if (option_arg == NULL)
- fatal_option_requires_argument(option);
+ fatal_option_requires_argument(option_str);
display_name = option_arg;
if (option_arg == next_option)
options_left++;
+
+ printf("--display == '%s'\n", display_name);
}
else if (strncmp(option, "-levels", option_len) == 0)
{
if (option_arg == NULL)
- fatal_option_requires_argument(option);
+ fatal_option_requires_argument(option_str);
level_directory = option_arg;
if (option_arg == next_option)
options_left++;
+
+ printf("--levels == '%s'\n", level_directory);
}
else if (strncmp(option, "-verbose", option_len) == 0)
{
+ printf("--verbose\n");
+
verbose = TRUE;
}
else if (*option == '-')
- fatal_unrecognized_option(option);
+ fatal_unrecognized_option(option_str);
else if (server_host == NULL)
+ {
server_host = *options_left;
+
+ printf("server.name == '%s'\n", server_host);
+ }
else if (server_port == 0)
{
server_port = atoi(*options_left);
if (server_port < 1024)
fatal("Bad port number");
+
+ printf("port == %d\n", server_port);
}
else
fatal_too_many_arguments();
options_left++;
}
-
+ /*
+ printf("All went fine -- exiting\n");
+ exit(0);
+ */
/*
if (argc>1)
extern char *level_directory;
extern int width, height;
+extern char *display_name;
extern char *server_host;
extern int server_port;
extern int networking;
extern int background_loop[];
extern int num_bg_loops;
-extern char *progname;
+extern char *program_name;
/* often used screen positions */
#include <sys/time.h>
#include <sys/param.h>
#include <sys/types.h>
+#include <stdarg.h>
#include "misc.h"
+#include "init.h"
#include "tools.h"
#include "sound.h"
#include "random.h"
delay.tv_usec = 1000 * (milliseconds_delay % 1000);
if (select(0, NULL, NULL, NULL, &delay) != 0)
- fprintf(stderr,"%s: in function sleep_milliseconds: select() failed!\n",
- progname);
+ Error(ERR_RETURN, "sleep_milliseconds(): select() failed");
}
}
redraw_mask |= REDRAW_TILES;
}
}
+
+void Error(BOOL fatal_error, char *format_str, ...)
+{
+ FILE *output_stream = stderr;
+ va_list ap;
+ char *format_ptr;
+ char *s_value;
+ int i_value;
+ double d_value;
+
+ va_start(ap, format_str); /* ap points to first unnamed argument */
+
+ fprintf(output_stream, "%s: ", program_name);
+
+ for(format_ptr=format_str; *format_ptr; format_ptr++)
+ {
+ if (*format_ptr != '%')
+ {
+ fprintf(output_stream, "%c", *format_ptr);
+ continue;
+ }
+
+ switch(*++format_ptr)
+ {
+ case 'd':
+ i_value = va_arg(ap, int);
+ fprintf(output_stream, "%d", i_value);
+ break;
+
+ case 'f':
+ d_value = va_arg(ap, double);
+ fprintf(output_stream, "%f", d_value);
+ break;
+
+ case 's':
+ s_value = va_arg(ap, char *);
+ fprintf(output_stream, "%s", s_value);
+ break;
+
+ default:
+ fprintf(stderr, "\nfatal(): invalid format string: %s\n", format_str);
+ exit(-1);
+ }
+ }
+
+ va_end(ap);
+
+ fprintf(output_stream, "\n");
+
+ if (fatal_error)
+ {
+ fprintf(output_stream, "%s: aborting\n", program_name);
+ CloseAll();
+ exit(1);
+ }
+}
#define NEW_RANDOMIZE -1
+#define ERR_RETURN 0
+#define ERR_EXIT 1
+
void InitCounter(void);
unsigned long Counter(void);
void Delay(unsigned long);
unsigned int InitRND(long);
char *GetLoginName(void);
void MarkTileDirty(int, int);
+void Error(BOOL, char *, ...);
#endif
***********************************************************/
#include "sound.h"
+#include "misc.h"
+
#ifdef MSDOS
extern void sound_handler(struct SoundControl);
#endif
if (!FD_ISSET(sound_pipe[0], &sound_fdset))
continue;
if (read(sound_pipe[0], &snd_ctrl, sizeof(snd_ctrl)) != sizeof(snd_ctrl))
- {
- fprintf(stderr,"%s: broken pipe - no sounds\n",progname);
- exit(0);
- }
+ Error(ERR_EXIT, "broken pipe - no sounds");
#ifdef VOXWARE
audio_ctl = open("/dev/audioCtl", O_WRONLY | O_NDELAY);
if (audio_ctl == -1)
- {
- fprintf(stderr,"%s: cannot open /dev/audioCtl - no sounds\n",progname);
- exit(0);
- }
+ Error(ERR_EXIT, "cannot open /dev/audioCtl - no sounds");
if (ioctl(audio_ctl, AUDIO_DESCRIBE, &ainfo) == -1)
- {
- fprintf(stderr,"%s: no audio info - no sounds\n",progname);
- exit(0);
- }
+ Error(ERR_EXIT, "no audio info - no sounds");
if (ioctl(audio_ctl, AUDIO_SET_DATA_FORMAT, AUDIO_FORMAT_ULAW) == -1)
- {
- fprintf(stderr,"%s: ulaw audio not available - no sounds\n",progname);
- exit(0);
- }
+ Error(ERR_EXIT, "ulaw audio not available - no sounds");
ioctl(audio_ctl, AUDIO_SET_CHANNELS, 1);
ioctl(audio_ctl, AUDIO_SET_SAMPLE_RATE, 8000);
#ifndef MSDOS
if (!(file=fopen(filename,"r")))
{
- fprintf(stderr,"%s: cannot open sound file '%s' - no sounds\n",
- progname,filename);
+ Error(ERR_RETURN, "cannot open sound file '%s' - no sounds", filename);
return(FALSE);
}
if (fseek(file,0,SEEK_END)<0)
{
- fprintf(stderr,"%s: cannot read sound file '%s' - no sounds\n",
- progname,filename);
+ Error(ERR_RETURN, "cannot read sound file '%s' - no sounds", filename);
fclose(file);
return(FALSE);
}
if (!(snd_info->file_ptr=malloc(snd_info->file_len)))
{
- fprintf(stderr,"%s: out of memory (this shouldn't happen :) - no sounds\n",
- progname);
+ Error(ERR_RETURN, "out of memory (this shouldn't happen :) - no sounds");
fclose(file);
return(FALSE);
}
if (fread(snd_info->file_ptr,1,snd_info->file_len,file)!=snd_info->file_len)
{
- fprintf(stderr,"%s: cannot read sound file '%s' - no sounds\n",
- progname,filename);
+ Error(ERR_RETURN, "cannot read sound file '%s' - no sounds", filename);
fclose(file);
return(FALSE);
}
snd_info->file_len != be2long(&sound_header->chunk_size)+8 ||
strncmp(sound_header->magic_8SVX,"8SVX",4))
{
- fprintf(stderr,"%s: '%s' is not an IFF/8SVX file or broken- no sounds\n",
- progname,filename);
+ Error(ERR_RETURN, "'%s' is not an IFF/8SVX file or broken - no sounds",
+ filename);
return(FALSE);
}
snd_info->sample_ptr = load_sample(filename);
if(!snd_info->sample_ptr)
{
- fprintf(stderr,"%s: cannot read sound file '%s' - no sounds\n",
- progname,filename);
+ Error(ERR_RETURN, "cannot read sound file '%s' - no sounds", filename);
fclose(file);
return(FALSE);
}
#ifndef MSDOS
if (write(sound_pipe[1], &snd_ctrl, sizeof(snd_ctrl))<0)
{
- fprintf(stderr,"%s: cannot pipe to child process - no sounds\n",progname);
- sound_status=SOUND_OFF;
+ Error(ERR_RETURN, "cannot pipe to child process - no sounds");
+ sound_status = SOUND_OFF;
return;
}
#else
#ifndef MSDOS
if (write(sound_pipe[1], &snd_ctrl, sizeof(snd_ctrl))<0)
{
- fprintf(stderr,"%s: cannot pipe to child process - no sounds\n",progname);
- sound_status=SOUND_OFF;
+ Error(ERR_RETURN, "cannot pipe to child process - no sounds");
+ sound_status = SOUND_OFF;
return;
}
#else