r2298 - alfs-POC/src

jhuntwork at linuxfromscratch.org jhuntwork at linuxfromscratch.org
Thu Mar 2 12:45:34 PST 2006


Author: jhuntwork
Date: 2006-03-02 13:45:33 -0700 (Thu, 02 Mar 2006)
New Revision: 2298

Modified:
   alfs-POC/src/parser.cpp
Log:
Added check to make sure the current line isn't empty

Modified: alfs-POC/src/parser.cpp
===================================================================
--- alfs-POC/src/parser.cpp	2006-03-02 20:15:13 UTC (rev 2297)
+++ alfs-POC/src/parser.cpp	2006-03-02 20:45:33 UTC (rev 2298)
@@ -27,7 +27,7 @@
   int loc, len;
   string fn, parent, curline, path;
   const char *dir, *file;
-  char wd[512];
+  char wd[256];
   ifstream fp;
   
   len = filename.length();
@@ -47,9 +47,10 @@
   cout << "Parsing file: " << fn << endl;
   file = fn.c_str();
   fp.open(file);
-  if (!fp)
+  if (!fp) {
     perror(file);
-
+    return(-1);
+  }
   /* Set the current working directory, in case we leave it,
      and so we can get the name of the parent directory for
      the file we're parsing */
@@ -62,7 +63,8 @@
      until the end of the file is reached */
   while (fp.good()) {
     getline(fp, curline);
-    cout << "Current line: " << curline << endl;	
+    if (curline.empty() != 1)
+      cout << "Current line: " << curline << endl;	
   }
 
   fp.close();




More information about the alfs-log mailing list