1 /*
2  *   appenv - Common header file for xmcd, cda and libdi.
3  *
4  *	xmcd  - Motif(R) CD Audio Player/Ripper
5  *	cda   - Command-line CD Audio Player/Ripper
6  *	libdi - CD Audio Device Interface Library
7  *
8  *
9  *   Copyright (C) 1993-2004  Ti Kan
10  *   E-mail: xmcd@amb.org
11  *
12  *   This program is free software; you can redistribute it and/or modify
13  *   it under the terms of the GNU General Public License as published by
14  *   the Free Software Foundation; either version 2 of the License, or
15  *   (at your option) any later version.
16  *
17  *   This program is distributed in the hope that it will be useful,
18  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
19  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  *   GNU General Public License for more details.
21  *
22  *   You should have received a copy of the GNU General Public License
23  *   along with this program; if not, write to the Free Software
24  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25  *
26  */
27 #ifndef __APPENV_H__
28 #define __APPENV_H__
29 
30 #ifndef lint
31 static char *_appenv_h_ident_ = "@(#)appenv.h	7.183 04/04/20";
32 #endif
33 
34 
35 /*
36  * Whether STATIC should really be...
37  */
38 #ifdef DEBUG
39 #define STATIC
40 #else
41 #define STATIC		static
42 #endif
43 
44 
45 /*
46  * Basic constants
47  */
48 #define STR_BUF_SZ	64			/* Generic string buf size */
49 #define ERR_BUF_SZ	512			/* Generic errmsg buf size */
50 #define FILE_PATH_SZ	256			/* Max file path length */
51 #define FILE_BASE_SZ	64			/* Max base name length */
52 #define HOST_NAM_SZ	64			/* Max host name length */
53 #define MAXTRACK	100			/* Max number of tracks */
54 #define LEAD_OUT_TRACK	0xaa			/* Lead-out track number */
55 #define STD_CDROM_BLKSZ	2048			/* Standard CD-ROM blocksize */
56 #define FRAME_PER_SEC	75			/* Frames per second */
57 #define MSF_OFFSET	150			/* Starting MSF offset */
58 #define MAX_VOL		100			/* Max logical audio volume */
59 
60 
61 /*
62  * Common header files to be included for all modules
63  */
64 
65 #ifndef __VMS
66 /* UNIX */
67 
68 /*
69  * General header files
70  */
71 #include <sys/types.h>
72 #include <sys/param.h>
73 
74 #ifndef NO_STDLIB_H
75 #include <stdlib.h>
76 #endif
77 #ifndef NO_UNISTD_H
78 #include <unistd.h>
79 #endif
80 
81 #include <stdio.h>
82 #include <ctype.h>
83 #include <errno.h>
84 #include <fcntl.h>
85 #include <signal.h>
86 #include <time.h>
87 #include <sys/time.h>
88 #include <sys/wait.h>
89 #include <sys/stat.h>
90 #include <sys/ioctl.h>
91 #include <sys/utsname.h>
92 #include <memory.h>
93 #include <dirent.h>
94 #include <pwd.h>
95 #include <grp.h>
96 
97 /*
98  * ----- Platform identification -----
99  * The following section consolidates complex platform identification
100  * into one place.
101  */
102 
103 /* Indentify a SunOS 4.x or SunOS 5.x (Solaris) platform */
104 #if defined(sun) || defined(__sun__)
105 #ifdef SVR4
106 #define _SOLARIS
107 #else
108 #define _SUNOS4
109 #endif
110 #endif
111 
112 /* Identify a Linux platform */
113 #if defined(linux) || defined(__linux__)
114 #define _LINUX
115 #endif
116 
117 /* Identify a Digital/Compaq/HP (Tru64) UNIX/OSF1 platform */
118 #if defined(__alpha) && defined(__osf__)
119 #define _OSF1
120 #endif
121 
122 /* Identify a Digital Ultrix platform */
123 #if defined(ultrix) || defined(__ultrix)
124 #define _ULTRIX
125 #endif
126 
127 /* Identify an SCO UNIX/Open Desktop/Open Server platform */
128 #if defined(sco) || defined(SCO) || defined(M_UNIX) || defined(_M_UNIX)
129 #define _SCO_SVR3
130 #endif
131 
132 /* Identify a UnixWare or Caldera Open UNIX platform */
133 #if (defined(SVR4) || defined(__svr4__) || \
134      defined(SVR5) || defined(__svr5__)) && \
135     (defined(i386) || defined(__i386__)) && \
136     !defined(_SOLARIS)
137 #define _UNIXWARE
138 #include <sys/scsi.h>		/* This is hacky */
139 #include <sys/sdi_edt.h>
140 #include <sys/sdi.h>
141 #if defined(PDI_VERSION) && (PDI_VERSION >= PDI_UNIXWARE20)
142 #define _UNIXWARE2		/* UnixWare 2 or later */
143 #endif
144 #endif
145 
146 #include "common_d/config.h"			/* Platform configuration */
147 
148 /*
149  * ----- End of platform identification -----
150  */
151 
152 #ifdef BSDCOMPAT
153 #include <strings.h>
154 #else
155 #include <string.h>
156 #endif
157 
158 #define PIPE		pipe
159 #define LINK		link
160 #define UNLINK		unlink
161 #define OPENDIR		opendir
162 #define READDIR		readdir
163 #define CLOSEDIR	closedir
164 
165 #ifdef NO_SETSID
166 #define SETSID		setpgrp
167 #else
168 #define SETSID		setsid
169 #endif
170 
171 #else
172 /* OpenVMS */
173 
174 #define NOMKTMPDIR			/* Do not create TEMP_DIR */
175 #define CADDR_T		1		/* To avoid redundant typedefs */
176 
177 #define _WSTOPPED	0177		/* Bit set if stopped */
178 #define _W_INT(i)	(i)
179 #define _WSTATUS(x)	(_W_INT(x) & _WSTOPPED)
180 
181 #define WIFSIGNALED(x)	(_WSTATUS(x) != _WSTOPPED && _WSTATUS(x) != 0)
182 #define WTERMSIG(x)	(WIFSIGNALED(x) ? _WSTATUS(x) : -1)
183 #define WIFEXITED(x)	(_WSTATUS(x) == 0)
184 #define WEXITSTATUS(x)	(WIFEXITED(x) ? ((_W_INT(x) >> 8) & 0377) : -1)
185 
186 /*
187  * General header files
188  */
189 #include <types.h>
190 
191 #ifndef NO_STDLIB_H
192 #include <stdlib.h>
193 #endif
194 #ifndef NO_UNISTD_H
195 #include <unistd.h>
196 #endif
197 
198 #include <stdio.h>
199 #include <ctype.h>
200 #include <errno.h>
201 #include <fcntl.h>
202 #include <signal.h>
203 #include <sys/time.h>
204 #include <times.h>
205 #include <stat.h>
206 #include <string.h>
207 #include <utsname.h>
208 #include <descrip.h>
209 #include <dvidef.h>
210 #include <lnmdef.h>
211 #include <processes.h>
212 
213 #ifndef __DEV_T
214 typedef unsigned int	uint_t;
215 typedef uint_t		uid_t;
216 typedef uint_t		gid_t;
217 typedef int		pid_t;
218 typedef uint_t		mode_t;
219 #endif
220 
221 #ifndef S_IXUSR
222 #define S_IXUSR		0000100
223 #endif
224 #ifndef S_IXGRP
225 #define S_IXGRP		0000010
226 #endif
227 #ifndef S_IXOTH
228 #define S_IXOTH		0000001
229 #endif
230 #ifndef S_IRUSR
231 #define S_IRUSR		0000400
232 #endif
233 
234 #ifndef SIGALRM
235 #define SIGALRM		14
236 #endif
237 
238 /* Prototype some external library functions */
239 extern uid_t		getuid(void);
240 extern gid_t		getgid(void);
241 extern int		setuid(uid_t),
242 			setgid(gid_t);
243 extern char		*getlogin(void);
244 extern int		usleep(unsigned int);
245 extern int		decc$pipe(int[2], int, int);
246 
247 /* _POSIX_C_SOURCE defines pipe with one argument, but the VMS
248  * implementation accepts a buffer size, which is nice to use.
249  */
250 #define PIPE(fds)	decc$pipe(fds, 0, 2048)
251 #define LINK		util_link
252 #define UNLINK		util_unlink
253 
254 #ifdef VMS_USE_OWN_DIRENT
255 
256 #define OPENDIR		util_opendir
257 #define READDIR		util_readdir
258 #define CLOSEDIR	util_closedir
259 
260 struct dirent {
261 	char		d_name[FILE_PATH_SZ];
262 };
263 
264 typedef struct {
265 	struct dirent	*dd_buf;
266 } DIR;
267 
268 #else
269 
270 #include <dirent.h>
271 
272 #define OPENDIR		opendir
273 #define READDIR		readdir
274 #define CLOSEDIR	closedir
275 
276 #endif	/* VMS_USE_OWN_DIRENT */
277 
278 #include "common_d/config.h"			/* Platform configuration */
279 
280 #endif	/* __VMS */
281 
282 
283 /*
284  * Define these just in case the OS does not support the POSIX definitions
285  */
286 #if defined(S_IFIFO) && !defined(S_ISFIFO)
287 #define S_ISFIFO(m)	(((m) & S_IFMT) == S_IFIFO)
288 #endif
289 #ifndef S_ISBLK
290 #define S_ISBLK(m)	(((m) & S_IFMT) == S_IFBLK)
291 #endif
292 #ifndef S_ISCHR
293 #define S_ISCHR(m)	(((m) & S_IFMT) == S_IFCHR)
294 #endif
295 #ifndef S_ISDIR
296 #define S_ISDIR(m)	(((m) & S_IFMT) == S_IFDIR)
297 #endif
298 #ifndef S_ISREG
299 #define S_ISREG(m)	(((m) & S_IFMT) == S_IFREG)
300 #endif
301 #ifndef SIGCHLD
302 #define SIGCHLD		SIGCLD
303 #endif
304 #ifndef ENAMETOOLONG
305 #define ENAMETOOLONG	78
306 #endif
307 
308 
309 /*
310  * Data type definitions: for portability
311  */
312 typedef char			bool_t;		/* Boolean */
313 typedef unsigned char		byte_t;		/* 8-bit unsigned */
314 typedef signed char		sbyte_t;	/* 8-bit signed */
315 typedef unsigned short		word16_t;	/* 16-bit unsigned */
316 typedef signed short		sword16_t;	/* 16-bit signed */
317 typedef unsigned int		word32_t;	/* 32-bit unsigned */
318 typedef signed int		sword32_t;	/* 32-bit signed */
319 
320 #ifdef __alpha
321 #ifdef __VMS
322 typedef unsigned long long	word64_t;	/* 64-bit unsigned */
323 typedef signed long long	sword64_t;	/* 64-bit signed */
324 #else
325 typedef unsigned long		word64_t;	/* 64-bit unsigned */
326 typedef signed long		sword64_t;	/* 64-bit signed */
327 #endif	/* __VMS */
328 #else
329 #if (defined(__GNUC__) && __GNUC__ > 1) || defined(HAS_LONG_LONG)
330 typedef unsigned long long	word64_t;	/* 64-bit unsigned */
331 typedef signed long long	sword64_t;	/* 64-bit signed */
332 #else
333 #define FAKE_64BIT
334 typedef struct { word32_t v[2]; } word64_t;	/* 64-bit unsigned */
335 typedef struct { word32_t v[2]; } sword64_t;	/* 64-bit signed */
336 #endif	/* __GNUC__ HAS_LONG_LONG */
337 #endif
338 
339 /* Variable assignment macro for 64-bit targets */
340 #ifdef FAKE_64BIT
341 #define ASSIGN64(x)		util_assign64(x)
342 #define ASSIGN32(x)		util_assign32(x)
343 #else
344 #define ASSIGN64(x)		((word64_t) (x))
345 #define ASSIGN32(x)		((word32_t) (x))
346 #endif
347 
348 
349 /*
350  * Endianess
351  */
352 #define _L_ENDIAN_	1234
353 #define _B_ENDIAN_	4321
354 
355 #if defined(i286) || defined(__i286__) || \
356     defined(i386) || defined(__i386__) || \
357     defined(i486) || defined(__i486__) || \
358     defined(__alpha) || defined(__alpha__) || \
359     defined(vax) || defined(__vax__) || \
360     (defined(MIPSEL) || defined(__MIPSEL__) || \
361      defined(__MIPSEL) || defined(_MIPSEL)) || \
362     (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
363 #define _BYTE_ORDER_	_L_ENDIAN_
364 #else
365 #define _BYTE_ORDER_	_B_ENDIAN_
366 #endif
367 
368 
369 /*
370  * Platform-specific stuff
371  */
372 #if defined(macII) || defined(sony_news)
373 
374 #ifndef WEXITSTATUS
375 #define WEXITSTATUS(x)	(((x.w_status) >> 8) & 0377)
376 #endif
377 #ifndef WTERMSIG
378 #define WTERMSIG(x)	((x.w_status) & 0177)
379 #endif
380 
381 typedef union wait	waitret_t;
382 
383 #else	/* macII */
384 
385 typedef int		waitret_t;
386 
387 #endif	/* macII */
388 
389 
390 #ifdef __VMS
391 #define WAITPID			util_waitpid
392 #else
393 #ifdef sony_news
394 typedef int			pid_t;
395 typedef int			mode_t;
396 #define WAITPID(pid, svp, op)	wait4(pid, svp, 0, 0)
397 #else
398 #define WAITPID			waitpid
399 #endif	/* sony_news */
400 #endif	/* __VMS */
401 
402 
403 #if defined(macII) || defined(sony_news)
404 #define MKFIFO(path, mode)	mknod((path), S_IFIFO | (mode), 0)
405 #else
406 #define MKFIFO(path, mode)	mkfifo((path), (mode))
407 #endif
408 
409 
410 #ifdef __VMS
411 #define FORK		vfork
412 #else
413 #define FORK		fork
414 #endif
415 
416 
417 #if defined(S_IFLNK) && !defined(__VMS)
418 #define LSTAT		lstat
419 #else
420 #define LSTAT		stat
421 #endif
422 
423 
424 #ifdef BSDCOMPAT
425 #ifndef strchr
426 #define strchr		index
427 #endif
428 #ifndef strrchr
429 #define strrchr		rindex
430 #endif
431 #endif	/* BSDCOMPAT */
432 
433 
434 /*
435  * Errno compatibility
436  */
437 #if !defined(ETIME) && defined(ETIMEDOUT)
438 #define ETIME		ETIMEDOUT
439 #endif
440 
441 
442 /*
443  * Boolean flags
444  */
445 #ifndef FALSE
446 #define FALSE		0
447 #endif
448 #ifndef TRUE
449 #define TRUE		1
450 #endif
451 
452 
453 /*
454  * File path definitions
455  */
456 #ifndef __VMS
457 #define TEMP_DIR	"/tmp/.cdaudio"		/* Temporary directory */
458 #define SYS_CMCFG_PATH	"%s/config/common.cfg"	/* System common cfg file */
459 #define USR_CFG_PATH	"%s/.xmcdcfg"		/* User config dir */
460 #define USR_PROG_PATH	"%s/.xmcdcfg/prog"	/* User track prog dir */
461 #define USR_CMCFG_PATH	"%s/.xmcdcfg/common.cfg"/* User common cfg file */
462 #define SYS_DSCFG_PATH	"%s/config/%s"		/* System devspec cfg file */
463 #define USR_DSCFG_PATH	"%s/.xmcdcfg/%s"	/* User devspec cfg file */
464 #define USR_VINIT_PATH	"%s/.xmcdcfg/%s"	/* User version init file */
465 #define USR_HIST_PATH	"%s/.xmcdcfg/history"	/* User xmcd history file */
466 #define USR_RMTLOG_PATH	"%s/.xmcdcfg/remote.log"/* User xmcd rmtlog file */
467 #define REL_DBDIR_PATH  "%s/cdinfo/%s"		/* CD info rel dir path */
468 #define CDINFOFILE_PATH	"%s/%08x"		/* CD info file path */
469 #define HELPFILE_PATH	"%s/help/%s"		/* Help file path */
470 #define DOCFILE_PATH	"%s/docs/"		/* Documentation file path */
471 #define CONCAT_PATH	"%s/%s"			/* Concatenation of path */
472 #else
473 #define TEMP_DIR	"SYS$LOGIN:TMP.DIR"	/* Temporary directory */
474 #define USR_CFG_PATH	"%s.xmcdcfg]"		/* User config dir */
475 #define USR_PROG_PATH	"%s.xmcdcfg.prog"	/* User track prog dir */
476 #define SYS_CMCFG_PATH	"%s]common.cfg"		/* System common cfg file */
477 #define USR_CMCFG_PATH	"%s.xmcdcfg]common.cfg"	/* User common cfg file */
478 #define SYS_DSCFG_PATH	"%s]%s"			/* System devspec cfg file */
479 #define USR_DSCFG_PATH	"%s.xmcdcfg]%s"		/* User devspec cfg file */
480 #define USR_VINIT_PATH	"%s.xmcdcfg]%s"		/* User version init file */
481 #define USR_HIST_PATH	"%s.xmcdcfg]history"	/* User xmcd history file */
482 #define USR_RMTLOG_PATH	"%s.xmcdcfg]remote.log"	/* User xmcd rmtlog file */
483 #define REL_DBDIR_PATH  "%s.cdinfo.%s]"		/* CD info rel dir path */
484 #define CDINFOFILE_PATH	"%s%08x."		/* CD info file path */
485 #define HELPFILE_PATH	"%s.help.%s"		/* Help file path */
486 #define DOCFILE_PATH	"%s.docs]"		/* Documentation file path */
487 #define CONCAT_PATH	"%s%s"			/* Concatenation of path */
488 #endif
489 
490 
491 /*
492  * URL template attribute information
493  */
494 typedef struct url_attrib {
495 	int		xcnt;			/* Count of %X */
496 	int		vcnt;			/* Count of %V */
497 	int		ncnt;			/* Count of %N */
498 	int		hcnt;			/* Count of %H */
499 	int		lcnt;			/* Count of %L */
500 	int		ccnt;			/* Count of %C */
501 	int		icnt;			/* Count of %I */
502 	int		acnt;			/* Count of %A and %a */
503 	int		dcnt;			/* Count of %D and %d */
504 	int		rcnt;			/* Count of %R and %r */
505 	int		tcnt;			/* Count of %T and %t */
506 	int		pcnt;			/* Count of %# */
507 } url_attrib_t;
508 
509 
510 /*
511  * Defines for channel routing modes
512  */
513 #define CHROUTE_NORMAL		0		/* Normal stereo */
514 #define CHROUTE_REVERSE		1		/* Reverse stereo */
515 #define CHROUTE_L_MONO		2		/* Left channel mono */
516 #define CHROUTE_R_MONO		3		/* Right channel mono */
517 #define CHROUTE_MONO		4		/* Left+Right channel mono */
518 
519 
520 /*
521  * Defines for volume control taper
522  */
523 #define VOLTAPER_LINEAR		0		/* Linear taper */
524 #define VOLTAPER_SQR		1		/* Square taper */
525 #define VOLTAPER_INVSQR		2		/* Inverse square */
526 
527 
528 /*
529  * Defines for the type field in trkinfo_t
530  */
531 #define TYP_AUDIO		1		/* Audio track */
532 #define TYP_DATA		2		/* Data track */
533 
534 /*
535  * Defines for the mode field in curstat_t
536  */
537 #define MOD_NODISC		0		/* No disc loaded */
538 #define MOD_PLAY		1		/* Play mode */
539 #define MOD_PAUSE		2		/* Pause mode */
540 #define MOD_STOP		3		/* Stop mode */
541 #define MOD_SAMPLE		4		/* Sample mode */
542 #define MOD_BUSY		5		/* Drive is busy */
543 
544 /*
545  * Defines for the segplay field in curstat_t
546  */
547 #define SEGP_NONE		0		/* Normal play state */
548 #define SEGP_A			1		/* a->? state */
549 #define SEGP_AB			2		/* a->b state */
550 
551 
552 /*
553  * Defines for the flags field in curstat_t
554  */
555 #define STAT_SUBMIT		0x01		/* Submit info before clear */
556 #define STAT_EJECT		0x02		/* Eject CD after clear */
557 #define STAT_EXIT		0x04		/* Exit program after clear */
558 #define STAT_CHGDISC		0x08		/* Change disc after clear */
559 
560 
561 /*
562  * Defines for the time_dpy field in curstat_t
563  */
564 #define TIMEDPY_MAX_MODES	6		/* Max number of modes */
565 #define T_ELAPSED_TRACK		0		/* Per-track elapsed time */
566 #define T_ELAPSED_SEG		1		/* Per-seg elapsed time */
567 #define T_ELAPSED_DISC		2		/* Whole-disc elapsed time */
568 #define T_REMAIN_TRACK		3		/* Per-track remaining time */
569 #define T_REMAIN_SEG		4		/* Per-seg remaining time */
570 #define T_REMAIN_DISC		5		/* Whole-disc remaining time */
571 
572 /*
573  * Defines for the qmode field in curstat_t
574  */
575 #define QMODE_NONE		0		/* No status */
576 #define QMODE_WAIT		1		/* Waiting for CD info */
577 #define QMODE_MATCH		2		/* CD info match found */
578 #define QMODE_ERR		3		/* CD info error */
579 
580 /*
581  * Defines for the status field in cdstat_t
582  */
583 #define CDSTAT_PLAYING		0x11		/* Audio play in progress */
584 #define CDSTAT_PAUSED		0x12		/* Audio play paused */
585 #define CDSTAT_COMPLETED	0x13		/* Audio play completed */
586 #define CDSTAT_FAILED		0x14		/* Audio play error */
587 #define CDSTAT_NOSTATUS		0x15		/* No audio status */
588 
589 /*
590  * Defines for the play_mode field in appdata_t
591  * More than one CDDA mode can be enabled at a time.
592  */
593 #define PLAYMODE_STD		0x00		/* Standard playback mode */
594 #define PLAYMODE_CDDA		0x01		/* CDDA playback mode */
595 #define PLAYMODE_FILE		0x02		/* CDDA save-to-file mode */
596 #define PLAYMODE_PIPE		0x04		/* CDDA pipe-to-program mode */
597 
598 #define PLAYMODE_IS_STD(x)	((x) == 0)
599 #define PLAYMODE_IS_CDDA(x)	((x) != 0)
600 
601 /*
602  * Defines for the cdda_filefmt field in appdata_t
603  */
604 #define FILEFMT_RAW		0		/* RAW (headerless) format */
605 #define FILEFMT_AU		1		/* AU format */
606 #define FILEFMT_WAV		2		/* WAV format */
607 #define FILEFMT_AIFF		3		/* AIFF format */
608 #define FILEFMT_AIFC		4		/* AIFF-C format */
609 #define FILEFMT_MP3		5		/* MPEG-1 Layer 3 format */
610 #define FILEFMT_OGG		6		/* Ogg Vorbis format */
611 #define FILEFMT_FLAC		7		/* FLAC format */
612 #define FILEFMT_AAC		8		/* AAC (MPEG-2,4) format */
613 #define FILEFMT_MP4		9		/* MP4 format */
614 #define MAX_FILEFMTS		10		/* Max number of formats */
615 
616 /* Default CDDA output file path templates */
617 #define FILEPATH_DISC		"%A-%D"		/* For whole disc */
618 #define FILEPATH_TRACK		"%#-%T"		/* For each track */
619 
620 /* Defines for the lameopts_mode field in appdata_t */
621 #define LAMEOPTS_DISABLE	0		/* Disable */
622 #define LAMEOPTS_INSERT		1		/* Insert before std opts */
623 #define LAMEOPTS_APPEND		2		/* Append after std opts */
624 #define LAMEOPTS_REPLACE	3		/* Replace std opts */
625 
626 /*
627  * Defines for the chset_xlat field in appdata_t
628  */
629 #define CHSET_XLAT_NONE		0		/* No translation */
630 #define CHSET_XLAT_ISO8859	1		/* UTF-8 <-> ISO8859 */
631 #define CHSET_XLAT_ICONV	2		/* Use iconv(3) */
632 
633 
634 /*
635  * CD position MSF structure
636  */
637 typedef struct msf {
638 	byte_t		res;		/* reserved */
639 	byte_t		min;		/* minutes */
640 	byte_t		sec;		/* seconds */
641 	byte_t		frame;		/* frame */
642 } msf_t;
643 
644 
645 /*
646  * Combined MSF and logical address union
647  */
648 typedef union lmsf {
649 	msf_t		msf;		/* MSF address */
650 	sword32_t	logical;	/* logical address */
651 } lmsf_t;
652 
653 
654 /*
655  * CD per-track information
656  */
657 typedef struct {
658 	sword32_t	trkno;			/* Track number */
659 	sword32_t	addr;			/* Absolute offset block */
660 	byte_t		min;			/* Absolute offset minutes */
661 	byte_t		sec;			/* Absolute offset seconds */
662 	byte_t		frame;			/* Absolute offset frame */
663 	byte_t		type;			/* track type */
664 	sword32_t	playorder;		/* Prog/Shuf sequence */
665 	char		*outfile;		/* Cooked audio file paths */
666 	char		isrc[16];		/* ISRC */
667 } trkinfo_t;
668 
669 
670 /*
671  * CD position information
672  */
673 typedef struct {
674 	sword32_t	addr;
675 	byte_t		min;
676 	byte_t		sec;
677 	byte_t		frame;
678 	byte_t		pad;
679 } cdpos_t;
680 
681 
682 /* CDDA status structure */
683 typedef struct {
684 	byte_t		status;			/* Play status */
685 	byte_t		track;			/* Track number */
686 	byte_t		index;			/* Index number */
687 	byte_t		rsvd;			/* reserved */
688 	cdpos_t		abs_addr;		/* Absolute address */
689 	cdpos_t		rel_addr;		/* Track-relative address */
690 	byte_t		level;			/* Current volume level */
691 	byte_t		level_left;		/* Current left volume % */
692 	byte_t		level_right;		/* Current right volume % */
693 	byte_t		rsvd2;			/* reserved */
694 	word32_t	tot_frm;		/* Total frames */
695 	word32_t	frm_played;		/* Frames played */
696 	word32_t	frm_per_sec;		/* Frames per sec */
697 } cdstat_t;
698 
699 
700 /*
701  * Structure containing current status information
702  */
703 typedef struct {
704 	char		*curdev;		/* Current device */
705 	byte_t		mode;			/* Player mode */
706 	byte_t		segplay;		/* a->b mode state */
707 	byte_t		time_dpy;		/* Time display state */
708 	byte_t		flags;			/* State flags */
709 
710 	sword32_t	first_disc;		/* First disc */
711 	sword32_t	last_disc;		/* Last disc */
712 	sword32_t	cur_disc;		/* Current disc */
713 	sword32_t	prev_disc;		/* Previous disc */
714 	sword32_t	first_trk;		/* First track */
715 	sword32_t	last_trk;		/* Last track */
716 	sword32_t	tot_trks;		/* Total number of tracks */
717 
718 	sword32_t	cur_trk;		/* Current track */
719 	sword32_t	cur_idx;		/* Current index */
720 
721 	cdpos_t		discpos_tot;		/* Total CD size */
722 	cdpos_t		curpos_tot;		/* Current absolute pos */
723 	cdpos_t		curpos_trk;		/* Current trk relative pos */
724 	cdpos_t		bp_startpos_tot;	/* Block play start abs pos */
725 	cdpos_t		bp_endpos_tot;		/* Block play end abs pos */
726 	cdpos_t		bp_startpos_trk;	/* Block play start trk pos */
727 	cdpos_t		bp_endpos_trk;		/* Block play end trk pos */
728 
729 	char		mcn[16];		/* Media catalog number */
730 	byte_t		aux[4];			/* Auxiliary */
731 
732 	sword32_t	sav_iaddr;		/* Saved index abs frame */
733 	word32_t	tot_frm;		/* Total frames */
734 	word32_t	frm_played;		/* Frames played */
735 	word32_t	frm_per_sec;		/* Frames per second */
736 	word32_t	rptcnt;			/* Repeat iteration count */
737 
738 	trkinfo_t	trkinfo[MAXTRACK];	/* Per-track information */
739 
740 	bool_t		devlocked;		/* Device locked */
741 	bool_t		repeat;			/* Repeat mode */
742 	bool_t		shuffle;		/* Shuffle mode */
743 	bool_t		program;		/* Program mode */
744 	bool_t		onetrk_prog;		/* Trk list 1-track program */
745 	bool_t		caddy_lock;		/* Caddy lock */
746 	bool_t		chgrscan;		/* Changer scan in process */
747 	bool_t		rsvd0;			/* reserved */
748 	byte_t		qmode;			/* CD info query mode */
749 	byte_t		prog_tot;		/* Prog/Shuf total tracks */
750 	byte_t		prog_cnt;		/* Prog/Shuf track counter */
751 	byte_t		level;			/* Current volume level */
752 	byte_t		level_left;		/* Left channel vol percent */
753 	byte_t		level_right;		/* Right channel vol percent */
754 	byte_t		cdda_att;		/* CDDA attentuator percent */
755 	byte_t		rsvd1;			/* reserved */
756 	char		*outf_tmpl;		/* Audio file path template */
757 	char		vendor[9];		/* CD-ROM drive vendor */
758 	char		prod[17];		/* CD-ROM drive model */
759 	char		revnum[5];		/* CD-ROM firmware revision */
760 } curstat_t;
761 
762 
763 /* flags bits that control when to generate local discography file
764  * This is for the app_data.discog_mode parameter
765  */
766 #define DISCOG_GEN_CDINFO	0x1	/* After a successful CD info load */
767 #define DISCOG_GEN_WWWWARP	0x2	/* When user invokes local discog */
768 
769 
770 /* This is for the app_data.comp_mode parameter */
771 #define COMPMODE_0		0	/* Format-specific */
772 #define COMPMODE_1		1	/* Format-specific */
773 #define COMPMODE_2		2	/* Format-specific */
774 #define COMPMODE_3		3	/* Format-specific */
775 
776 
777 /* This is for the app_data.chan_mode parameter */
778 #define CH_STEREO		0	/* Stereo */
779 #define CH_JSTEREO		1	/* Joint-stereo */
780 #define CH_FORCEMS		2	/* Forced mid/side-stereo */
781 #define CH_MONO			3	/* Mono */
782 
783 /* This is for the app_data.id3tag_mode parameter */
784 #define ID3TAG_V1		0x1	/* ID3 tag version 1 */
785 #define ID3TAG_V2		0x2	/* ID3 tag version 2 */
786 #define ID3TAG_BOTH		0x3	/* ID3 tag both versions */
787 
788 /* This is for the app_data.lowpass_mode and app_data.highpass_mode fields */
789 #define FILTER_OFF		0	/* Off */
790 #define FILTER_AUTO		1	/* Auto */
791 #define FILTER_MANUAL		2	/* Manual */
792 
793 #define MIN_LOWPASS_FREQ	16	/* Minimum lowpass filter frequency */
794 #define MAX_LOWPASS_FREQ	50000	/* Maximum lowpass filter frequency */
795 #define MIN_HIGHPASS_FREQ	500	/* Minimum highpass filter frequency */
796 #define MAX_HIGHPASS_FREQ	50000	/* Maximum highpass filter frequency */
797 
798 
799 /*
800  * Default message strings
801  */
802 #define MAIN_TITLE		"xmcd"
803 #define STR_LOCAL		"local"
804 #define STR_CDDB		"CDDB\262"
805 #define STR_CDTEXT		"CDtext"
806 #define STR_QUERY		"query"
807 #define STR_PROGMODE		"prog"
808 #define STR_ELAPSE		"elapse"
809 #define STR_ELAPSE_SEG		"e-seg"
810 #define STR_ELAPSE_DISC		"e-disc"
811 #define STR_REMAIN_TRK		"r-trac"
812 #define STR_REMAIN_SEG		"r-seg"
813 #define STR_REMAIN_DISC		"r-disc"
814 #define STR_PLAY		"play"
815 #define STR_PAUSE		"pause"
816 #define STR_READY		"ready"
817 #define STR_SAMPLE		"samp"
818 #define STR_USAGE		"Usage:"
819 #define STR_BADOPTS		"The following option is unrecognized"
820 #define STR_NODISC		"no disc"
821 #define STR_BUSY		"cd busy"
822 #define STR_UNKNARTIST		"unknown artist"
823 #define STR_UNKNDISC		"unknown disc title"
824 #define STR_UNKNTRK		"unknown track title"
825 #define STR_DATA		"data"
826 #define STR_INFO		"Information"
827 #define STR_WARNING		"Warning"
828 #define STR_FATAL		"Fatal Error"
829 #define STR_CONFIRM		"Confirm"
830 #define STR_WORKING		"Working"
831 #define STR_ABOUT		"About"
832 #define STR_QUIT		"Really Quit?"
833 #define STR_ASKPROCEED		"Do you want to proceed?"
834 #define STR_CLRPROG		"The play program will be cleared."
835 #define STR_CANCELSEG		"Segment play will be canceled."
836 #define STR_RESTARTPLAY		"Playback will be restarted."
837 #define STR_NOMEMORY		"Out of memory!"
838 #define STR_TMPDIRERR		"Cannot create or access directory %s!"
839 #define STR_LIBDIRERR		\
840 "Cannot determine the xmcd library directory.\n\
841 You cannot run the program without going through a full installation.\n\
842 If you downloaded the binary distribution from the official xmcd web site,\n\
843 be sure to read the installation procedure displayed on the web.\n\
844 If you compiled xmcd/cda from source, be sure to read the INSTALL file for\n\
845 installation instructions."
846 #define STR_LONGPATHERR		"Path or message too long."
847 #define STR_NOMETHOD		"Unsupported deviceInterfaceMethod parameter!"
848 #define STR_NOVU		"Unsupported driveVendorCode parameter!"
849 #define STR_NOHELP		"The help file on this topic is not installed!"
850 #define STR_NOCFG		"Cannot open configuration file \"%s\"."
851 #define STR_NOINFO		"No information available."
852 #define STR_NOTROM		"Device is not a CD-ROM!"
853 #define STR_NOTSCSI2		"Device is not SCSI-II compliant."
854 #define STR_SUBMIT		"Submit current disc information to CDDB?"
855 #define STR_SUBMITOK		"Submission to CDDB succeeded."
856 #define STR_SUBMITCORR		\
857 "CDDB has found an inexact match.\n\
858 If this is not the correct album,\n\
859 please submit corrections."
860 #define STR_SUBMITERR		"Submission to CDDB failed."
861 #define STR_MODERR		"Binary permissions error."
862 #define STR_STATERR		"Cannot stat device \"%s\"."
863 #define STR_NODERR		"\"%s\" is not the appropriate device type!"
864 #define STR_SEQFMTERR		"Program sequence string format error."
865 #define STR_INVPGMTRK		"Invalid track(s) deleted from program."
866 #define STR_RECOVERR		"Recovering from audio playback error..."
867 #define STR_MAXERR		"Too many errors."
868 #define STR_SAVERR_FORK		"File not saved:\nCannot fork. (errno %d)"
869 #define STR_SAVERR_SUID		"File not saved:\nCannot setuid to %d."
870 #define STR_SAVERR_OPEN		"File not saved:\nCannot open file for writing."
871 #define STR_SAVERR_CLOSE	"File not saved:\nCannot save file."
872 #define STR_SAVERR_WRITE	"File save error!"
873 #define STR_SAVERR_KILLED	"File not saved:\nChild killed. (signal %d)"
874 #define STR_CHGSUBMIT		\
875 "%s\n%s\n\n\
876 The on-screen CD database information has changed.\n\
877 Do you want to submit it to CDDB now?"
878 #define STR_DEVLIST_UNDEF	"The deviceList parameter is undefined."
879 #define STR_DEVLIST_COUNT	\
880 "The number of devices in the deviceList parameter is incorrect."
881 #define STR_MEDCHG_NOINIT	\
882 "Cannot initialize medium changer device:\n\
883 Running as a single-disc player"
884 #define STR_AUTHFAIL		\
885 "Proxy authorization failed.\n\
886 Do you want to re-enter your user name and password?"
887 #define STR_NOCLIENT		"Not running on display"
888 #define STR_UNSUPPCMD		"Unsupported command"
889 #define STR_BADARG		"The specified argument is invalid"
890 #define STR_INVCMD		"Invalid command for the current state"
891 #define STR_CMDFAIL		"Command failed"
892 #define STR_RMT_NOTENB		"Remote control is not enabled"
893 #define STR_RMT_NOCMD		"Remote control: No command specified"
894 #ifdef __VMS
895 #define STR_APPDEF		\
896 "The XMCD.DAT resource file cannot be located, or is the wrong\n\
897 version.  A correct version of this file must be present in the\n\
898 appropriate directory in order for xmcd to run.  Please check\n\
899 your xmcd installation."
900 #else
901 #define STR_APPDEF		\
902 "The app-defaults/XMcd file cannot be located, or is the wrong version.\n\
903 You cannot run xmcd without going through a full installation.\n\
904 If you downloaded the binary distribution from the official xmcd web site,\n\
905 be sure to read the installation procedure displayed on the web.\n\
906 If you compiled xmcd/cda from source, be sure to read the INSTALL file for\n\
907 installation instructions."
908 #endif
909 #define STR_KPMODEDSBL		\
910 "The %s mode is enabled.\n\
911 Using the keypad will disable it."
912 #define STR_DLIST_DELALL	\
913 "This will delete all entries of your disc history."
914 #define STR_CHGRSCAN		"Scanning CD changer slots..."
915 #define STR_THE			"The"
916 #define STR_NONEOFABOVE		"None of the above"
917 #define STR_ERROR		"error"
918 #define STR_HANDLEREQ		"You must enter a user handle."
919 #define STR_HANDLEERR		\
920 "Either you got your password wrong, or someone else\n\
921 is already using this handle.\n\n\
922 Please re-enter the user handle and/or password,\n\
923 or click the \"E-mail to me\" button to have your\n\
924 password hint sent to you via e-mail."
925 #define STR_PASSWDREQ		"You must enter a password."
926 #define STR_PASSWDMATCHERR	"The passwords do not match.  Try again."
927 #define STR_MAILINGHINT		"Your password hint is being e-mailed to you."
928 #define STR_UNKNHANDLE		\
929 "CDDB does not have a record of this user handle.\n\
930 Try again."
931 #define STR_NOHINT		\
932 "You did not specify a hint when you first registered.\n\
933 There is nothing to e-mail to you."
934 #define STR_NOMAILHINT		\
935 "You did not specify a e-mail address when you first registered.\n\
936 CDDB cannot e-mail your password hint to you."
937 #define STR_HINTERR		"Failed to get password hint."
938 #define STR_USERREGFAIL		"User registration failed."
939 #define STR_NOWWWWARP		\
940 "No wwwWarp menu was set up in the wwwwarp.cfg file."
941 #define STR_CANNOTINVOKE	"Cannot invoke \"%s\""
942 #define STR_STOPLOAD		"Stop CD information load?"
943 #define STR_RELOAD		"Re-load CD information?"
944 #define STR_NEEDROLE		"You must select a role."
945 #define STR_NEEDROLENAME	"You must enter a name for the specified role."
946 #define STR_DUPCREDIT		"This credit is already in the list."
947 #define STR_DUPTRKCREDIT	\
948 "This credit is a duplicate of a track credit (track %s).\n\
949 Since an album credit applies to all tracks, it is\n\
950 ambiguous to have a track credit to be the same as\n\
951 the album credit."
952 #define STR_DUPDISCCREDIT	\
953 "This credit is a duplicate of an album credit.\n\
954 Since an album credit applies to all tracks, it is\n\
955 ambiguous to have a track credit to be the same as\n\
956 the album credit."
957 #define STR_NOFIRST		\
958 "The last name is filled in but the first name is not."
959 #define STR_NOFIRSTLAST		\
960 "\"The\" is enabled, but there is no text in the first name\n\
961 field or the last name field."
962 #define STR_ALBUMARTIST		"Album artist"
963 #define STR_TRACKARTIST		"Track %d artist"
964 #define STR_CREDIT		"Credit"
965 #define STR_FNAMEGUIDE \
966 "Click mouse button 3 on any field for usage guidelines"
967 #define STR_NOCATEG		"You must enter category information."
968 #define STR_NONAME		"You must enter a name for the site."
969 #define STR_INVALURL		"The URL is not valid."
970 #define STR_SEGPOSERR		\
971 "The end position must be at least a number of\n\
972 frames past the start position."
973 #define STR_INCSEGINFO		\
974 "Incomplete segment information.\n\
975 You must enter a segment name, and the start\n\
976 and end point track and frame numbers."
977 #define STR_INVSEGINFO		\
978 "Invalid segment information.\n\
979 Check the start and end point track and frame\n\
980 numbers."
981 #define STR_DISCARDCHG		"Do you want to discard your changes?"
982 #define STR_NOAUDIOPATH		"No output audio file name specified."
983 #define STR_AUDIOPATHEXISTS	"Cannot write audio file: file exists."
984 #define STR_PLAYBACKMODE	"Playback mode"
985 #define STR_ENCODEPARMS		"Encoding parameters"
986 #define STR_LAMEOPTS		"LAME MP3 options"
987 #define STR_SCHEDPARMS		"CDDA scheduling"
988 #define STR_AUTOFUNCS		"Automated functions"
989 #define STR_CDCHANGER		"CD changer"
990 #define STR_CHROUTE		"Channel routing"
991 #define STR_VOLBAL		"Volume & Balance"
992 #define STR_CDDB_CDTEXT		"CDDB & CD-Text"
993 #define STR_CDDAINIT_FAIL	\
994 "Cannot initialize CDDA.  Possible causes are:\n\n\
995 - An error condition as described above, if displayed.\n\
996 - The cddaMethod, cddaReadMethod or cddaWriteMethod\n\
997   parameters may be misconfigured.\n\
998 - There is no CDDA support for your CD drive or\n\
999   OS platform in this version.\n\n\
1000 See your xmcd documentation for information."
1001 #define STR_FILENAMEREQ		"You must select or enter a file name."
1002 #define STR_NOTREGFILE		\
1003 "The file name you selected or entered\n\
1004 is not a regular file."
1005 #define STR_NOPROG		"CDDA pipe to program: No program specified."
1006 #define STR_OVERWRITE		\
1007 "The file exists in the output directory.\n\
1008 Do you want to overwrite it?"
1009 #define STR_OUTDIR		\
1010 "CDDA save to file: Writing audio files in the following directory:"
1011 #define STR_PATHEXP		\
1012 "CDDA save to file: The expanded output file path name:"
1013 #define STR_INVBR_MINMEAN	\
1014 "Invalid minimum bitrate: It must be less than\n\
1015 or equal to the average bitrate."
1016 #define STR_INVBR_MINMAX	\
1017 "Invalid minimum bitrate: It must be less than\n\
1018 or equal to the maximum bitrate."
1019 #define STR_INVBR_MAXMEAN	\
1020 "Invalid maximum bitrate: It must be greater than\n\
1021 or equal to the average bitrate."
1022 #define STR_INVBR_MAXMIN	\
1023 "Invalid maximum bitrate: It must be greater than\n\
1024 or equal to the minimum bitrate."
1025 #define STR_INVFREQ_LP		\
1026 "Invalid lowpass filter frequency.\n\
1027 The valid range is %d to %d Hz."
1028 #define STR_INVFREQ_HP		\
1029 "Invalid highpass filter frequency.\n\
1030 The valid range is %d to %d Hz."
1031 #define STR_NOMSG		"No messages."
1032 
1033 /*
1034  * Application resource/option data
1035  */
1036 typedef struct {
1037 	char		*libdir;		/* Library path */
1038 
1039 	/* X resources */
1040 	char		*version;		/* app-defaults file version */
1041 	int		main_mode;		/* Default main window mode */
1042 	int		modechg_grav;		/* Which corner is fixed */
1043 	int		normal_width;		/* Normal mode width */
1044 	int		normal_height;		/* Normal mode height */
1045 	int		basic_width;		/* Basic mode width */
1046 	int		basic_height;		/* Basic mode height */
1047 	int		blinkon_interval;	/* Display blink on (ms) */
1048 	int		blinkoff_interval;	/* Display blink off (ms) */
1049 	bool_t		main_showfocus;		/* Highlight kbd focus? */
1050 	bool_t		instcmap;		/* Install colormap? */
1051 	bool_t		remotemode;		/* Remote ctrl mode */
1052 	bool_t		rsvd;			/* reserved */
1053 	char		*remotehost;		/* Remote ctrl client host */
1054 
1055 	/*
1056 	 * Common config parameters
1057 	 */
1058 	char		*device;		/* Default CD-ROM device */
1059 	char		*cdinfo_path;		/* CD info paths */
1060 	char		*cdinfo_filemode;	/* CD info file permissions */
1061 	char		*proxy_server;		/* http proxy host:port */
1062 	char		*hist_filemode;		/* History file permissions */
1063 	char		*exclude_words;		/* Keywords to exclude */
1064 	char		*cdda_tmpl;		/* CDDA output file template */
1065 	char		*pipeprog;		/* Pgm to pipe audio data to */
1066 	char		*lame_opts;		/* Direct LAME cmdline */
1067 	char		*discog_url_pfx;	/* Local discog URL prefix */
1068 	char		*lang_utf8;		/* The LANG env for UTF-8 */
1069 
1070 	int		chset_xlat;		/* Charset translation mode */
1071 	int		cache_timeout;		/* Local cache timeout (days)*/
1072 	int		srv_timeout;		/* Service timeout (secs) */
1073 	int		discog_mode;		/* Local discography mode */
1074 	int		cdinfo_maxhist;		/* Max history count */
1075 	int		stat_interval;		/* Status poll interval (ms) */
1076 	int		ins_interval;		/* Insert poll interval (ms) */
1077 	int		prev_threshold;		/* Previous track/index
1078 						 * threshold (blocks)
1079 						 */
1080 	int		sample_blks;		/* Sample play blocks */
1081 	int		timedpy_mode;		/* Default time display mode */
1082 	int		tooltip_delay;		/* Tool-tip delay interval */
1083 	int		tooltip_time;		/* Tool-tip active interval */
1084 	int		cdda_sched;		/* CDDA sched option flags */
1085 	int		hb_timeout;		/* Heartbeat timeout (secs) */
1086 	int		cdda_filefmt;		/* Output file format */
1087 	int		comp_mode;		/* MP3/OGG compression mode */
1088 	int		bitrate;		/* MP3/OGG bitrate */
1089 	int		bitrate_min;		/* MP3/OGG minimum bitrate */
1090 	int		bitrate_max;		/* MP3/OGG maximum bitrate */
1091 	int		qual_factor;		/* MP3/OGG quality factor */
1092 	int		chan_mode;		/* channel mode */
1093 	int		comp_algo;		/* Comp algorithm tuning */
1094 	int		lowpass_mode;		/* lowpass filter mode */
1095 	int		lowpass_freq;		/* lowpass filter frequency */
1096 	int		lowpass_width;		/* lowpass filter width */
1097 	int		highpass_mode;		/* highpass filter mode */
1098 	int		highpass_freq;		/* highpass filter frequency */
1099 	int		highpass_width;		/* highpass filter width */
1100 	int		lameopts_mode;		/* Direct LAME cmdline mode */
1101 	int		id3tag_mode;		/* MP3 ID3tag mode */
1102 
1103 	word32_t	outport;		/* CDDA playback output port */
1104 	word32_t	debug;			/* Debug output level */
1105 
1106 	bool_t		ins_disable;		/* Insert poll disable */
1107 	bool_t		cdinfo_inetoffln;	/* Internet offline */
1108 	bool_t		use_proxy;		/* Using proxy server */
1109 	bool_t		proxy_auth;		/* Use proxy authorization */
1110 	bool_t		auto_musicbrowser;	/* Auto CDDB Music Browser */
1111 	bool_t		scsierr_msg;		/* Print SCSI error msg? */
1112 	bool_t		sol2_volmgt;		/* Solaris 2.x Vol Mgr */
1113 	bool_t		write_curfile;		/* Enable curr.XXX output */
1114 	bool_t		tooltip_enable;		/* Enable tool-tips */
1115 	bool_t		histfile_dsbl;		/* Disable history file */
1116 	bool_t		remote_enb;		/* Enable remote control */
1117 	bool_t		remote_log;		/* Enable rmtctl logfile */
1118 	bool_t		cdda_trkfile;		/* One output file per track */
1119 	bool_t		subst_underscore;	/* Substitute space to '_' */
1120 	bool_t		copyright;		/* Add copyright flag */
1121 	bool_t		original;		/* Add original flag */
1122 	bool_t		nores;			/* Disable bit reservoir */
1123 	bool_t		checksum;		/* Do checksum */
1124 	bool_t		strict_iso;		/* Strict ISO MP3 compliance */
1125 	bool_t		add_tag;		/* Add MP3/OGG comment tag */
1126 	bool_t		load_spindown;		/* Spin down disc on CD load */
1127 	bool_t		load_play;		/* Auto play on CD load */
1128 	bool_t		done_eject;		/* Auto eject on done */
1129 	bool_t		done_exit;		/* Auto exit on done */
1130 	bool_t		exit_eject;		/* Eject disc on exit? */
1131 	bool_t		exit_stop;		/* Stop disc on exit? */
1132 	bool_t		eject_exit;		/* Exit upon disc eject? */
1133 	bool_t		repeat_mode;		/* Repeat enable on startup */
1134 	bool_t		shuffle_mode;		/* Shuffle enable on startup */
1135 	bool_t		single_fuzzy;		/* Accept single fuzzy match */
1136 	bool_t		automotd_dsbl;		/* Disable automatic-MOTD */
1137 	bool_t		rsvd1[4];		/* Reserved */
1138 
1139 	/*
1140 	 * Device-specific config parameters
1141 	 */
1142 
1143 	/* Privileged */
1144 	int		devnum;			/* Logical device number */
1145 	char		*devlist;		/* CD-ROM device list */
1146 	int		di_method;		/* Device interface method */
1147 	int		vendor_code;		/* Vendor command set code */
1148 	int		numdiscs;		/* Number of discs */
1149 	int		chg_method;		/* Medium change method */
1150 	int		base_scsivol;		/* SCSI volume value base */
1151 	int		min_playblks;		/* Minimum play blocks */
1152 	int		cdda_method;		/* CDDA method */
1153 	int		cdda_rdmethod;		/* CDDA read method */
1154 	int		cdda_wrmethod;		/* CDDA write method */
1155 	int		cdda_scsidensity;	/* CDDA SCSI modesel density */
1156 	int		cdda_scsireadcmd;	/* CDDA SCSI vendor cmd set */
1157 	int		cdda_readchkblks;	/* CDDA read chunk */
1158 	bool_t		scsiverck;		/* SCSI version check */
1159 	bool_t		play10_supp;		/* Play Audio (10) supported */
1160 	bool_t		play12_supp;		/* Play Audio (12) supported */
1161 	bool_t		playmsf_supp;		/* Play Audio MSF supported */
1162 	bool_t		playti_supp;		/* Play Audio T/I supported */
1163 	bool_t		load_supp;		/* Motorized load supported */
1164 	bool_t		eject_supp;		/* Motorized eject supported */
1165 	bool_t		msen_dbd;		/* Set DBD bit for msense */
1166 	bool_t		msen_10;		/* Use 10-byte mode sen/sel */
1167 	bool_t		mselvol_supp;		/* Audio vol chg supported */
1168 	bool_t		balance_supp;		/* Indep vol chg supported */
1169 	bool_t		chroute_supp;		/* Channel routing support */
1170 	bool_t		pause_supp;		/* Pause/Resume supported */
1171 	bool_t		strict_pause_resume;	/* Must resume after pause */
1172 	bool_t		play_pause_play;	/* Must pause before play */
1173 	bool_t		caddylock_supp;		/* Caddy lock supported */
1174 	bool_t		curpos_fmt;		/* Fmt 1 of RdSubch command */
1175 	bool_t		play_notur;		/* No Tst U Rdy when playing */
1176 	bool_t		toc_lba;		/* Rd TOC in LBA mode */
1177 	bool_t		subq_lba;		/* Rd Subchan in LBA mode */
1178 	bool_t		mcn_dsbl;		/* Disable MCN read */
1179 	bool_t		isrc_dsbl;		/* Disable ISRC read */
1180 	bool_t		cdtext_dsbl;		/* Disable CD-TEXT read */
1181 	bool_t		cdda_bigendian;		/* CDDA is in big endian */
1182 	bool_t		cdda_modesel;		/* Do mode select for CDDA */
1183 	bool_t		rsvd2[3];		/* reserved */
1184 
1185 	int		drv_blksz;		/* Drive native block size */
1186 	int		spinup_interval;	/* spin up delay (sec) */
1187 
1188 	/* User-modifiable */
1189 	int		play_mode;		/* Playback mode */
1190 	int		vol_taper;		/* Volume control taper */
1191 	int		startup_vol;		/* Startup volume preset */
1192 	int		ch_route;		/* Channel routing */
1193 	int		skip_blks;		/* FF/REW skip blocks */
1194 	int		skip_pause;		/* FF/REW pause (msec) */
1195 	int		skip_spdup;		/* FF/REW speedup count */
1196 	int		skip_vol;		/* FF/REW percent volume */
1197 	int		skip_minvol;		/* FF/REW minimum volume */
1198 
1199 	bool_t		eject_close;		/* Close upon disc eject? */
1200 	bool_t		caddy_lock;		/* Lock caddy on CD load? */
1201 	bool_t		multi_play;		/* Multi-CD playback */
1202 	bool_t		reverse;		/* Multi-CD reverse playback */
1203 	bool_t		cdda_jitter_corr;	/* Do CDDA jitter correction */
1204 	bool_t		rsvd3[3];		/* reserved */
1205 
1206 	/*
1207 	 * Various application message strings
1208 	 */
1209 	char		*main_title;		/* Main window title */
1210 	char		*str_local;		/* local */
1211 	char		*str_cddb;		/* CDDB */
1212 	char		*str_cdtext;		/* CD-Text */
1213 	char		*str_query;		/* query */
1214 	char		*str_progmode;		/* prog */
1215 	char		*str_elapse;		/* elapse */
1216 	char		*str_elapseseg;		/* e-seg */
1217 	char		*str_elapsedisc;	/* e-disc */
1218 	char		*str_remaintrk;		/* r-trac */
1219 	char		*str_remainseg;		/* r-seg */
1220 	char		*str_remaindisc;	/* r-disc */
1221 	char		*str_play;		/* play */
1222 	char		*str_pause;		/* pause */
1223 	char		*str_ready;		/* ready */
1224 	char		*str_sample;		/* sample */
1225 	char		*str_badopts;		/* Bad command-line options */
1226 	char		*str_nodisc;		/* No disc */
1227 	char		*str_busy;		/* Device busy */
1228 	char		*str_unknartist;	/* unknown artist */
1229 	char		*str_unkndisc;		/* unknown disc title */
1230 	char		*str_unkntrk;		/* unknown track title */
1231 	char		*str_data;		/* Data */
1232 	char		*str_info;		/* Information */
1233 	char		*str_warning;		/* Warning */
1234 	char		*str_fatal;		/* Fatal error */
1235 	char		*str_confirm;		/* Confirm */
1236 	char		*str_working;		/* Working */
1237 	char		*str_about;		/* About */
1238 	char		*str_quit;		/* Really Quit? */
1239 	char		*str_askproceed;	/* Do you want to proceed? */
1240 	char		*str_clrprog;		/* Program will be cleared */
1241 	char		*str_cancelseg;		/* Seg play will be canceled */
1242 	char		*str_restartplay;	/* Playback will restart */
1243 	char		*str_nomemory;		/* Out of memory */
1244 	char		*str_tmpdirerr;		/* tempdir problem */
1245 	char		*str_libdirerr;		/* libdir not defined */
1246 	char		*str_longpatherr;	/* Path or message too long */
1247 	char		*str_nomethod;		/* Invalid di_method */
1248 	char		*str_novu;		/* Invalid vendor code */
1249 	char		*str_nohelp;		/* No help available on item */
1250 	char		*str_nodb;		/* No CDDB directory */
1251 	char		*str_nocfg;		/* Can't open config file */
1252 	char		*str_noinfo;		/* No information avail */
1253 	char		*str_notrom;		/* Not a CD-ROM device */
1254 	char		*str_notscsi2;		/* Not SCSI-II compliant */
1255 	char		*str_submit;		/* Submit CDDB confirm msg */
1256 	char		*str_submitok;		/* Submit CDDB succeeded */
1257 	char		*str_submitcorr;	/* Please submit corrections */
1258 	char		*str_submiterr;		/* Submit CDDB failed */
1259 	char		*str_moderr;		/* Binary perms error */
1260 	char		*str_staterr;		/* Can't stat device */
1261 	char		*str_noderr;		/* Not a character device */
1262 	char		*str_seqfmterr;		/* Pgm sequence format err */
1263 	char		*str_invpgmtrk;		/* Inv program trk deleted */
1264 	char		*str_recoverr;		/* Recovering audio play err */
1265 	char		*str_maxerr;		/* Too many errors */
1266 	char		*str_saverr_fork;	/* File save err: fork */
1267 	char		*str_saverr_suid;	/* File save err: setuid */
1268 	char		*str_saverr_open;	/* File save err: open */
1269 	char		*str_saverr_close;	/* File save err: close */
1270 	char		*str_saverr_write;	/* File save err: write */
1271 	char		*str_saverr_killed;	/* File save err: child kill */
1272 	char		*str_chgsubmit;		/* Submit change dialog msg */
1273 	char		*str_devlist_undef;	/* deviceList no defined */
1274 	char		*str_devlist_count;	/* deviceList count wrong */
1275 	char		*str_medchg_noinit;	/* Cannot init medium chgr */
1276 	char		*str_authfail;		/* Proxy auth failure */
1277 	char		*str_noclient;		/* Can't find client */
1278 	char		*str_unsuppcmd;		/* Unsupp remote command */
1279 	char		*str_badarg;		/* Specified arg is bad */
1280 	char		*str_invcmd;		/* Invalid cmd for current */
1281 	char		*str_cmdfail;		/* Command failed */
1282 	char		*str_rmt_notenb;	/* Remote ctl not enabled */
1283 	char		*str_rmt_nocmd;		/* Remote ctl no command */
1284 	char		*str_appdef;		/* app-defaults file error */
1285 	char		*str_kpmodedsbl;	/* Keypad mode dsbl prompt */
1286 	char		*str_dlist_delall;	/* Delete all dlist entries */
1287 	char		*str_chgrscan;		/* CD Changer scanning */
1288 	char		*str_the;		/* The */
1289 	char		*str_noneofabove;	/* None of the above */
1290 	char		*str_error;		/* error */
1291 	char		*str_handlereq;		/* User handle required */
1292 	char		*str_handleerr;		/* User handle error */
1293 	char		*str_passwdreq;		/* Password required */
1294 	char		*str_passwdmatcherr;	/* Passwords do not match */
1295 	char		*str_mailinghint;	/* Mailing passwd hint */
1296 	char		*str_unknhandle;	/* Unknown handle */
1297 	char		*str_nohint;		/* No passwd hint available */
1298 	char		*str_nomailhint;	/* Cannot email passwd hint */
1299 	char		*str_hinterr;		/* Cannot get passwd hint */
1300 	char		*str_userregfail;	/* User registration failed */
1301 	char		*str_nowwwwarp;		/* No wwwwarp menu defs */
1302 	char		*str_cannotinvoke;	/* Cannot invoke destination */
1303 	char		*str_stopload;		/* Stop CD info load prompt */
1304 	char		*str_reload;		/* CD info reload prompt */
1305 	char		*str_needrole;		/* Need to select role */
1306 	char		*str_needrolename;	/* Need name for role */
1307 	char		*str_dupcredit;		/* Credit already in list */
1308 	char		*str_duptrkcredit;	/* Credit already in tracks */
1309 	char		*str_dupdisccredit;	/* Credit already in disc */
1310 	char		*str_nofirst;		/* Last but no first name */
1311 	char		*str_nofirstlast;	/* No first or last name */
1312 	char		*str_albumartist;	/* Album artist */
1313 	char		*str_trackartist;	/* Track # artist */
1314 	char		*str_credit;		/* Credit */
1315 	char		*str_fnameguide;	/* Fullname guidelines */
1316 	char		*str_nocateg;		/* Category info needed */
1317 	char		*str_noname;		/* Name needed */
1318 	char		*str_invalurl;		/* Invalid URL */
1319 	char		*str_segposerr;		/* Segment start/end error */
1320 	char		*str_incseginfo;	/* Incomplete segment info */
1321 	char		*str_invseginfo;	/* Invalid segment info */
1322 	char		*str_discardchg;	/* Discard change? */
1323 	char		*str_noaudiopath;	/* Audio file path missing */
1324 	char		*str_audiopathexists;	/* Audio file exists */
1325 	char		*str_playbackmode;	/* Playback mode */
1326 	char		*str_encodeparms;	/* Encoding parameters */
1327 	char		*str_lameopts;		/* LAME MP3 options */
1328 	char		*str_schedparms;	/* CDDA sched parameters */
1329 	char		*str_autofuncs;		/* Automated functions */
1330 	char		*str_cdchanger;		/* CD changer */
1331 	char		*str_chroute;		/* Channel routing */
1332 	char		*str_volbal;		/* Volume / Balance */
1333 	char		*str_cddb_cdtext;	/* CDDB / CD-TEXT */
1334 	char		*str_cddainit_fail;	/* CDDA init failure */
1335 	char		*str_filenamereq;	/* File name required */
1336 	char		*str_notregfile;	/* Not a regular file */
1337 	char		*str_noprog;		/* No CDDA program specified */
1338 	char		*str_overwrite;		/* Overwrite file? */
1339 	char		*str_outdir;		/* CDDA file directory */
1340 	char		*str_pathexp;		/* CDDA expanded file path */
1341 	char		*str_invbr_minmean;	/* Invalid bitrate */
1342 	char		*str_invbr_minmax;	/* Invalid bitrate */
1343 	char		*str_invbr_maxmean;	/* Invalid bitrate */
1344 	char		*str_invbr_maxmin;	/* Invalid bitrate */
1345 	char		*str_invfreq_lp;	/* Invalid lowpass freq */
1346 	char		*str_invfreq_hp;	/* Invalid highpass freq */
1347 	char		*str_nomsg;		/* No messages */
1348 
1349 	/*
1350 	 * Short-cut key translations
1351 	 */
1352 	char		*main_hotkeys;		/* Main window */
1353 	char		*keypad_hotkeys;	/* Keypad window */
1354 
1355 	/*
1356 	 * Miscellaneous
1357 	 */
1358 	void		*aux;			/* Auxiliary */
1359 } appdata_t;
1360 
1361 
1362 #endif	/* __APPENV_H__ */
1363 
1364