[Libguestfs] [PATCH] mllib: remove the TTY module

Pino Toscano ptoscano at redhat.com
Tue Nov 25 10:59:07 UTC 2014


The only function provided is isatty_stdout, which is no more used now
in favour of Unix.isatty.
---
 builder/Makefile.am   |  2 --
 customize/Makefile.am |  2 --
 mllib/Makefile.am     |  9 ++-------
 mllib/tTY.ml          | 19 -------------------
 mllib/tTY.mli         | 23 -----------------------
 mllib/tty-c.c         | 40 ----------------------------------------
 po/POTFILES           |  1 -
 po/POTFILES-ml        |  1 -
 resize/Makefile.am    |  2 --
 sparsify/Makefile.am  |  2 --
 sysprep/Makefile.am   |  2 --
 v2v/Makefile.am       |  2 --
 12 files changed, 2 insertions(+), 103 deletions(-)
 delete mode 100644 mllib/tTY.ml
 delete mode 100644 mllib/tTY.mli
 delete mode 100644 mllib/tty-c.c

diff --git a/builder/Makefile.am b/builder/Makefile.am
index 68c5556..7334031 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -89,8 +89,6 @@ deps = \
 	$(top_builddir)/mllib/libdir.cmx \
 	$(top_builddir)/mllib/config.cmx \
 	$(top_builddir)/mllib/common_gettext.cmx \
-	$(top_builddir)/mllib/tty-c.o \
-	$(top_builddir)/mllib/tTY.cmx \
 	$(top_builddir)/mllib/common_utils.cmx \
 	$(top_builddir)/mllib/fsync-c.o \
 	$(top_builddir)/mllib/fsync.cmx \
diff --git a/customize/Makefile.am b/customize/Makefile.am
index 51ec72a..a95025d 100644
--- a/customize/Makefile.am
+++ b/customize/Makefile.am
@@ -68,8 +68,6 @@ deps = \
 	$(top_builddir)/fish/guestfish-uri.o \
 	$(top_builddir)/fish/guestfish-file-edit.o \
 	$(top_builddir)/mllib/common_gettext.cmx \
-	$(top_builddir)/mllib/tty-c.o \
-	$(top_builddir)/mllib/tTY.cmx \
 	$(top_builddir)/mllib/common_utils.cmx \
 	$(top_builddir)/mllib/config.cmx \
 	$(top_builddir)/mllib/regedit.cmx \
diff --git a/mllib/Makefile.am b/mllib/Makefile.am
index c4e64d2..b2b3271 100644
--- a/mllib/Makefile.am
+++ b/mllib/Makefile.am
@@ -44,9 +44,6 @@ SOURCES = \
 	progress.ml \
 	regedit.mli \
 	regedit.ml \
-	tty-c.c \
-	tTY.mli \
-	tTY.ml \
 	uri-c.c \
 	uRI.mli \
 	uRI.ml
@@ -60,7 +57,6 @@ if HAVE_OCAML
 ocaml_modules = config \
 	libdir \
 	common_gettext \
-	tTY \
 	common_utils \
 	fsync \
 	progress \
@@ -73,7 +69,6 @@ ocaml_modules = config \
 OBJECTS = \
 	$(top_builddir)/fish/guestfish-progress.o \
 	$(top_builddir)/fish/guestfish-uri.o \
-	tty-c.o \
 	fsync-c.o \
 	progress-c.o \
 	uri-c.o \
@@ -152,11 +147,11 @@ DEFAULT_INCLUDES = \
 check_SCRIPTS = common_utils_tests
 
 if HAVE_OCAMLOPT
-common_utils_tests: common_gettext.cmx tty-c.o tTY.cmx common_utils.cmx common_utils_tests.cmx
+common_utils_tests: common_gettext.cmx common_utils.cmx common_utils_tests.cmx
 	$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
 	  mlguestfs.cmxa -linkpkg $^ -cclib '$(LIBTINFO_LIBS)' -o $@
 else
-common_utils_tests: common_gettext.cmo tty-c.o tTY.cmo common_utils.cmo common_utils_tests.cmo
+common_utils_tests: common_gettext.cmo common_utils.cmo common_utils_tests.cmo
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) \
 	  mlguestfs.cma -linkpkg $^ -cclib '$(LIBTINFO_LIBS)' -custom -o $@
 endif
diff --git a/mllib/tTY.ml b/mllib/tTY.ml
deleted file mode 100644
index 80f0e1e..0000000
--- a/mllib/tTY.ml
+++ /dev/null
@@ -1,19 +0,0 @@
-(* virt-resize
- * Copyright (C) 2013 Red Hat 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
- * 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.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *)
-
-external isatty_stdout : unit -> bool = "virt_resize_isatty_stdout" "noalloc"
diff --git a/mllib/tTY.mli b/mllib/tTY.mli
deleted file mode 100644
index 69441f1..0000000
--- a/mllib/tTY.mli
+++ /dev/null
@@ -1,23 +0,0 @@
-(* virt-resize
- * Copyright (C) 2013 Red Hat 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
- * 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.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *)
-
-(** TTY utilities. *)
-
-val isatty_stdout : unit -> bool
-(** RHEL 5-era ocaml didn't have Unix.isatty.  This is not needed in
-    recent OCaml. *)
diff --git a/mllib/tty-c.c b/mllib/tty-c.c
deleted file mode 100644
index 369b647..0000000
--- a/mllib/tty-c.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* virt-resize - interface to isatty
- * Copyright (C) 2013 Red Hat 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
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <caml/memory.h>
-#include <caml/mlvalues.h>
-
-#pragma GCC diagnostic ignored "-Wmissing-prototypes"
-
-/* RHEL 5-era ocaml didn't have Unix.isatty.
- *
- * Note this function is marked as "noalloc" so it must not call any
- * OCaml allocation functions:
- * http://camltastic.blogspot.co.uk/2008/08/tip-calling-c-functions-directly-with.html
- */
-value
-virt_resize_isatty_stdout (value unitv)
-{
-  return isatty (1) ? Val_true : Val_false;
-}
diff --git a/po/POTFILES b/po/POTFILES
index 1a088f5..9333ebe 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -252,7 +252,6 @@ make-fs/make-fs.c
 mllib/fsync-c.c
 mllib/mkdtemp-c.c
 mllib/progress-c.c
-mllib/tty-c.c
 mllib/uri-c.c
 ocaml/guestfs-c-actions.c
 ocaml/guestfs-c.c
diff --git a/po/POTFILES-ml b/po/POTFILES-ml
index b6d88b0..4ebcc09 100644
--- a/po/POTFILES-ml
+++ b/po/POTFILES-ml
@@ -39,7 +39,6 @@ mllib/mkdtemp.ml
 mllib/planner.ml
 mllib/progress.ml
 mllib/regedit.ml
-mllib/tTY.ml
 mllib/uRI.ml
 resize/resize.ml
 sparsify/cmdline.ml
diff --git a/resize/Makefile.am b/resize/Makefile.am
index a765587..234b904 100644
--- a/resize/Makefile.am
+++ b/resize/Makefile.am
@@ -32,8 +32,6 @@ if HAVE_OCAML
 
 # Note this list must be in dependency order.
 deps = \
-	$(top_builddir)/mllib/tty-c.o \
-	$(top_builddir)/mllib/tTY.cmx \
 	$(top_builddir)/mllib/fsync-c.o \
 	$(top_builddir)/mllib/fsync.cmx \
 	$(top_builddir)/fish/guestfish-progress.o \
diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am
index 402ccc8..32552e5 100644
--- a/sparsify/Makefile.am
+++ b/sparsify/Makefile.am
@@ -34,7 +34,6 @@ SOURCES_ML = \
 
 SOURCES_C = \
 	$(top_builddir)/fish/progress.c \
-	$(top_builddir)/mllib/tty-c.c \
 	$(top_builddir)/mllib/progress-c.c \
 	statvfs-c.c
 
@@ -54,7 +53,6 @@ virt_sparsify_CFLAGS = \
 
 BOBJECTS = \
 	$(top_builddir)/mllib/common_gettext.cmo \
-	$(top_builddir)/mllib/tTY.cmo \
 	$(top_builddir)/mllib/common_utils.cmo \
 	$(top_builddir)/mllib/progress.cmo \
 	$(top_builddir)/mllib/config.cmo \
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index f7ef265..c00f53c 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -82,8 +82,6 @@ if HAVE_OCAML
 # Note this list must be in dependency order.
 deps = \
 	$(top_builddir)/mllib/common_gettext.cmx \
-	$(top_builddir)/mllib/tty-c.o \
-	$(top_builddir)/mllib/tTY.cmx \
 	$(top_builddir)/mllib/common_utils.cmx \
 	$(top_builddir)/mllib/uri-c.o \
 	$(top_builddir)/mllib/uRI.cmx \
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index d1c9169..b5a4dc4 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -95,7 +95,6 @@ SOURCES_ML = \
 SOURCES_C = \
 	$(top_builddir)/fish/progress.c \
 	$(top_builddir)/fish/file-edit.c \
-	$(top_builddir)/mllib/tty-c.c \
 	$(top_builddir)/mllib/progress-c.c \
 	$(top_builddir)/mllib/mkdtemp-c.c \
 	$(top_builddir)/customize/crypt-c.c \
@@ -123,7 +122,6 @@ virt_v2v_CFLAGS = \
 
 BOBJECTS = \
 	$(top_builddir)/mllib/common_gettext.cmo \
-	$(top_builddir)/mllib/tTY.cmo \
 	$(top_builddir)/mllib/common_utils.cmo \
 	$(top_builddir)/mllib/regedit.cmo \
 	$(top_builddir)/mllib/progress.cmo \
-- 
1.9.3




More information about the Libguestfs mailing list