chiark / gitweb /
Fix use of `octet' now that mLib includes `bits.h' (as of version 1.3.5
authormdw <mdw>
Wed, 2 Jun 1999 17:03:29 +0000 (17:03 +0000)
committermdw <mdw>
Wed, 2 Jun 1999 17:03:29 +0000 (17:03 +0000)
release).  Also use the mLib load and store macros rather than doing it
by hand.

src/sw_rsh.c

index 3c910df42c12f43225f0c35bf3bde44765e36256..fdacf125b06555bf15aa7173fe8b55825137f464 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: sw_rsh.c,v 1.1 1999/06/02 16:53:34 mdw Exp $
+ * $Id: sw_rsh.c,v 1.2 1999/06/02 17:03:29 mdw Exp $
  *
  * Run remote commands
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: sw_rsh.c,v $
- * Revision 1.1  1999/06/02 16:53:34  mdw
- * Initial revision
+ * Revision 1.2  1999/06/02 17:03:29  mdw
+ * Fix use of `octet' now that mLib includes `bits.h' (as of version 1.3.5
+ * release).  Also use the mLib load and store macros rather than doing it
+ * by hand.
+ *
+ * Revision 1.1.1.1  1999/06/02  16:53:34  mdw
+ * Initial import.
  *
  */
 
@@ -59,6 +64,7 @@
 #endif
 
 #include <mLib/alloc.h>
+#include <mLib/bits.h>
 #include <mLib/dstr.h>
 #include <mLib/exc.h>
 #include <mLib/mdwopt.h>
@@ -74,8 +80,6 @@
 
 /*----- Data structures ---------------------------------------------------*/
 
-typedef unsigned char octet;
-
 #define PKHEADSZ 3
 
 typedef struct pkhead {
@@ -125,8 +129,7 @@ int pksend(sw_remote *r, int type, const void *p, size_t sz)
     /* --- Set up the packet header --- */
 
     chunk = (sz > PKMAX ? PKMAX : sz);
-    h.len[0] = chunk & 0xff;
-    h.len[1] = (chunk >> 8) & 0xff;
+    STORE16(h.len, chunk);
 
     /* --- Write the packet header --- */
 
@@ -221,7 +224,7 @@ int pkrecv(sw_remote *r)
 
   /* --- Sort out what's going on --- */
 
-  sz = h.len[0] | (h.len[1] << 8);
+  sz = LOAD16(h.len);
   r->sz = sz;
   if (!sz)
     return (h.type);