コード例 #1
0
ファイル: slc.c プロジェクト: Claruarius/stblinux-2.6.37
/*
 * do_opt_slc
 *
 * Process an slc option buffer.  Defer processing of incoming slc's
 * until after the terminal state has been processed.  Save the first slc
 * request that comes along, but discard all others.
 *
 * ptr points to the beginning of the buffer, len is the length.
 */
void do_opt_slc(unsigned char  *ptr, int len) {
    unsigned char func, flag;
    cc_t val;
    unsigned char *end = ptr + len;

    if (terminit()) {  /* go ahead */
	while (ptr < end) {
	    func = *ptr++;
	    if (ptr >= end) break;
	    flag = *ptr++;
	    if (ptr >= end) break;
	    val = (cc_t)*ptr++;

	    process_slc(func, flag, val);
	    
	}
    } 
    else {
	/*
	 * save this slc buffer if it is the first, otherwise dump
	 * it.
	 */
	if (def_slcbuf == NULL) {
	    def_slclen = len;
	    def_slcbuf = malloc((unsigned)len);
	    if (def_slcbuf == NULL) return;  /* too bad */
	    bcopy(ptr, def_slcbuf, len);
	}
    }
}
コード例 #2
0
ファイル: slc.c プロジェクト: DanielMSchmidt/it-sec
/*
 * do_opt_slc
 *
 * Process an slc option buffer.  Defer processing of incoming slc's
 * until after the terminal state has been processed.  Save the first slc
 * request that comes along, but discard all others.
 *
 * ptr points to the beginning of the buffer, len is the length.
 */
void
do_opt_slc (register unsigned char *ptr, register int len)
{
  register unsigned char func, flag;
  cc_t val;
  register unsigned char *end = ptr + len;

  if (terminit ())
    {				/* go ahead */
      while (ptr < end)
	{
	  func = *ptr++;
	  if (ptr >= end)
	    break;
	  flag = *ptr++;
	  if (ptr >= end)
	    break;
	  val = (cc_t) * ptr++;

	  process_slc (func, flag, val);

	}
    }
  else
    {
      /*
       * save this slc buffer if it is the first, otherwise dump
       * it.
       */
      if (def_slcbuf == (unsigned char *) 0)
	{
	  def_slclen = len;
	  def_slcbuf = (unsigned char *) malloc ((unsigned) len);
	  if (def_slcbuf == (unsigned char *) 0)
	    return;		/* too bad */
	  memmove (def_slcbuf, ptr, len);
	}
    }

}				/* end of do_opt_slc */