annotate pwplib/pwplib-unix.c @ 17:c60e531d19cd

Some misc. cleanups and minor warning removals.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 22 May 2010 20:32:49 +0300
parents fa87f8897f21
children 2c72092554fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 #define __PWPLIB_C
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 #include "config.h"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 #include <stdio.h>
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 #include <stdlib.h>
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7
15
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
8 #ifdef DRIVE_SDL
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
9 #include <SDL.h>
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
10 #endif
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 #include <signal.h>
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 #include <time.h>
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 #include <sys/time.h>
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 #include "pwplib.h"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 #include "tty.h"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 /******************** random stuff *************************/
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20
15
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
21 static int sdl_init = 0;
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
22
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 extern void pwplib_dummy();
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 #define pwp_dummy pwplib_dummy
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25
17
c60e531d19cd Some misc. cleanups and minor warning removals.
Matti Hamalainen <ccr@tnsp.org>
parents: 15
diff changeset
26 void pwpwrite(const char *fmt, ...)
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 if(!pwplib.setup[SETUP_SHUTUP])
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 {
17
c60e531d19cd Some misc. cleanups and minor warning removals.
Matti Hamalainen <ccr@tnsp.org>
parents: 15
diff changeset
30 va_list ap;
c60e531d19cd Some misc. cleanups and minor warning removals.
Matti Hamalainen <ccr@tnsp.org>
parents: 15
diff changeset
31 va_start(ap, fmt);
c60e531d19cd Some misc. cleanups and minor warning removals.
Matti Hamalainen <ccr@tnsp.org>
parents: 15
diff changeset
32 vfprintf(stderr, fmt, ap);
c60e531d19cd Some misc. cleanups and minor warning removals.
Matti Hamalainen <ccr@tnsp.org>
parents: 15
diff changeset
33 va_end(ap);
c60e531d19cd Some misc. cleanups and minor warning removals.
Matti Hamalainen <ccr@tnsp.org>
parents: 15
diff changeset
34
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 usleep(1000*pwplib.set.infodelay);
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 /********************* timer ******************************/
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 #define TIMERHZ 72
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 int pwp_unix_tod()
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 {
15
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
44 #ifdef DRIVE_SDL
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
45 if (sdl_init) {
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
46 int quit = 0;
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
47 SDL_Event event;
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
48 if (SDL_PollEvent(&event) >= 0) {
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
49 switch (event.type) {
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
50 case SDL_KEYDOWN:
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
51 if (event.key.keysym.sym == SDLK_ESCAPE)
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
52 quit = 1;
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
53 break;
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
54 case SDL_QUIT:
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
55 quit = 1;
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
56 break;
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
57 }
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
58 }
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
59 if (quit) {
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
60 SDL_Quit();
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
61 pwplib_shutdown();
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
62 exit(1);
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
63 }
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
64 return (SDL_GetTicks() * TIMERHZ) / 1000;
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
65 } else
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
66 #endif
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
67 {
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 struct timeval tod;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 gettimeofday(&tod,NULL);
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 return (tod.tv_sec*TIMERHZ)+(tod.tv_usec*TIMERHZ/1000000);
15
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
71 }
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 /********************* destructors, signals etc **********/
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 void pwp_fatalsignal(int n)
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78 char buf[40];
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79
15
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
80 pwpwrite("* pwplib shutting down\n");
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
81
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
82 #ifdef DRIVE_SDL
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
83 if (sdl_init) {
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
84 sdl_init = 0;
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
85 SDL_Quit();
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
86 }
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
87 #endif
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
88
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 pwplib_shutdown();
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 sprintf(buf,"* died to signal %d\n",n);
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 pwpwrite(buf);
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94 exit(1);
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 /******************** initialization *********************/
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 int pwplib_initcore()
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100 {
15
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
101 int sdl_flags = 0;
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 pwplib_init_common();
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104 /*** set signals ***/
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105
15
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
106 #ifdef DRIVE_SDL
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
107 #ifdef DRIVE_VIDEO
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
108 sdl_flags |= SDL_INIT_VIDEO;
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
109 #endif
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
110 #ifdef DRIVE_AUDIO
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
111 sdl_flags |= SDL_INIT_AUDIO;
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
112 #endif
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
113 /* With SDL, we let it handle the signals */
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
114 if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_EVENTTHREAD | /* SDL_INIT_NOPARACHUTE | */ sdl_flags) != 0)
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
115 {
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
116 pwpwrite("* SDL could not be initialized.\n");
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
117 sdl_init = 0;
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
118 } else
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
119 sdl_init = 1;
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
120 #endif
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
121
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
122 if (!sdl_init) {
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
123 signal(SIGTERM,pwp_fatalsignal);
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
124 signal(SIGINT,pwp_fatalsignal);
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
125 signal(SIGQUIT,pwp_fatalsignal);
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
126 signal(SIGKILL,pwp_fatalsignal);
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
127 signal(SIGSEGV,pwp_fatalsignal);
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
128 }
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130 /*** video ***/
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132 # ifdef DRIVE_VIDEO
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134 # ifdef DRIVE_SDL
15
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
135 if(sdl_init && pwp_SDL_init())
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
136 {
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138 else
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139 # endif
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 # ifdef DRIVE_PVP
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 if(pwplib.setup[SETUP_PVP])
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 pvp_init();
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 else
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 # endif
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 if(!pwplib.setup[SETUP_NOVIDEO])
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147 tty_init();
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149 # endif
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 /*** audio ***/
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152 # ifdef DRIVE_AUDIO
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153 if(!pwplib.setup[SETUP_NOSOUND])
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 int snd=0;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
156 #ifdef DRIVE_SDL
15
fa87f8897f21 Implement hacky and crummy SDL event handling in timer value fetching function; moved SDL general initialization into pwplib-unix.c.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
157 if(!snd) { if(sdl_init && pwp_sdlaudio_init())snd++; }
0
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158 #endif
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
160 #ifdef DRIVE_OSS
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161 if(!snd) { if(oss_init())snd++; }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
162 #endif
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164 #ifdef DRIVE_HPUX
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 if(!snd) { if(hpuxsnd_init())snd++; }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166 #endif
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
167
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
168 if(!snd)
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169 pwpwrite("* couldn't init sound. going silent.\n");
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
171 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
172 else
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
173 pwpwrite("* no sound, as requested\n");
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
174 # endif
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176 /*** fallbacks - remove? ***/
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
177
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
178 if(pwplib.dump_rast==pwplib_dummy && pwplib.dump_attr!=pwplib_dummy)
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
179 pwplib.dump_rast=pwplib_dump_rast_plain;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
180
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181 /*** timer ***/
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183 if(pwplib.setup[SETUP_BPS]|pwplib.setup[SETUP_FPS])
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
184 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
185 char tmp[100];
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186 sprintf(tmp,"non-realtime output (bps=%d fps=%d)\n",
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
187 pwplib.setup[SETUP_BPS],pwplib.setup[SETUP_FPS]);
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
188 pwpwrite(tmp);
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190 pwplib.timerfunc=pwp_timer_nrt;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
191 pwplib.timer_counter=0;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
192 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
193 else
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
194 pwplib.timerfunc=pwp_unix_tod;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
195
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
196 /*** hmmm ***/
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
197
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
198 if(pwplib.setup[SETUP_HALVE])
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
199 pwplib.videobuf.height<<=1;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
200
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
201 /* only allow if smaller than original? */
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
202
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
203 if(pwplib.setup[SETUP_USERHEIGHT])
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
204 pwplib.videobuf.height=pwplib.setup[SETUP_USERHEIGHT];
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
205 if(pwplib.setup[SETUP_USERWIDTH])
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
206 pwplib.videobuf.width=pwplib.setup[SETUP_USERWIDTH];
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
207
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
208 /*** done ***/
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
209
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
210 # ifdef DRIVE_VIDEO
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
211 if(!pwplib.setup[SETUP_NOVIDEO])
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
212 {char tmp[100];
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
213 sprintf(tmp,"* pwplib now controls a %d x %d framebuffer\n",
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
214 pwplib.videobuf.width,pwplib.videobuf.height);
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
215 pwpwrite(tmp);
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
216 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
217 # endif
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
218
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
219 return 1;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
220 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
221
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
222 /************************************/
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
223
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
224 const char*pwplogo=
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
225 "\033[2J\033[H\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
226 " \033[36;46mMMmmmmmmMM\033[0m\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
227 " \033[36;46mMM\033[0m\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
228 " \033[31;41mxxxxxxxxxxxx\033[0m\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
229 " \033[31;41mxxxxxxxxxxxxxxxxxxx\033[0m\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
230 " \033[31;41mxxxxxxxxx\033[0m\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
231 " \033[33;43mZZZZZ\033[34;44m....\033[0m %%%%%%%%% %%% %%% %%%%%%%%%\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
232 " \033[37;47m@@@@\033[34;44m......\033[0m %%%%%%%%%. %%%....... %%%. %%%%%%%%%....\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
233 " \033[37;47m@@@@\033[34;44m....\033[37mo\033[34m.\033[0m .....%%% %%% %%% %%% %%% %%% %%%\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
234 " \033[37;47m@@@@@@@\033[34;44m....\033[0m %%% %%% %%% %%% %%% %%% %%%\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
235 " \033[37;47m@@@@@@@@@@@\033[0m %%%% %%% %%% %%% %%% %%%% %%%\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
236 " \033[37;47m@@@@@@@@@@@@@\033[0m %%%% %%% %%% %%% %%% %%%% %%%\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
237 " \033[37;47m@@@@@@@@@@@@@@@\033[0m %%%%%%%%% %%% %%% %%% %%%%%%%%%\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
238 " \033[37;47m@@@@\033[0m %%%%%%%%% %%% %%% %%% %%%%%%%%%\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
239 " \033[37;47m@@@@@@\033[0m %%% %%%%% %%% %%% %%%\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
240 " \033[37;47m@@@@@@@@@@\033[0m \033[31;41mxx\033[0m %%% %%%%% %%% %%% %%%\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
241 " \033[37;47m@@@@@@@@@@@@@@\033[0m %%% %%%%% %%%% %%% %%%\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
242 " \033[37;47m@@@@@@@@@@@\033[0m %%% %%%%% %%%% %%% %%%\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
243 " \033[37;47m@@@@@@@@@\033[0m .....%%%....... %%%%%%%%%%%%%%. %%%..........\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
244 " \033[37;47m@@@@@\033[0m %%% %%%%%%%%%%%%%% %%%\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
245 " \033[37;47m@@@@\033[0m\n\n";
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
246
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
247
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
248 void pwplib_startup()
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
249 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
250 if(!pwplib.setup[SETUP_SHUTUP])
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
251 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
252 pwpwrite("starting up.... 2sec delay for ^C");
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
253 sleep(2);
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
254 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
255
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
256 /* send initstuff? */
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
257 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
258
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
259 void pwplib_end()
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
260 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
261 if(pwplib.setup[SETUP_SHUTUP])return;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
262
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
263 pwplib_shutdown();
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
264 sleep(2);
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
265
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
266 fputs(pwplogo,stderr);
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
267 pwpwrite("shutting down multimedia subsystems\n"
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
268 "operation finished - support pwp\n\n\n");
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
269 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
270
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
271 /***************************************************************/
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
272
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
273 int pwplib_init(int argc,char**argv)
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
274 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
275 int i=0,quit=0;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
276
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
277 pwplib.argc=argc;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
278 pwplib.argv=argv;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
279
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
280 pwplib_getopts();
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
281
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
282 if(pwplib.setup[SETUP_WANTHELP])
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
283 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
284 printhelp();
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
285 exit(0);
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
286 pwplib.setup[SETUP_SHUTUP]++;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
287 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
288
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
289 if(!pwplib.setup[SETUP_SHUTUP])
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
290 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
291 fputs(pwplogo,stderr);
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
292 pwpwrite("pwplib " PWPLIB_VERSION " initializing..\n\nrun with --help for some options\n\n");
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
293 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
294
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
295 {char buf[40];
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
296 sprintf(buf,"* using locale '%s'\n",pwplib.set.lang);
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
297 pwpwrite(buf);
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
298 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
299
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
300 if(!pwplib_initcore())
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
301 {
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
302 pwpwrite("initialization failed!\n");
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
303 return 0;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
304 }
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
305
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
306 if(pwplib.setup[SETUP_WANTHELP])
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
307 return 0;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
308
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
309 return 1;
acb5694e93d9 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
310 }