gsocket: add G_IO_ERROR_CONNECTION_CLOSED
[platform/upstream/glib.git] / gio / tests / filter-cat.c
index ff7ddd3..320aebd 100644 (file)
@@ -13,9 +13,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  *
  * Author: Alexander Larsson <alexl@redhat.com>
  */
 #include <config.h>
 
 #include <stdio.h>
-#include <unistd.h>
 #include <locale.h>
 #include <errno.h>
 
 #include <glib.h>
 #include <gio/gio.h>
 
+#ifdef G_OS_UNIX
+#include <unistd.h>
+#endif
+
+#ifdef G_OS_WIN32
+#include <io.h>
+#ifndef STDOUT_FILENO
+#define STDOUT_FILENO 1
+#endif
+#endif
+
 static gchar **locations = NULL;
 static char *from_charset = NULL;
 static char *to_charset = NULL;
@@ -157,7 +165,7 @@ cat (GFile * file)
        g_input_stream_read (in, buffer, sizeof (buffer) - 1, NULL, &error);
       if (res > 0)
        {
-         ssize_t written;
+         gssize written;
 
          p = buffer;
          while (res > 0)
@@ -215,8 +223,6 @@ main (int argc, char *argv[])
   GFile *file;
   int i;
 
-  g_type_init ();
-
   context =
     g_option_context_new ("LOCATION... - concatenate LOCATIONS "
                          "to standard output.");