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

📄 mmsamisc.c

📁 ICCP Toolkit 是在 Tru64下开发Tase.2通信协议的开发包
💻 C
📖 第 1 页 / 共 5 页
字号:
/* file name count argument.						*//************************************************************************/ST_INT get_fname_list (FILE_NAME *file_name_ptr,	ST_INT	upper_bounds,	ST_INT	*file_count_ptr,	ST_CHAR	*fname_space_ptr)  {ST_INT total_len = 0;ST_BOOLEAN done = SD_FALSE;ST_CHAR	temp[MAX_FILE_NAME+1];ST_INT len;ST_INT data_entered = 0;FILE_NAME	*file_idx;  *file_count_ptr = 0;  file_idx = file_name_ptr;  while (!done)    {    printf (" Enter File Name : (R) ");    if (strget (temp))      {      temp[MAX_FILE_NAME] = '\x00';      len = strlen (temp);      data_entered = len;      if ((total_len += len + 1) < upper_bounds)        {	(*file_count_ptr)++;	strcpy (fname_space_ptr, temp);	file_idx -> fn_len = len;	file_idx -> fname = fname_space_ptr;	file_idx++;	fname_space_ptr += len + 1;	}      else        {	done = SD_TRUE;	wait_msg (" File name list too long, last file name was lost");	}      }    else      done = SD_TRUE;    }  return (data_entered);  }/************************************************************************//*			do_mms_err					*//* function to get an error code from the user and print out its 	*//* description using ms_perror.						*//************************************************************************/ST_VOID do_mms_err (ST_VOID)  {ST_INT code;    printf ("\n Enter Error Code : ");    if (intget (&code))      {      ms_perror (code);      wait_msg ("");      }  (*menu_set_fun)();  }/************************************************************************//************************************************************************/ST_VOID mem_chk_error_detected (ST_VOID)  {static ST_INT firstTime = SD_TRUE;  if (firstTime)    {    firstTime = SD_FALSE;    printf ("\n Memory Error Detected! Check log file");    printf ("\n Future errors will not be ennunciated");    wait_msg (" Hit a key to continue ...");    }  }#ifdef CFG_FILE_LOGGING/************************************************************************//*			     m_set_log_config				*//************************************************************************/ST_RET 	m_set_log_config (ST_CHAR *logging_control_filename)  {LOG_CTRL *lc;FILE	*file_ptr;/* Allocate mem for Logging Control struct                         	*//* trap mem_chk errors							*/  mem_chk_err = mem_chk_error_detected;/* Initialize the logging for MMS-EASE					*/  lc = sLogCtrl;/* Set the flags that should normally be turned on 			*/  lc->mc.ctrl = MEM_CTRL_MSG_HDR_EN;  lc->fc.ctrl = (FIL_CTRL_WIPE_EN |                  FIL_CTRL_WRAP_EN |                  FIL_CTRL_MSG_HDR_EN);/* NOTE: Setting up defaults is only requried when there is no		*//* logging configuration file to deal with.				*/  if (!(file_ptr = fopen (logging_control_filename,"r")))    {/* If no file is present, use defaults					*//* Use File logging							*/    lc->logCtrl = LOG_FILE_EN;/* Use time/date time log						*/    lc->logCtrl |= (LOG_TIMEDATE_EN | LOG_TIME_EN);/* File Logging Control defaults 					*/    lc->fc.fileName = "mms.log";    lc->fc.maxSize = 250000L;    lc->fc.ctrl = (FIL_CTRL_WIPE_EN |                    FIL_CTRL_WRAP_EN |                    FIL_CTRL_MSG_HDR_EN);    }  else    {    fclose (file_ptr);    m_readLogCfg (logging_control_filename, lc);    }  return (SD_SUCCESS);  }/************************************************************************//*                             m_readLogCfg                            *//************************************************************************/static ST_VOID     m_readLogCfg (                        ST_CHAR            *logging_control_filename,                        LOG_CTRL        *lc)  {ST_RET  ret_val;  /* If errors in configuration file, use defaults                      */  user_file_log_en_flg = SD_FALSE;  user_mem_log_en_flg = SD_FALSE;  ret_val = cfg_process_file (logging_control_filename, mlog_base_kwtbl);   /* check for errors encountered by the state functions                */  if (ret_val == SD_SUCCESS)    {    /* If user doesn't have FileLogEn flag set, disable default value   */    if (!user_file_log_en_flg)      M_CLR_CTRL (LOG_FILE_EN);    /* If user doesn't have MemLogEn flag set, disable default value    */    if (!user_mem_log_en_flg)      M_CLR_CTRL (LOG_MEM_EN);    }  else    {    /* Turn on logging and parse the file again                         */    m_set_parser_logging ("MMS_LOG.ERR");    cfg_process_file (logging_control_filename, mlog_base_kwtbl);    /*p_clear_logging ();*/    /* Restore default values  */    /*m_default_slog_values (lc);*/    }     }/************************************************************************//*                         m_set_parser_logging				*//* Only do this when error (s) are encountered parsing the mms_log.cfg.	*//* The effect is to make the parser verbose and run the file through it	*//* a second time.  A file called "MMS_LOG.ERR" is created on the second	*//* parse.  Edit "MMS_LOG.ERR" with a text editor and 9 times out of 10  *//* the last entries in the file will lead you directly to the line  	*//* causing the problem in "MMS_LOG.CFG".				*//************************************************************************/#define MMR_SET_CTRL(a)      {cfg_sLogCtrl->logCtrl |=  (a);}#define MMR_SET_FILE_CTRL(a) {cfg_sLogCtrl->fc.ctrl |=  (a);}ST_VOID 	m_set_parser_logging (ST_CHAR *log_filename)  {/* Initialize the logging for the Operator Console			*/  cfg_sLogCtrl = calloc (1, sizeof (LOG_CTRL));/* Use File logging                                                     */  MMR_SET_CTRL (LOG_FILE_EN);/* Use differential time log                                            */  MMR_SET_CTRL (LOG_DIFFTIME_EN | LOG_TIME_EN);/* File Logging Control defaults                                        */  cfg_sLogCtrl->fc.fileName = log_filename;  cfg_sLogCtrl->fc.maxSize = 1000000;  MMR_SET_FILE_CTRL (FIL_CTRL_WIPE_EN |                      FIL_CTRL_NO_APPEND |                     FIL_CTRL_WRAP_EN |                      FIL_CTRL_MSG_HDR_EN);  cfg_log_mask = CFG_LOG_ERR | CFG_LOG_FLOW;  }/*------------- Internal functions for handling state tables -----------*/  /************************************************************************//*                         cfg_mlog_begin                              *//************************************************************************//* Initial state for parsing Logging configuration file                 */ST_VOID  cfg_mlog_begin (ST_VOID)  {#ifdef S_TABLE_DEBUG  printf ("\ncfg_mlog_begin: entered.");#endif  /* Configuration file successfully opened *//*  if (cfg_tbl_push (mlog_logging_ctrl_begin_kwtbl) != SD_SUCCESS) */  if (cfg_tbl_push (mlog_log_mask_kwtbl) != SD_SUCCESS)     cfg_set_config_err ();  }/************************************************************************//*                         cfg_mlog_lc_file_log_en                     *//************************************************************************/ST_VOID  cfg_mlog_lc_file_log_en (ST_VOID)  {#ifdef S_TABLE_DEBUG  printf ("\ncfg_mlog_lc_file_log_en: entered.");#endif  /* Found 'FileLogEn' flag                                             */  M_SET_CTRL (LOG_FILE_EN);  user_file_log_en_flg = SD_TRUE;  }/************************************************************************//*                         cfg_mlog_lc_mem_log_en                      *//************************************************************************/ST_VOID  cfg_mlog_lc_mem_log_en (ST_VOID)  {#ifdef S_TABLE_DEBUG  printf ("\ncfg_mlog_lc_mem_log_en: entered.");#endif  /* Found 'MemLogEn' flag                                              */  M_SET_CTRL (LOG_MEM_EN);  user_mem_log_en_flg = SD_TRUE;  }#ifdef LOG_IPC_SUPPORT/************************************************************************//*                         cfg_mlog_lc_ipc_log_en                      *//************************************************************************/ST_VOID  cfg_mlog_lc_ipc_log_en (ST_VOID)  {#ifdef S_TABLE_DEBUG  printf ("\ncfg_mlog_lc_ipc_log_en: entered.");#endif  /* Found 'IpcLogEn' flag                                              */  M_SET_CTRL (LOG_IPC_EN);  }#endif/************************************************************************//*                         cfg_mlog_lc_hard_flush                      *//************************************************************************/ST_VOID  cfg_mlog_lc_hard_flush (ST_VOID)  {#ifdef S_TABLE_DEBUG  printf ("\ncfg_mlog_lc_hard_flush: entered.");#endif  /* Found 'HardFlush' flag                                             */  M_SET_FILE_CTRL (FIL_CTRL_HARD_FLUSH);  /* Hard flush is requested  */  }/************************************************************************//*                         cfg_mlog_lc_no_append                       *//************************************************************************/ST_VOID  cfg_mlog_lc_no_append (ST_VOID)  {#ifdef S_TABLE_DEBUG  printf ("\ncfg_mlog_lc_no_append: entered.");#endif  /* Found 'NoAppend' flag                                              */  M_SET_FILE_CTRL (FIL_CTRL_NO_APPEND);  /* overwrite is requested    */  }/************************************************************************//*                         cfg_mlog_lc_no_msg_header                   *//************************************************************************/ST_VOID  cfg_mlog_lc_no_msg_header (ST_VOID)  {#ifdef S_TABLE_DEBUG  printf ("\ncfg_mlog_lc_no_msg_header: entered.");#endif  /* Found 'NoMsgheader' flag                                           */  M_CLR_FILE_CTRL (FIL_CTRL_MSG_HDR_EN);   M_CLR_MEM_CTRL (MEM_CTRL_MSG_HDR_EN);   }/************************************************************************//*                         cfg_mlog_lc_no_wipe                         *//************************************************************************/ST_VOID  cfg_mlog_lc_no_wipe (ST_VOID)  {#ifdef S_TABLE_DEBUG  printf ("\ncfg_mlog_lc_no_wipe: entered.");#endif  /* Found 'NoWipe' flag                                                */  M_CLR_FILE_CTRL (FIL_CTRL_WIPE_EN);  }/************************************************************************//*                         cfg_mlog_lc_no_wrap                         *//************************************************************************/ST_VOID  cfg_mlog_lc_no_wrap (ST_VOID)  {#ifdef S_TABLE_DEBUG  printf ("\ncfg_mlog_lc_no_wrap: entered.");#endif  /* Found 'NoWrap' flag                                                */  M_CLR_FILE_CTRL (FIL_CTRL_WRAP_EN);  }/************************************************************************//*                         cfg_mlog_lc_setbuf                          *//************************************************************************/ST_VOID  cfg_mlog_lc_setbuf (ST_VOID)  {#ifdef S_TABLE_DEBUG  printf ("\ncfg_mlog_lc_setbuf: entered.");#endif  /* Found 'Setbuf' flag                                                */  M_SET_FILE_CTRL (FIL_CTRL_SETBUF_EN);  /* Setbuf is requested       */  }/************************************************************************//*                         cfg_mlog_mem_auto_dump                      *//************************************************************************/ST_VOID  cfg_mlog_mem_auto_dump (ST_VOID)  {#ifdef S_TABLE_DEBUG  printf ("\ncfg_mlog_mem_auto_dump: entered.");#endif  /* Found 'MemAutoDump' flag                                           */  M_SET_MEM_CTRL (MEM_CTRL_AUTODUMP_EN);   /* autodump                */  }/************************************************************************//*                         cfg_mlog_log_file_name                      *//************************************************************************/ST_VOID  cfg_mlog_log_file_name (ST_VOID)  {  ST_CHAR  *fname;#ifdef S_TABLE_DEBUG  printf ("\ncfg_mlog_log_file_name: entered.");#endif  /* Found 'LogFileName' keyword, read the user defined log file name   */  if ((fname = cfg_get_string_ptr ()) != NULL)    {    strcpy (log_file_name, fname);    sLogCtrl->fc.fileName = log_file_name;    }  else    cfg_set_config_err ();}/************************************************************************//*                         cfg_mlog_log_mem_items                      *//************************************************************************/ST_VOID  cfg_mlog_log_mem_items (ST_VOID)  {  ST_UINT val; #ifdef S_TABLE_DEBUG  printf ("\ncfg_mlog_log_mem_items: entered.");#endif  /* Found 'LogMemItems' keyword, get the value                         */  if (cfg_get_uint (&val) == SD_SUCCESS)    {    sLogCtrl->mc.maxItems = val;    /* Max num of writes to mem before*/                                    /* flushing to file                 */    }  else    {    cfg_set_config_err ();    }  }/************************************************************************//*                         cfg_mlog_log_file_size                      *//************************************************************************/ST_VOID  cfg_mlog_log_file_size (ST_VOID)  {

⌨️ 快捷键说明

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