]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Remove FIXMEs.
authorJim Meyering <jim@meyering.net>
Sun, 8 Jan 1995 20:20:19 +0000 (20:20 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 8 Jan 1995 20:20:19 +0000 (20:20 +0000)
(get_width_format): Use stub function if not all of the needed math
functions are available.  From Ulrich.
(main): Give reason for failure.

src/seq.c

index 81deb3d91db5ee212e55398edbb22113fd6305db..a74f6e7c0d7df920b97a32e4f4809ddbdc0d17fd 100644 (file)
--- a/src/seq.c
+++ b/src/seq.c
@@ -1,5 +1,5 @@
 /* seq - print sequence of numbers to standard output.
-   Copyright (C) 1994 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995 Free Software Foundation, Inc.
 
    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
@@ -160,7 +160,7 @@ main (argc, argv)
 
   if (optind >= argc)
     {
-      /* FIXME Give reason for failure.  */
+      error (0, 0, "too few arguments");
       usage (2);
       /* NOTREACHED */
     }
@@ -285,12 +285,14 @@ check_format (format_string)
   return 1;
 }
 
-/* Returns the format for that all printed numbers have the same width.  */
+#if defined (HAVE_RINT) && defined (HAVE_MODF) && defined (HAVE_FLOOR)
+
+/* Return a printf-style format string with which all selected numbers
+   will format to strings of the same width.  */
+
 static char *
 get_width_format ()
 {
-  /* FIXME: why is this static?  */
-  /* FIXME: Are you sure this is guaranteed to be large enough?  */
   static char buffer[256];
   int full_width;
   int frac_width;
@@ -301,7 +303,6 @@ get_width_format ()
 
   if (from > last)
     {
-      /* FIXME: don't use floor!! */
       min_val = from - step * floor ((from - last) / step);
       max_val = from;
     }
@@ -318,7 +319,6 @@ get_width_format ()
 
   if (min_val < 0.0)
     {
-      /* FIXME: don't use rint!! */
       (void) sprintf (buffer, "%g", rint (min_val));
       if (buffer[strspn (buffer, "-0123456789")] != '\0')
        return "%g";
@@ -328,7 +328,6 @@ get_width_format ()
     }
   full_width = width1;
 
-  /* FIXME: don't use modf!! */
   (void) sprintf (buffer, "%g", 1.0 + modf (min_val, &temp));
   width1 = strlen (buffer);
   if (width1 == 1)
@@ -341,7 +340,6 @@ get_width_format ()
       width1 -= 2;
     }
 
-  /* FIXME: don't use modf!! */
   (void) sprintf (buffer, "%g", 1.0 + modf (step, &temp));
   width2 = strlen (buffer);
   if (width2 == 1)
@@ -363,6 +361,18 @@ get_width_format ()
   return buffer;
 }
 
+#else  /* one of the math functions rint, modf, floor is missing.  */
+
+static char *
+get_width_format ()
+{
+  /* We cannot compute the needed information to determine the correct
+     answer.  So we simply return a value that works for all cases.  */
+  return "%g";
+}
+
+#endif
+
 /* Actually print the sequence of numbers in the specified range, with the
    given or default stepping and format.  */
 static int