openbsd-ports/audio/tosha/patches/patch-toconf_c
naddy 7a443d201f - /dev/dsp -> /dev/sound
- /etc -> SYSCONFDIR
- add proper INSTALL/DEINSTALL scripts
- rename and regen patches
- misc clean-ups
2001-03-14 15:04:11 +00:00

52 lines
1.7 KiB
Plaintext

$OpenBSD: patch-toconf_c,v 1.1 2001/03/14 15:04:12 naddy Exp $
--- toconf.c.orig Sat Jan 2 00:57:42 1999
+++ toconf.c Wed Mar 14 15:23:38 2001
@@ -175,6 +175,14 @@ readconfigfile (const char *filename)
if (!(toconf = (toconf_entry *) realloc(toconf,
sizeof(toconf_entry) * toconf_num)))
out_of_memory();
+ /*
+ * Backward compatibility, accept tosharc entries without the
+ * ATAPI flag.
+ */
+ if (*cptr == '0' || *cptr == '1')
+ toconf[cn].atapi = readbool(&cptr, "atapi", &fs);
+ else
+ toconf[cn].atapi = 0;
toconf[cn].vendor = readstring(&cptr, "vendor", &fs);
toconf[cn].product = readstring(&cptr, "product", &fs);
toconf[cn].version = readstring(&cptr, "version", &fs);
@@ -257,7 +265,7 @@ toconf_readconfig (void)
toconf_entry *
toconf_searchentry
- (const char *vendor, const char *product, const char *version)
+ (const char *vendor, const char *product, const char *version, int atapi)
{
toconf_entry *te;
int i, l1, l2, l3;
@@ -267,18 +275,20 @@ toconf_searchentry
l1 = strlen(te->vendor);
l2 = strlen(te->product);
l3 = strlen(te->version);
- if (!l1 && !l2 && !l3) {
+ if (te->atapi == atapi && !l1 && !l2 && !l3) {
fprintf (stderr, "%s: Warning: Unknown drive, "
"using default configuration!\n", me);
return te;
}
if ((!l1 || !strncmp(te->vendor, vendor, l1)) &&
(!l2 || !strncmp(te->product, product, l2)) &&
- (!l3 || !strncmp(te->version, version, l3)))
+ (!l3 || !strncmp(te->version, version, l3)) &&
+ atapi == te->atapi)
return te;
}
fprintf (stderr,
- "%s: Error: Unknown drive and missing default entry!\n", me);
+ "%s: Error: Unknown drive and missing default %s entry!\n", me,
+ atapi ? "ATAPI" : "SCSI");
exit (1);
}