📄 mmsafil.c
字号:
/************************************************************************//* SISCO SOFTWARE MODULE HEADER *****************************************//************************************************************************//* (c) Copyright Systems Integration Specialists Company, Inc., *//* 1986 - 1997, All Rights Reserved. *//* *//* MODULE NAME : mmsafil.c *//* PRODUCT(S) : MMSEASE *//* *//* MODULE DESCRIPTION : *//* This module contains functions to initiate MMS File services. *//* These functions are called from the mainloop (check_key). *//* *//* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : *//* *//* MODIFICATION LOG : *//* Date Who Rev Comments *//* -------- --- ------ ------------------------------------------- *//* 11/23/98 EJV 06 Stop checking bytes_read after u_conf called.*//* 10/20/98 RKR 05 Changed get_app_ref to use APP_REF_FORM2 *//* 08/06/98 EJV 04 Print space before number of bytes (do_fcopy)*//* 05/27/98 IKE 03 Removed data conversion warnings when *//* compiling in DOS platform *//* 01/28/98 EJV 02 Eliminated warnings in get_app_ref for *//* Digital Unix (long is 64-bits) *//* 07/29/97 DSF 01 Moved APP_REF to SUIC, must include suicacse.h*//* 04/15/97 DSF 7.00 MMSEASE 7.0 release. See MODL70.DOC for *//* history. *//************************************************************************/#include "glbtypes.h"#include "sysincs.h"#if (SYSTEM_SEL & (MSOFT | OS2))#include <conio.h>#endif#if (SYSTEM_SEL & (OPEN_VMS))ST_INT kbhit ();#endif#include "mms_usr.h"#include "mmsop_en.h"#include "userdefs.h"#include "fkeydefs.h"#include "gvaldefs.h"#include "scrndefs.h"#include "mms_pfil.h"#include "mms_vfil.h"#include "suicacse.h"/************************************************************************//* For debug version, use a static pointer to avoid duplication of *//* __FILE__ strings. *//************************************************************************/#ifdef DEBUG_SISCOstatic ST_CHAR *thisFileName = __FILE__;#endif/************************************************************************//************************************************************************//* do_fcopy *//* create and send a file copy request *//************************************************************************/ST_VOID do_fcopy (ST_VOID) {#if MMS_MV_FCOPY_EN & REQ_EN ST_INT chan;ST_BOOLEAN data_entered;ST_CHAR temp [MAX_FILE_NAME+1];ST_CHAR src_fname [MAX_FILE_NAME];ST_INT sf_len;ST_CHAR dest_fname [MAX_FILE_NAME];ST_INT df_len;ST_CHAR *from;ST_CHAR *to;ST_INT i;ST_INT refnum;ST_BOOLEAN watch_bytes;MMSREQ_PEND *req_ptr;ST_LONG last_count; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } printf ("\n Enter Remote Source File Name : (R) "); if (data_entered = strget (temp)) { temp[MAX_FILE_NAME] = '\x00'; sf_len = strlen (temp); from = temp; to = src_fname; for (i = 0; i < sf_len; i++) *(to++) = *(from++); } if (data_entered) { printf (" Enter Local Destination File Name : (R) "); if (data_entered = strget (temp)) { temp[MAX_FILE_NAME] = '\x00'; df_len = strlen (temp); from = temp; to = dest_fname; for (i = 0; i < df_len; i++) *(to++) = *(from++); } } watch_bytes = (ST_BOOLEAN) ask (" Do you want to monitor transfer progress, cont. send mode only (default = n) :",0); if (data_entered) { m_fcopy_pipe_depth[chan] = 2; printf (" Enter desired Pipeline Depth (default = %d) : ",m_fcopy_pipe_depth[chan]); intget (&m_fcopy_pipe_depth[chan]); if (!(req_ptr = mv_fcopy (chan, src_fname, sf_len, dest_fname, df_len))) print_req_error (); if (watch_bytes && req_ptr) { rep_count = 0; last_count = 0; refnum = ((FCOPY_INFO *)(req_ptr->req_info_ptr)) ->fctrl->refnum; while (!rep_count && !kbhit ()) { last_count = ((FCOPY_INFO *)(req_ptr->req_info_ptr))->fctrl->bytes_read; mms_comm_service (); /* stir up the comm layer. */ if (rep_count) break; /* pointers may not be valid anymore */ if (m_rem_fctrl_info.stat[refnum] != MFSTAT_NO_ACT) { if (last_count != ((FCOPY_INFO *) (req_ptr->req_info_ptr))->fctrl->bytes_read) { BOTTOMSCR; printf (" %ld", ((FCOPY_INFO *)(req_ptr->req_info_ptr)) ->fctrl->bytes_read); } } } wait_msg ("\n press any key to continue"); } else { if (num_reps) /* if this an auto repeat - */ { if (start_cont ()) /* wait for 1st to complete */ return; num_outstanding = 1; while (rep_count < num_reps) /* if enough done - */ { if (! mv_fcopy (chan, src_fname, sf_len, dest_fname, df_len)) break; num_outstanding++; if (cont_serve ()) /* if user hit a key */ return; } cont_done (); /* display results */ } } } else wait_msg ("\n Must Enter All Required Information "); (*menu_set_fun) ();#endif }/************************************************************************//* do_obtfile *//* create and send an obtain file request *//************************************************************************/ST_VOID do_obtfile (ST_VOID) {#if MMS_OBTAINFILE_EN & REQ_ENOBTFILE_REQ_INFO *info;ST_INT data_entered;ST_INT chan;ST_UCHAR artitle[50];ST_CHAR *fname_str;FILE_NAME *fname_idx; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } info = (OBTFILE_REQ_INFO *) (dest_buffer); /* use 3 - 5K for file names */ fname_str = (dest_buffer + 2048); if ((info->ar_title_pres = (ST_BOOLEAN) ask ("\n Do you want to enter Application Reference Title (y,n) (default = n) :\n",0))) { info->ar_title = get_asn1_app_ref (&(info->ar_len), artitle, 50); } printf (" Enter Local Source File Name : \n"); fname_idx = (FILE_NAME *)(info + 1); data_entered = get_fname_list (fname_idx, 1024, &info -> num_of_src_fname, fname_str); if (data_entered) { printf ("\n Enter Remote Destination File Name : \n"); fname_idx += info -> num_of_src_fname; fname_str = (dest_buffer + 3072); data_entered = get_fname_list (fname_idx, 1024, &info -> num_of_dest_fname, fname_str); } if (data_entered) { if (!mp_obtfile (chan,info)) print_req_error (); if (num_reps) /* if this an auto repeat - */ { if (start_cont ()) /* wait for 1st to complete */ return; num_outstanding = 1; while (rep_count < num_reps) /* if enough done - */ { if (! mp_obtfile (chan, info)) break; num_outstanding++; if (cont_serve ()) /* if user hit a key */ return; } cont_done (); /* display results */ } } else wait_msg ("\n Must Enter All Required Information "); (*menu_set_fun) ();#endif }/************************************************************************//* do_fopen *//* create and send a file open request *//************************************************************************/ST_VOID do_fopen (ST_VOID) {#if MMS_MV_FOPEN_EN & REQ_ENST_INT chan;ST_LONG temp;ST_INT fn_len;ST_UINT32 init_pos;ST_CHAR filename[MAX_FILE_NAME+1]; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } printf ("\n Enter File Name : (R) "); if (strget (filename)) { filename [MAX_FILE_NAME] = '\x00'; fn_len = strlen (filename); } else { (*menu_set_fun) (); return; } printf (" Enter Initial Position (default = 0) :"); if (longget (&temp)) init_pos = (ST_UINT32) temp; else init_pos = 0; if (!mv_fopen (chan, filename, fn_len, init_pos)) print_req_error (); (*menu_set_fun) ();#endif }/************************************************************************//* do_fread *//* create and send a file read request *//************************************************************************/ST_VOID do_fread (ST_VOID) {#if MMS_MV_FREAD_EN & REQ_ENST_INT chan;ST_INT refnum;ST_LONG num_of_bytes;ST_BOOLEAN data_entered; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } printf ("\n Enter Remote File Reference Number : (R) "); if (data_entered = intget (&refnum)) { if (m_rem_fctrl_info.stat [refnum] != 2) { wait_msg ("Remote File NOT open "); (*menu_set_fun) (); return; } } if (data_entered) { printf (" Enter Number of Bytes to Read : (R) "); data_entered = longget (&num_of_bytes); } if (data_entered) { if (num_of_bytes >= 10000 ) /* dest_buffer is malloced in u_data */ num_of_bytes = 10000; if (!mv_fread (chan,refnum,(ST_UCHAR *)dest_buffer,num_of_bytes)) print_req_error (); if (num_reps) /* if this an auto repeat - */ { if (start_cont ()) /* wait for 1st to complete */ return; num_outstanding = 1; while (rep_count < num_reps) /* if enough done - */ { if (!mv_fread (chan,refnum,(ST_UCHAR *)dest_buffer,num_of_bytes)) break; num_outstanding++; if (cont_serve ()) /* if user hit a key */ return; } cont_done (); /* display results */ } } else wait_msg ("\n Must Enter All Required Information ");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -