diff lib/local.c @ 186:13ca1defdc75

2003-6-16 Brian Masney <masneyb@gftp.org> * lib/gftp.h src/text/gftp-text.c src/gtk/misc-gtk.c - changed 2nd parameter of logging function to be a request structure, instead of request->user_data. In the logging functions, if the string isn't in UTF-8, convert it with gftp_string_to_utf8() * lib/bookmark.c lib/cache.c lib/gftp.h lib/https.c lib/local.c lib/protocols.c lib/rfc2068.c lib/rfc959.c lib/sshv2.c lib/sslcommon.c src/gtk/chmod_dialog.c src/gtk/delete_dialog.c src/gtk/gftp-gtk.h src/gtk/menu-items.c src/gtk/misc-gtk.c src/gtk/mkdir_dialog.c src/gtk/rename_dialog.c src/gtk/transfer.c src/text/gftp-text.c src/gtk/gftp-gtk.h src/text/gftp-text.h - pass request structure to logging function instead of request->user_data
author masneyb
date Tue, 17 Jun 2003 10:49:16 +0000
parents 33b394ebba68
children afbbc72b73e2
line wrap: on
line diff
--- a/lib/local.c	Tue Jun 17 10:13:26 2003 +0000
+++ b/lib/local.c	Tue Jun 17 10:49:16 2003 +0000
@@ -63,7 +63,7 @@
     {
       if (chdir (request->directory) != 0)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                              _("Could not change local directory to %s: %s\n"),
                              request->directory, g_strerror (errno));
         }
@@ -77,7 +77,7 @@
       request->directory = g_strdup (tempstr);
     }
   else
-    request->logging_function (gftp_logging_error, request->user_data,
+    request->logging_function (gftp_logging_error, request,
                              _("Could not get current working directory: %s\n"),
                              g_strerror (errno));
 
@@ -94,7 +94,7 @@
   if (request->datafd != -1)
     {
       if (close (request->datafd) == -1)
-        request->logging_function (gftp_logging_error, request->user_data,
+        request->logging_function (gftp_logging_error, request,
                                    _("Error closing file descriptor: %s\n"),
                                    g_strerror (errno));
       request->datafd = -1;
@@ -128,7 +128,7 @@
 
   if ((size = lseek (request->datafd, 0, SEEK_END)) == -1)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: Cannot seek on file %s: %s\n"),
                                  filename, g_strerror (errno));
       gftp_disconnect (request);
@@ -137,7 +137,7 @@
 
   if (lseek (request->datafd, startsize, SEEK_SET) == -1)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: Cannot seek on file %s: %s\n"),
                                  filename, g_strerror (errno));
       gftp_disconnect (request);
@@ -175,7 +175,7 @@
 
   if (ftruncate (request->datafd, startsize) == -1)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                _("Error: Cannot truncate local file %s: %s\n"),
                                filename, g_strerror (errno));
       gftp_disconnect (request);
@@ -184,7 +184,7 @@
     
   if (lseek (request->datafd, startsize, SEEK_SET) == -1)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: Cannot seek on file %s: %s\n"),
                                  filename, g_strerror (errno));
       gftp_disconnect (request);
@@ -209,7 +209,7 @@
   if (request->datafd > 0)
     {
       if (close (request->datafd) == -1)
-        request->logging_function (gftp_logging_error, request->user_data,
+        request->logging_function (gftp_logging_error, request,
                                    _("Error closing file descriptor: %s\n"),
                                    g_strerror (errno));
 
@@ -401,7 +401,7 @@
 
   if ((lpd->dir = opendir (tempstr)) == NULL)
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                            _("Could not get local directory listing %s: %s\n"),
                            tempstr, g_strerror (errno));
       if (freeit)
@@ -438,13 +438,13 @@
 
   if (chdir (directory) == 0)
     {
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                           _("Successfully changed local directory to %s\n"),
                           directory);
 
       if (getcwd (tempstr, sizeof (tempstr)) == NULL)
         {
-          request->logging_function (gftp_logging_error, request->user_data,
+          request->logging_function (gftp_logging_error, request,
                             _("Could not get current working directory: %s\n"),
                             g_strerror (errno));
 	  return (GFTP_ERETRYABLE);
@@ -458,7 +458,7 @@
     }
   else
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                               _("Could not change local directory to %s: %s\n"),
                               directory, g_strerror (errno));
       return (GFTP_ERETRYABLE);
@@ -475,13 +475,13 @@
 
   if (rmdir (directory) == 0)
     {
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                                  _("Successfully removed %s\n"), directory);
       return (0);
     }
   else
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                               _("Error: Could not remove directory %s: %s\n"),
                               directory, g_strerror (errno));
       return (GFTP_ERETRYABLE);
@@ -498,13 +498,13 @@
 
   if (unlink (file) == 0)
     {
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                                  _("Successfully removed %s\n"), file);
       return (0);
     }
   else
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: Could not remove file %s: %s\n"),
                                  file, g_strerror (errno));
       return (GFTP_ERETRYABLE);
@@ -521,14 +521,14 @@
 
   if (mkdir (directory, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == 0)
     {
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                                  _("Successfully made directory %s\n"),
                                  directory);
       return (0);
     }
   else
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: Could not make directory %s: %s\n"),
                                  directory, g_strerror (errno));
       return (GFTP_ERETRYABLE);
@@ -547,14 +547,14 @@
 
   if (rename (oldname, newname) == 0)
     {
-      request->logging_function (gftp_logging_misc, request->user_data,
+      request->logging_function (gftp_logging_misc, request,
                                  _("Successfully renamed %s to %s\n"),
                                  oldname, newname);
       return (0);
     }
   else
     {
-      request->logging_function (gftp_logging_error, request->user_data,
+      request->logging_function (gftp_logging_error, request,
                                  _("Error: Could not rename %s to %s: %s\n"),
                                  oldname, newname, g_strerror (errno));
       return (GFTP_ERETRYABLE);
@@ -577,14 +577,14 @@
 
   if (chmod (file, newmode) == 0) 
     {
-      request->logging_function (gftp_logging_misc, request->user_data, 
+      request->logging_function (gftp_logging_misc, request, 
                                  _("Successfully changed mode of %s to %d\n"),
                                  file, mode);
       return (0);
     }
   else 
     {
-      request->logging_function (gftp_logging_error, request->user_data, 
+      request->logging_function (gftp_logging_error, request, 
                           _("Error: Could not change mode of %s to %d: %s\n"),
                           file, mode, g_strerror (errno));
       return (GFTP_ERETRYABLE);