eject: simplify find_device
Signed-off-by: Michal Luscon <mluscon@redhat.com>
This commit is contained in:
parent
035ed966a4
commit
d36e80a759
BIN
misc-utils/eject
BIN
misc-utils/eject
Binary file not shown.
|
@ -292,13 +292,6 @@ static int FileExists(const char *name)
|
|||
*
|
||||
* foo (if foo starts with '.' or '/')
|
||||
* /dev/foo
|
||||
* /media/foo
|
||||
* /mnt/foo
|
||||
* /dev/cdroms/foo
|
||||
* /dev/cdroms/foo0
|
||||
* /dev/dsk/foo
|
||||
* /dev/rdsk/foo
|
||||
* ./foo
|
||||
*
|
||||
* If found, return the full path. If not found, return 0.
|
||||
* Returns pointer to dynamically allocated string.
|
||||
|
@ -320,44 +313,6 @@ static char *find_device(const char *name)
|
|||
if (FileExists(buf))
|
||||
return buf;
|
||||
|
||||
strcpy(buf, "/media/");
|
||||
strcat(buf, name);
|
||||
if (FileExists(buf))
|
||||
return buf;
|
||||
|
||||
strcpy(buf, "/mnt/");
|
||||
strcat(buf, name);
|
||||
if (FileExists(buf))
|
||||
return buf;
|
||||
|
||||
/* for devfs under Linux */
|
||||
strcpy(buf, "/dev/cdroms/");
|
||||
strcat(buf, name);
|
||||
if (FileExists(buf))
|
||||
return buf;
|
||||
|
||||
strcpy(buf, "/dev/cdroms/");
|
||||
strcat(buf, name);
|
||||
strcat(buf, "0");
|
||||
if (FileExists(buf))
|
||||
return buf;
|
||||
|
||||
/* for devfs under Solaris */
|
||||
strcpy(buf, "/dev/rdsk/");
|
||||
strcat(buf, name);
|
||||
if (FileExists(buf))
|
||||
return buf;
|
||||
|
||||
strcpy(buf, "/dev/dsk/");
|
||||
strcat(buf, name);
|
||||
if (FileExists(buf))
|
||||
return buf;
|
||||
|
||||
strcpy(buf, "./");
|
||||
strcat(buf, name);
|
||||
if (FileExists(buf))
|
||||
return buf;
|
||||
|
||||
free(buf);
|
||||
buf = 0;
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue