- cp = rindex(special, '/');
- if (cp == 0) {
- /*
- * No path prefix; try /dev/r%s then /dev/%s.
- */
- (void)sprintf(device, "%sr%s", _PATH_DEV, special);
- if (stat(device, &st) == -1)
- (void)sprintf(device, "%s%s", _PATH_DEV, special);
- special = device;
+ /*
+ * try to open Special. Look for it as Special, then /dev/rSpecial,
+ * then /dev/Special. If it contains a slash (/) only look for Special.
+ */
+ special = argv[0];
+ if ((stat(special, &st) == -1) && (rindex(special, '/') == 0)) {
+ sprintf(device, "%sr%s", _PATH_DEV, special);
+ if (stat(device, &st) == -1) {
+ sprintf(device, "%s%s", _PATH_DEV, special);
+ if (stat(device, &st) == 0)
+ special = device;
+ } else
+ special = device;