⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 read.c

📁 ftam等标准协议服务器和客户端的源代码。
💻 C
📖 第 1 页 / 共 2 页
字号:
		add_string_to_seq("", &curr_val);	      else		add_string_to_seq("NO VALUE", &curr_val);	    }	  else	    {	      for (curr_av = curr_as->attr_value;		   curr_av != NULLAV;		   curr_av = curr_av->avseq_next)		{		  if ((valps = ps_alloc(str_open)) == NULLPS) return;		  		  if (str_setup(valps, NULLCP, 0, 0) == NOTOK)		    {		      ps_free(valps);		      return;		    }		  		  avs_comp_print(valps, curr_av, format);		  		  *(valps->ps_ptr) = NULL;		  valps->ps_cnt++;		  		  add_string_to_seq(valps->ps_base, &curr_val);		  		  ps_free(valps);		}	    }	}      else	{ /* If not a multi line value */	  if ((valps = ps_alloc(str_open)) == NULLPS) return;	  	  if (str_setup(valps, NULLCP, 0, 0) == NOTOK)	    {	      ps_free(valps);	      return;	    }	  	  avs_print(valps, curr_as->attr_value, format);	  *(valps->ps_ptr) = NULL;	  valps->ps_cnt++;	  	  add_string_to_seq(valps->ps_base, &curr_val);	  	  ps_free(valps);	}            curr_attr->attr_name = curr_type;            if (is_photo)	{	  curr_attr->photo = photo_data;	  curr_attr->is_photo = TRUE;	  curr_attr->val_list = NULLStrCell;	}      else	{	  curr_attr->val_list = curr_val;	  curr_attr->is_photo = FALSE;	}    }} /* get_read_attrs *//* * - photo2xbm() - * * *//* ARGSUSED */int photo2xbm(ps, picture, format)     PS ps;     PE picture;     int format;{  PS sps;  if ((sps = ps_alloc(str_open)) == NULLPS)    return 0;  if (str_setup (sps, NULLCP, LINESIZE, 0) == NOTOK)    {      ps_free(sps);      return 0;    }  photo_ps = ps;  (void) pe2ps(sps, picture);  photo_pass_two = FALSE;  (void)decode_t4(sps->ps_base, "photo", 0);  photo_pass_two = TRUE;  (void)decode_t4(sps->ps_base, "photo", 0);  ps_free(sps);  return 0;} /* photo2xbm *//* ARGSUSED */int photo_start(name)     char *name;{  if (photo_pass_two == FALSE)    {      tmp_width = photo_width = photo_height = 0;      return 0;    }  bit_count = 0;  photo_byte = 0;  return 0;}/* ARGSUSED */int photo_end(name)     char *name;{  register int byte_width;    if (photo_pass_two == FALSE)    {      byte_width = (photo_width / 8) + 1;      photo_height ++;      photo_ptr = photo_bytes =	(unsigned char *) smalloc(byte_width * photo_height);      byte_count = byte_width * photo_height;    }  return 0;}int photo_black(line_length)     int line_length;{  register unsigned char tmp_byte;  register int count;  if (photo_pass_two == FALSE)    {      tmp_width += line_length;      return 0;    }  tmp_byte = photo_byte;  for (count = 0; count < line_length; count++)    {      switch (bit_count)	{	case 0:	  tmp_byte = tmp_byte | 0x01;	  break;	  	case 1:	  tmp_byte = tmp_byte | 0x02;	  break;	  	case 2:	  tmp_byte = tmp_byte | 0x04;	  break;	  	case 3:	  tmp_byte = tmp_byte | 0x08;	  break;	  	case 4:	  tmp_byte = tmp_byte | 0x10;	  break;	  	case 5:	  tmp_byte = tmp_byte | 0x20;	  break;	  	case 6:	  tmp_byte = tmp_byte | 0x40;	  break;	  	case 7:	  tmp_byte = tmp_byte | 0x80;	  break;	}      if (++bit_count == 8)	{	  if (byte_count > (photo_ptr - photo_bytes))	      *photo_ptr++ = tmp_byte;	  tmp_byte = 0;	  bit_count = 0;	}    }  photo_byte = tmp_byte;  return 0;}int photo_white(line_length)     int line_length;{  register int count;  if (photo_pass_two == FALSE)    {      tmp_width += line_length;      return 0;    }  for (count = 0; count < line_length; count++)    if (++bit_count == 8)      {	if (byte_count > (photo_ptr - photo_bytes))	  {	    *photo_ptr = photo_byte;	    photo_ptr++;	  }	photo_byte = 0;	bit_count = 0;      }  return 0;}/* ARGSUSED */int photo_line_end(line)     bit_string *line;{  /* the end of a line has been reached */  /* A bit string is stored in line dbuf_top */  if (photo_pass_two == FALSE)    {      photo_height++;      if (photo_width == 0)	photo_width = tmp_width;      return 0;    }  if (bit_count != 0)    {      if (byte_count > (photo_ptr - photo_bytes))	{	  *photo_ptr = photo_byte;	  photo_ptr++;	}      photo_byte = 0;      bit_count = 0;    }  return 0;}/* * - do_dn_attr_read() - * * */QE_error_code do_dn_attr_read(baseobject, id_ptr, dn_attr)     char *baseobject;     QCardinal *id_ptr;     stringCell dn_attr;{  readDnAttrRec new_request;  requestRec this_request;    (void) _request_invoked(READ_DN_ATTR, id_ptr);  this_request = _get_request_of_id(*id_ptr);  new_request = this_request->READ_DN_ATTR_REC;  new_request->base_object = copy_string(baseobject);  new_request->read_object = NULLCP;  new_request->request_id = *id_ptr;  new_request->task_id = NO_TASK;  new_request->dn_attr = copy_string_seq(dn_attr);  return start_read(*id_ptr, baseobject, dn_attr, &new_request->task_id);} /* do_dn_attr_read *//* * - process_dn_attr_read_result() - * * */request_state process_read_dn_attr_result(request, task_id, ds_result)     requestRec request;     int task_id;     struct DSResult *ds_result;{  DsTask task_rec;  readDnAttrRec readrec = request->READ_DN_ATTR_REC;  struct ds_read_result *read_result;  attrValList dn_attr = NULLAVList;  /* This shouldn't happen */  if ((task_rec = _get_task_of_id(task_id)) == NULLDsTask)    return RQ_processing;  read_result = &ds_result->res_rd;#ifndef NO_STATS  LLOG (log_stat,	LLOG_NOTICE,	("READ RESULT +%s, task %d", task_rec->baseobject, task_id));#endif  get_read_attrs(read_result->rdr_entry.ent_attr, &dn_attr, EDBOUT);    _task_complete(task_id);    readrec->results = read_res_alloc();  readrec->results->errors = NULLError;  readrec->results->base_object = readrec->base_object;  readrec->base_object = NULLCP;  readrec->results->entry = dn_attr;    return RQ_results_returned;} /* process_dn_attr_read_result *//* * - process_read_ds_error() - * * */request_state process_read_dn_attr_error(request, task_id, error)     requestRec request;     int task_id;     struct DSError *error;{  DsTask task_rec;  readDnAttrRec readrec = request->READ_DN_ATTR_REC;  QE_error_code error_type;  task_rec = _get_task_of_id(task_id);  /* This shouldn't happen */  if (task_rec == NULLDsTask) return RQ_processing;    /* Save error and log it */  error_type = get_log_error_type(error, task_id);  add_error_to_request_rec(request, task_rec->baseobject, error_type, error);  readrec->results = read_res_alloc();  readrec->results->errors = request->errors;  readrec->results->entry = NULLAVList;  readrec->results->base_object = readrec->read_object;  readrec->base_object = NULLCP;  request->errors = NULLError;  /* Remove invocation record for this task */  _task_complete(task_id);  return RQ_results_returned;} /* process_read_dn_attr_error *//* * - get_read_results() - * * */readResults get_read_dn_attr_results(request_id)     QCardinal request_id;{  requestRec request = _get_request_of_id(request_id);  readDnAttrRec readrec;  readResults results;  if (request == NULLReqRec) return NULLReadResults;  readrec = request->READ_DN_ATTR_REC;  results = readrec->results;  readrec->results = NULLReadResults;  _request_complete(request_id);  return results;} /* get_read_dn_attr_results */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -