]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - backend/pap.c
Merge changes from CUPS 1.4svn-r7961.
[thirdparty/cups.git] / backend / pap.c
index 4cad781ec549321ba8d38350e22584c10b7ea213..12dbb9e89c4c382bcf777867c21fe7cfc01dc087 100644 (file)
@@ -1,7 +1,7 @@
 /*
-* "$Id: pap.c 7010 2007-10-10 21:08:51Z mike $"
+* "$Id: pap.c 7720 2008-07-11 22:46:21Z mike $"
 *
-* © Copyright 2004 Apple Computer, Inc. All rights reserved.
+* Copyright 2004-2008 Apple Inc. All rights reserved.
 * 
 * IMPORTANT:  This Apple software is supplied to you by Apple Computer,
 * Inc. ("Apple") in consideration of your agreement to the following
 *  signalHandler()      - handle SIGINT to close the session before quiting.
 */
 
+/*
+ * This backend uses deprecated APIs for AppleTalk; we know this, so
+ * silence any warnings about it...
+ */
+
+#ifdef MAC_OS_X_VERSION_MIN_REQUIRED
+#  undef MAC_OS_X_VERSION_MIN_REQUIRED
+#endif /* MAX_OS_X_VERSION_MIN_REQUIRED */
+#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_0
+
 #include <config.h>
 
 #include <stdio.h>
 #include <sys/time.h>
 #include <sys/errno.h>
 
+#include <cups/cups.h>
+#include <cups/backend.h>
+#include <cups/sidechannel.h>
+#include <cups/i18n.h>
+
 #include <netat/appletalk.h>
 #include <netat/atp.h>
 #include <netat/ddp.h>
 #include <netat/nbp.h>
 #include <netat/pap.h>
 
-#include <cups/cups.h>
-#include <cups/backend.h>
-#include <cups/sidechannel.h>
-#include <cups/i18n.h>
-
 #include <libkern/OSByteOrder.h>
 
 #ifdef HAVE_APPLETALK_AT_PROTO_H
@@ -268,7 +278,6 @@ int main (int argc, const char * argv[])
  */
 static int listDevices(void)
 {
-  int  err = noErr;
   int  i;
   int  numberFound;
 
@@ -288,7 +297,7 @@ static int listDevices(void)
     return -1;  /* Network is down */
   }
 
-  if ((err = zip_getmyzone(ZIP_DEF_INTERFACE, &at_zone)) != 0)
+  if (zip_getmyzone(ZIP_DEF_INTERFACE, &at_zone))
   {
     _cupsLangPrintError(_("ERROR: Unable to get default AppleTalk zone"));
     return -2;
@@ -400,14 +409,13 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
   at_inet_t    sendDataAddr;
   at_inet_t    src;
   at_resp_t    resp;
-  int          userdata, xo, reqlen;
+  int          userdata, xo = 0, reqlen;
   u_short      tid;
   u_char       bitmap;
   int          maxfdp1,
                nbp_failures = 0;
   struct timeval timeout, *timeoutPtr;
   u_char       flowQuantum = 1;
-  u_short      recvSequence = 0;
   time_t       now,
                start_time,
                elasped_time, 
@@ -721,7 +729,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
       case AT_PAP_TYPE_SEND_DATA:            /* Send-Data packet */
         sendDataAddr.socket  = src.socket;
         gSendDataID     = tid;
-        recvSequence    = OSReadBigInt16(&SEQUENCE_NUM(userdata), 0);
+        OSReadBigInt16(&SEQUENCE_NUM(userdata), 0);
 
         if ((fileBufferNbytes > 0 || fileEOFRead) && fileEOFSent == false)
         {
@@ -903,8 +911,7 @@ static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
 {
   int          result,
                open_result,
-               userdata,
-               atp_err;
+               userdata;
   time_t       tm,
                waitTime;
   char         data[10], 
@@ -953,8 +960,8 @@ static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
 
     fprintf(stderr, "DEBUG: -> %s\n", packet_name(AT_PAP_TYPE_OPEN_CONN));
 
-    if ((atp_err = atp_sendreq(*fd, &tuple->enu_addr, data, 4, userdata, 1, 0, 
-                              0, &resp, &retry, 0)) < 0)
+    if (atp_sendreq(*fd, &tuple->enu_addr, data, 4, userdata, 1, 0, 
+                   0, &resp, &retry, 0) < 0)
     {
       statusUpdate("Destination unreachable", 23);
       result = EHOSTUNREACH;
@@ -1021,7 +1028,6 @@ static int papClose()
 {
   int          fd;
   u_short      tmpID;
-  int          result;
   unsigned char        rdata[ATP_DATA_SIZE];
   int          userdata;
   u_char       *puserdata = (u_char *)&userdata;
@@ -1074,9 +1080,9 @@ static int papClose()
     resp.resp[0].iov_base = rdata;
     resp.resp[0].iov_len = sizeof(rdata);
   
-    result = atp_sendreq(fd, &gSessionAddr, 0, 0, userdata, 1, 0, 0, &resp, &retry, 0);
+    atp_sendreq(fd, &gSessionAddr, 0, 0, userdata, 1, 0, 0, &resp, &retry, 0);
   
-    result = close(fd);
+    close(fd);
   }
   return noErr;
 }