1: #ifndef lint
   2: static char sccsid[] = "@(#)imsg.c	5.1 (Berkeley) 7/2/83";
   3: #endif
   4: 
   5: #include "uucp.h"
   6: 
   7: char Msync[2] = "\020";
   8: /*******
   9:  *	imsg(msg, fn)
  10:  *	char *msg;
  11:  *	int fn;
  12:  *
  13:  *	imsg  -  this is the initial read message routine -
  14:  *	used before a protocol is agreed upon.
  15:  *
  16:  *	return codes:
  17:  *		EOF - no more messages
  18:  *		0 - message returned
  19:  */
  20: 
  21: imsg(msg, fn)
  22: register char *msg;
  23: register int fn;
  24: {
  25:     register int ret;
  26:     DEBUG(7, "imsg %s>", "");
  27:     while ((ret = read(fn, msg, 1)) == 1) {
  28:         *msg &= 0177;   /* Turn off parity bit (mhb5b!smb) */
  29:         DEBUG(7, (*msg>037) ? "%c" : "\\%03o", *msg & 0377);
  30:         if (*msg == Msync[0])
  31:             break;
  32:     }
  33:     DEBUG(7, "%s\n", "<");
  34:     if (ret < 1)
  35:         return(EOF);
  36:     while (read(fn, msg, 1) == 1) {
  37:         *msg &= 0177;
  38:         DEBUG(7, (*msg>037) ? "%c" : "\\%03o", *msg & 0377);
  39:         if (*msg == '\n')
  40:             break;
  41:         if (*msg == '\0')
  42:             break;
  43:         msg++;
  44:     }
  45:     *msg = '\0';
  46:     return(0);
  47: }
  48: 
  49: 
  50: /***
  51:  *	omsg(type, msg, fn)
  52:  *	char type, *msg;
  53:  *	int fn;
  54:  *
  55:  *	omsg  -  this is the initial write message routine -
  56:  *	used before a protocol is agreed upon.
  57:  *
  58:  *	return code:  always 0
  59:  */
  60: 
  61: omsg(type, msg, fn)
  62: register char *msg;
  63: char type;
  64: int fn;
  65: {
  66:     char buf[BUFSIZ];
  67:     register char *c;
  68: 
  69:     c = buf;
  70:     *c++ = Msync[0];
  71:     *c++ = type;
  72:     while (*msg)
  73:         *c++ = *msg++;
  74:     *c++ = '\0';
  75:     write(fn, buf, strlen(buf) + 1);
  76:     return(0);
  77: }

Defined functions

imsg defined in line 21; used 7 times
omsg defined in line 61; used 12 times

Defined variables

Msync defined in line 7; used 2 times
sccsid defined in line 2; never used
Last modified: 1983-07-03
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 597
Valid CSS Valid XHTML 1.0 Strict