-/* SmoothWall install program.\r
- *\r
- * This program is distributed under the terms of the GNU General Public\r
- * Licence. See the file COPYING for details.\r
- *\r
- * (c) Lawrence Manning, 2001\r
- * Contains some functs for scanning /proc for ide info on CDROMS and\r
- * harddisks.\r
- * \r
- * $Id: ide.c,v 1.4 2003/12/11 11:25:53 riddles Exp $\r
- * \r
- */\r
-\r
-#include "install.h"\r
-\r
-/* checkide(). Scans the named drive letter and returns the IDE_??? type. */\r
-int checkide(char letter)\r
-{\r
- FILE *f = NULL;\r
- char filename[STRING_SIZE];\r
- char buffer[STRING_SIZE];\r
- \r
- sprintf(filename, "/proc/ide/hd%c/media", letter);\r
- \r
- if (!(f = fopen(filename, "r")))\r
- return IDE_EMPTY;\r
- \r
- if (!(fgets(buffer, STRING_SIZE, f)))\r
- {\r
- printf("Couldn't read from %s\n", filename);\r
- fclose(f);\r
- return IDE_EMPTY;\r
- }\r
- \r
- fclose(f);\r
- \r
- stripnl(buffer);\r
- \r
- if (strcmp(buffer, "cdrom") == 0)\r
- return IDE_CDROM;\r
- else if (strcmp(buffer, "disk") == 0)\r
- return IDE_HD;\r
- else\r
- return IDE_UNKNOWN;\r
-}\r
-\r
-/* findidetype(). Finds the first ide deveice of the given IDE_?? type. */\r
-char findidetype(int type)\r
-{\r
- char letter;\r
- \r
- for (letter = 'a'; letter <= 'z'; letter++)\r
- {\r
- if ((checkide(letter)) == type)\r
- {\r
- return letter;\r
- }\r
- }\r
- return '\0';\r
-}\r
-\r
+/* SmoothWall install program.
+ *
+ * This program is distributed under the terms of the GNU General Public
+ * Licence. See the file COPYING for details.
+ *
+ * (c) Lawrence Manning, 2001
+ * Contains some functs for scanning /proc for ide info on CDROMS and
+ * harddisks.
+ *
+ * $Id: ide.c,v 1.4 2003/12/11 11:25:53 riddles Exp $
+ *
+ */
+
+#include "install.h"
+
+/* checkide(). Scans the named drive letter and returns the IDE_??? type. */
+int checkide(char letter)
+{
+ FILE *f = NULL;
+ char filename[STRING_SIZE];
+ char buffer[STRING_SIZE];
+
+ sprintf(filename, "/proc/ide/hd%c/media", letter);
+
+ if (!(f = fopen(filename, "r")))
+ return IDE_EMPTY;
+
+ if (!(fgets(buffer, STRING_SIZE, f)))
+ {
+ printf("Couldn't read from %s\n", filename);
+ fclose(f);
+ return IDE_EMPTY;
+ }
+
+ fclose(f);
+
+ stripnl(buffer);
+
+ if (strcmp(buffer, "cdrom") == 0)
+ return IDE_CDROM;
+ else if (strcmp(buffer, "disk") == 0)
+ return IDE_HD;
+ else
+ return IDE_UNKNOWN;
+}
+
+/* findidetype(). Finds the first ide deveice of the given IDE_?? type. */
+char findidetype(int type)
+{
+ char letter;
+
+ for (letter = 'a'; letter <= 'z'; letter++)
+ {
+ if ((checkide(letter)) == type)
+ {
+ return letter;
+ }
+ }
+ return '\0';
+}
+