]> git.ozlabs.org Git - yaboot.git/blobdiff - second/file.c
Commit yaboot 1.3.6
[yaboot.git] / second / file.c
index b88706977b7dad3b54db7ebc95ecb647c6dd81d2..0278dfaed5302d52050f8da097d0fccbf291c8d5 100644 (file)
@@ -1,20 +1,28 @@
-/* File related stuff
-   
-   Copyright (C) 1999 Benjamin Herrenschmidt
-   
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-   
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+/*
+ *  file.c - Filesystem related interfaces
+ *
+ *  Copyright (C) 2001 Ethan Benson
+ *
+ *  parse_device_path()
+ *
+ *  Copyright (C) 2001 Colin Walters
+ *
+ *  Copyright (C) 1999 Benjamin Herrenschmidt
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
 
 #include "ctype.h"
 #include "types.h"
@@ -83,14 +91,19 @@ parse_device_path(char *imagepath, char *defdevice, int defpart,
          }
      }
 
-     if ((ptr = strrchr(ipath, ',')) != NULL) {
-         char *colon = strrchr(ipath, ':');
-         /* If a ':' occurs *after* a ',', then we assume that there is
-            no filename */
-         if (!colon || colon < ptr) {
-              result->file = strdup(ptr+1);
-              /* Trim the filename off */
-              *ptr = 0;
+     /* if there is no : then there is no filename or partition.  must
+        use strrchr() since enet:,10.0.0.1,file is legal */
+
+     if (strchr(ipath, ':') != NULL) {
+         if ((ptr = strrchr(ipath, ',')) != NULL) {
+              char *colon = strrchr(ipath, ':');
+              /* If a ':' occurs *after* a ',', then we assume that there is
+                 no filename */
+              if (!colon || colon < ptr) {
+                   result->file = strdup(ptr+1);
+                   /* Trim the filename off */
+                   *ptr = 0;
+              }
          }
      }