| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: x68kInit.c,v 1.8 2020/08/01 20:09:03 tsutsui Exp $ */ | | 1 | /* $NetBSD: x68kInit.c,v 1.9 2020/11/01 11:40:53 tsutsui Exp $ */ |
2 | /*------------------------------------------------------------------------- | | 2 | /*------------------------------------------------------------------------- |
3 | * Copyright (c) 1996 Yasushi Yamasaki | | 3 | * Copyright (c) 1996 Yasushi Yamasaki |
4 | * All rights reserved. | | 4 | * All rights reserved. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * | | 14 | * |
| @@ -65,29 +65,55 @@ ANY DAMAGES WHATSOEVER RESULTING FROM LO | | | @@ -65,29 +65,55 @@ ANY DAMAGES WHATSOEVER RESULTING FROM LO |
65 | PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | | 65 | PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
66 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | | 66 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH |
67 | THE USE OR PERFORMANCE OF THIS SOFTWARE. | | 67 | THE USE OR PERFORMANCE OF THIS SOFTWARE. |
68 | | | 68 | |
69 | *******************************************************/ | | 69 | *******************************************************/ |
70 | | | 70 | |
71 | #include <X11/Xos.h> | | 71 | #include <X11/Xos.h> |
72 | #include "x68k.h" | | 72 | #include "x68k.h" |
73 | #include "mi.h" | | 73 | #include "mi.h" |
74 | #include "extinit.h" | | 74 | #include "extinit.h" |
75 | | | 75 | |
76 | static int nscreens; | | 76 | static int nscreens; |
77 | | | 77 | |
| | | 78 | /* default log file paths */ |
| | | 79 | #ifndef DEFAULT_LOGDIR |
| | | 80 | #define DEFAULT_LOGDIR "/var/log" |
| | | 81 | #endif |
| | | 82 | #ifndef DEFAULT_LOGPREFIX |
| | | 83 | #define DEFAULT_LOGPREFIX "X68K." |
| | | 84 | #endif |
| | | 85 | |
78 | void | | 86 | void |
79 | OsVendorInit(void) | | 87 | OsVendorInit(void) |
80 | { | | 88 | { |
| | | 89 | static int inited; |
| | | 90 | |
| | | 91 | if (!inited) { |
| | | 92 | const char *logfile; |
| | | 93 | char *lf; |
| | | 94 | |
| | | 95 | #define LOGSUFFIX ".log" |
| | | 96 | #define LOGOLDSUFFIX ".old" |
| | | 97 | logfile = DEFAULT_LOGDIR "/" DEFAULT_LOGPREFIX; |
| | | 98 | if (asprintf(&lf, "%s%%s" LOGSUFFIX, logfile) == -1) |
| | | 99 | FatalError("Cannot allocate space for the log file name\n"); |
| | | 100 | LogInit(lf, LOGOLDSUFFIX); |
| | | 101 | #undef LOGSUFFIX |
| | | 102 | #undef LOGOLDSUFFIX |
| | | 103 | free(lf); |
| | | 104 | |
| | | 105 | inited = 1; |
| | | 106 | } |
81 | } | | 107 | } |
82 | | | 108 | |
83 | #ifdef GLXEXT | | 109 | #ifdef GLXEXT |
84 | void | | 110 | void |
85 | GlxExtensionInit(void) | | 111 | GlxExtensionInit(void) |
86 | { | | 112 | { |
87 | } | | 113 | } |
88 | #endif | | 114 | #endif |
89 | | | 115 | |
90 | /*------------------------------------------------------------------------- | | 116 | /*------------------------------------------------------------------------- |
91 | * function "InitOutput" [ called by DIX ] | | 117 | * function "InitOutput" [ called by DIX ] |
92 | * | | 118 | * |
93 | * purpose: initialize outputs ( screens ) | | 119 | * purpose: initialize outputs ( screens ) |
| @@ -168,26 +194,27 @@ AbortDDX(enum ExitCode error) | | | @@ -168,26 +194,27 @@ AbortDDX(enum ExitCode error) |
168 | int i; | | 194 | int i; |
169 | X68kScreenRec *screen; | | 195 | X68kScreenRec *screen; |
170 | X68kFbProcRec *fb; | | 196 | X68kFbProcRec *fb; |
171 | | | 197 | |
172 | /* give up SIGIO handling */ | | 198 | /* give up SIGIO handling */ |
173 | (void) OsSignal(SIGIO, SIG_IGN); | | 199 | (void) OsSignal(SIGIO, SIG_IGN); |
174 | | | 200 | |
175 | /* close all frame buffers */ | | 201 | /* close all frame buffers */ |
176 | for (i = 0; i < nscreens; i++) { | | 202 | for (i = 0; i < nscreens; i++) { |
177 | screen = x68kGetScreenRec(i); | | 203 | screen = x68kGetScreenRec(i); |
178 | fb = x68kGetFbProcRec(i); | | 204 | fb = x68kGetFbProcRec(i); |
179 | (*fb->close)(screen); | | 205 | (*fb->close)(screen); |
180 | } | | 206 | } |
| | | 207 | LogClose(error); |
181 | } | | 208 | } |
182 | | | 209 | |
183 | /*------------------------------------------------------------------------- | | 210 | /*------------------------------------------------------------------------- |
184 | * function "ddxGiveUp" [ called by DIX ] | | 211 | * function "ddxGiveUp" [ called by DIX ] |
185 | * | | 212 | * |
186 | * purpose: do nothing but call AbortDDX. | | 213 | * purpose: do nothing but call AbortDDX. |
187 | * argument: nothing | | 214 | * argument: nothing |
188 | * returns: nothing | | 215 | * returns: nothing |
189 | *-----------------------------------------------------------------------*/ | | 216 | *-----------------------------------------------------------------------*/ |
190 | void | | 217 | void |
191 | ddxGiveUp(enum ExitCode error) | | 218 | ddxGiveUp(enum ExitCode error) |
192 | { | | 219 | { |
193 | AbortDDX(error); | | 220 | AbortDDX(error); |