diff src/file-io.cc @ 3202:44d82b369c78

[project @ 1998-10-29 20:27:57 by jwe]
author jwe
date Thu, 29 Oct 1998 20:28:02 +0000
parents c17387059fd3
children 041ea33fbbf4
line wrap: on
line diff
--- a/src/file-io.cc	Thu Oct 29 05:31:02 1998 +0000
+++ b/src/file-io.cc	Thu Oct 29 20:28:02 1998 +0000
@@ -880,32 +880,25 @@
 
 	  if (! error_state)
 	    {
-	      double dskip = skip_arg.double_value ();
+	      int skip = skip_arg.int_value (true);
 
 	      if (! error_state)
 		{
-		  if (D_NINT (dskip) == dskip)
+		  string arch = arch_arg.string_value ();
+
+		  if (! error_state)
 		    {
-		      int skip = NINT (dskip);
-
-		      string arch = arch_arg.string_value ();
+		      oct_mach_info::float_format flt_fmt
+			= oct_mach_info::string_to_float_format (arch);
 
 		      if (! error_state)
-			{
-			  oct_mach_info::float_format flt_fmt
-			    = oct_mach_info::string_to_float_format (arch);
-
-			  if (! error_state)
-			    retval = os.read (size, dt, skip, flt_fmt, count);
-			}
-		      else
-			::error ("fread: architecture type must be a string");
+			retval = os.read (size, dt, skip, flt_fmt, count);
 		    }
 		  else
-		    ::error ("fread: skip must be an integer");
+		    ::error ("fread: architecture type must be a string");
 		}
 	      else
-		::error ("fread: invalid skip specified");
+		::error ("fread: skip must be an integer");
 	    }
 	  else
 	    ::error ("fread: invalid data type specified");
@@ -1022,33 +1015,28 @@
 
       if (! error_state)
 	{
-	  double dskip = skip_arg.double_value ();
+	  int skip = skip_arg.int_value (true);
 
 	  if (! error_state)
 	    {
-	      if (D_NINT (dskip) == dskip)
+	      string arch = arch_arg.string_value ();
+
+	      if (! error_state)
 		{
-		  int skip = NINT (dskip);
-
-		  string arch = arch_arg.string_value ();
+		  oct_mach_info::float_format flt_fmt
+		    = oct_mach_info::string_to_float_format (arch);
 
 		  if (! error_state)
-		    {
-		      oct_mach_info::float_format flt_fmt
-			= oct_mach_info::string_to_float_format (arch);
-
-		      if (! error_state)
-			retval = os.write (data, dt, skip, flt_fmt);
-		    }
-		  else
-		    ::error ("fwrite: architecture type must be a string");
+		    retval = os.write (data, dt, skip, flt_fmt);
 		}
 	      else
-		::error ("fwrite: skip must be an integer");
+		::error ("fwrite: architecture type must be a string");
 	    }
 	  else
-	    ::error ("fwrite: invalid skip specified");
+	    ::error ("fwrite: skip must be an integer");
 	}
+      else
+	::error ("fwrite: invalid precision specified");
     }
   else
     ::error ("fwrite: precision must be a string");
@@ -1341,18 +1329,11 @@
 
   if (args.length () == 1)
     {
-      double dmask = args(0).double_value ();
+      int mask = args(0).int_value (true);
 
-      if (error_state)
+      if (! error_state)
 	{
-	  status = -1;
-	  ::error ("umask: expecting integer argument");
-	}
-      else
-	{
-	  int mask = NINT (dmask);
-
-	  if (mask != dmask || mask < 0)
+	  if (mask < 0)
 	    {
 	      status = -1;
 	      ::error ("umask: MASK must be a positive integer value");
@@ -1365,6 +1346,11 @@
 		status = convert (file_ops::umask (oct_mask), 10, 8);
 	    }
 	}
+      else
+	{
+	  status = -1;
+	  ::error ("umask: expecting integer argument");
+	}
     }
   else
     print_usage ("umask");