changeset 1805:ba9c62430202

[project @ 1996-01-29 06:49:27 by jwe]
author jwe
date Mon, 29 Jan 1996 06:49:57 +0000
parents 793ce4135de7
children 12bc3042c596
files src/utils.cc src/utils.h
diffstat 2 files changed, 0 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/src/utils.cc	Mon Jan 29 06:45:38 1996 +0000
+++ b/src/utils.cc	Mon Jan 29 06:49:57 1996 +0000
@@ -451,73 +451,6 @@
   return is_empty;
 }
 
-// Format a list in neat columns.  Mostly stolen from GNU ls.
-
-ostrstream&
-list_in_columns (ostrstream& os, const string_vector& list)
-{
-  // Compute the maximum name length.
-
-  int max_name_length = 0;
-  int total_names = list.length ();
-
-  for (int i = 0; i < total_names; i++)
-    {
-      int name_length = list[i].length ();
-      if (name_length > max_name_length)
-	max_name_length = name_length;
-    }
-
-  // Allow at least two spaces between names.
-
-  max_name_length += 2;
-
-  // Calculate the maximum number of columns that will fit.
-
-  int line_length = terminal_columns ();
-  int cols = line_length / max_name_length;
-  if (cols == 0)
-    cols = 1;
-
-  // Calculate the number of rows that will be in each column except
-  // possibly  for a short column on the right.
-
-  int rows = total_names / cols + (total_names % cols != 0);
-
-  // Recalculate columns based on rows.
-
-  cols = total_names / rows + (total_names % rows != 0);
-
-  int count;
-  for (int row = 0; row < rows; row++)
-    {
-      count = row;
-      int pos = 0;
-
-      // Print the next row.
-
-      while (1)
-	{
-	  string nm = list[count];
-
-	  os << nm;
-	  int name_length = nm.length ();
-
-	  count += rows;
-	  if (count >= total_names)
-	    break;
-
-	  int spaces_to_pad = max_name_length - name_length;
-	  for (int i = 0; i < spaces_to_pad; i++)
-	    os << " ";
-	  pos += max_name_length;
-	}
-      os << "\n";
-    }
-
-  return os;
-}
-
 // See if the given file is in the path.
 
 string
--- a/src/utils.h	Mon Jan 29 06:45:38 1996 +0000
+++ b/src/utils.h	Mon Jan 29 06:49:57 1996 +0000
@@ -70,8 +70,6 @@
 
 extern int empty_arg (const char *name, int nr, int nc);
 
-extern ostrstream& list_in_columns (ostrstream& os, const string_vector& list);
-
 extern string undo_string_escapes (const string& s);
 
 extern void oct_putenv (const char *, const char *);