📄 stadev.c
字号:
/*-----------------------------------------------------*/ rc = sct_interface(sct_id, command, &request, &response); if (rc < 0) { sca_errno = sct_errno; sca_errmsg = sct_errmsg; err_analyse(sct_id); return (-1); } /*-----------------------------------------------------*/ /* Normal End (Release storage) */ /*-----------------------------------------------------*/ sta_aux_bytestr_free(&response);#ifdef TEST fprintf(stdout, "\n***** Normal end of sca_init_sc *********************************************\n\n");#endif return (sca_errno);} /* end sca_init_sc *//*-------------------------------------------------------------*//* E N D O F P R O C E D U R E sca_init_sc *//*-------------------------------------------------------------*//*-------------------------------------------------------------*//* | GMD *//* +-----*//* PROC sca_get_sc_info VERSION 1.0 *//* DATE Juni 1992 *//* BY L.Eckstein *//* *//* DESCRIPTION *//* Get information about smartcard *//* *//* *//* IN DESCRIPTION *//* sct_id SCT identifier *//* *//* *//* OUT *//* sc_info historical characters *//* *//* *//* RETURN DESCRIPTION *//* 0 o.k *//* -1 error *//* ENOCARD *//* *//* CALLED FUNCTIONS *//* check_sct_sc ERROR-Codes *//* ENOCARD *//* ESIDUNK *//* ENOSHELL *//* EOPERR *//* EEMPTY *//* EMEMAVAIL *//* ECLERR *//* ERDERR *//* EINVARG *//* ETOOLONG *//* sw1/sw2 from SCT response *//* T1 - ERROR *//* *//*-------------------------------------------------------------*/intsca_get_sc_info(sct_id, sc_info) int sct_id; OctetString *sc_info;{ /*----------------------------------------------------------*/ /* Definitions */ /*----------------------------------------------------------*/ int rc, i; /*----------------------------------------------------------*/ /* Statements */ /*----------------------------------------------------------*/ rc = 0; sca_errno = M_NOERR; sca_errmsg = NULL;#ifdef TEST fprintf(stdout, "\n***** STAMOD-Routine sca_get_sc_info *****\n\n"); fprintf(stdout, "TRACE of the input parameters : \n"); fprintf(stdout, "sct_id : %d\n", sct_id);#endif /*-------------------------------------*/ /* call sct_info */ /*-------------------------------------*/#ifdef PROCDAT /* * "sct_info()" calls "get_idelem()", * "get_idelem()" calls "sca_read_SCT_config()", which calls "COMinit()" * If "COMinit()" fails, the calling function should get the error code. * */ rc = sct_info(sct_id, &sctinfo); if (rc < 0) { sca_errno = sct_errno; sca_errmsg = sct_errmsg; return (-1); }#else sct_info(sct_id, &sctinfo);#endif /*-------------------------------------*/ /* get historical characters out of */ /* sctinfo-structure */ /*-------------------------------------*/ if ((sctinfo.history_sc == NULL) || ((sc_info->noctets = strlen(sctinfo.history_sc)) == 0)) { sca_errno = ENOCARD; set_errmsg(); return (-1); } if ((sc_info->octets = (char *) malloc(sc_info->noctets)) == NULL) { sca_errno = M_EMEMORY; set_errmsg(); return (-1); } for (i = 0; i < sc_info->noctets; i++) *(sc_info->octets + i) = *(sctinfo.history_sc + i);#ifdef TEST fprintf(stdout, "TRACE of the output parameters : \n"); fprintf(stdout, "sc_info : \n"); fprintf(stdout, " noctets : %d\n", sc_info->noctets); fprintf(stdout, " octets : \n"); aux_fxdump(stdout, sc_info->octets, sc_info->noctets, 0); fprintf(stdout, "\n***** Normal end of sca_get_sc_info *****\n\n");#endif return (0);} /* end sca_get_sc_info *//*-------------------------------------------------------------*//* E N D O F P R O C E D U R E sca_get_sc_info *//*-------------------------------------------------------------*//*-------------------------------------------------------------*//* | GMD *//* +-----*//* PROC sca_get_sct_info VERSION 1.0 *//* DATE Juni 1992 *//* BY L.Eckstein *//* *//* DESCRIPTION *//* Get information about registered SCT's. *//* *//* *//* IN DESCRIPTION *//* *//* OUT *//* *//* *//* RETURN DESCRIPTION *//* n number of registered SCT's *//* -1 error *//* *//* CALLED FUNCTIONS *//* sct_list ERROR-Codes *//* ENOSHELL *//* EOPERR *//* EEMPTY *//* EMEMAVAIL *//* ECLERR *//* ESIDUNK *//* *//* *//* *//*-------------------------------------------------------------*/intsca_get_sct_info(){ /*----------------------------------------------------------*/ /* Definitions */ /*----------------------------------------------------------*/ int rc; /*----------------------------------------------------------*/ /* Statements */ /*----------------------------------------------------------*/ rc = 0; sca_errno = M_NOERR; sca_errmsg = NULL;#ifdef TEST fprintf(stdout, "\n***** STAMOD-Routine sca_get_sct_info *********************************************\n\n");#endif rc = sct_list(); if (rc < 0) { sca_errno = sct_errno; sca_errmsg = sct_errmsg; return (-1); }#ifdef TEST fprintf(stdout, "output-parameters:\n"); fprintf(stdout, "No. of SCT's : %d\n", rc); fprintf(stdout, "\n***** Normal end of sca_get_sct_info *********************************************\n\n");#endif return (rc);} /* end sca_get_sct_info *//*-------------------------------------------------------------*//* E N D O F P R O C E D U R E sca_get_sct_info *//*-------------------------------------------------------------*//*-------------------------------------------------------------*//* | GMD *//* +-----*//* PROC sca_eject_sc VERSION 1.0 *//* DATE Januar 1992 *//* BY U.Viebeg *//* *//* DESCRIPTION *//* Eject smartcard. *//* A smartcard must be inserted *//* *//* *//* IN DESCRIPTION *//* sct_id SCT identifier *//* *//* display_text text which shall be *//* displayed on the SCT- *//* display or the NULL-Pointer *//* alarm = TRUE - acoustic alarm signal *//* = FALSE - no alarm signal *//* OUT *//* *//* *//* *//* RETURN DESCRIPTION *//* 0 o.k *//* -1 error *//* M_EALARM *//* M_ETEXT *//* *//* CALLED FUNCTIONS *//* check_sct_sc ERROR-Codes *//* ENOCARD *//* ESIDUNK *//* ENOSHELL *//* EOPERR *//* EEMPTY *//* EMEMAVAIL *//* ECLERR *//* ESIDUNK *//* ERDERR *//* EINVARG *//* ETOOLONG *//* sw1/sw2 from SCT response *//* T1 - ERROR *//* *//* sct_interface ERROR-Codes *//* EINVARG *//* ETOOLONG *//* EMEMAVAIL *//* ESIDUNK *//* EPARMISSED *//* INVPAR *//* EINVINS *//* sw1/sw2 from SCT response *//* T1 - ERROR *//* *//* sta_aux_bytestr_free *//* *//* err_analyse ERROR_Codes *//* ENOSHELL *//* EOPERR *//* EEMPTY *//* ECLERR *//* ESIDUNK *//* ERDERR *//* *//* *//* set_errmsg *//* *//*-------------------------------------------------------------*/intsca_eject_sc(sct_id, display_text, alarm) int sct_id; char *display_text; Boolean alarm;{ /*----------------------------------------------------------*/ /* Definitions */ /*----------------------------------------------------------*/ int rc; Bytestring bstring; /*----------------------------------------------------------*/ /* Statements */ /*----------------------------------------------------------*/ rc = 0; sca_errno = M_NOERR; sca_errmsg = NULL; sc_expect = TRUE; /* this function needs the SC */#ifdef TEST fprintf(stdout, "\n***** STAMOD-Routine sca_eject_sc *********************************************\n\n"); fprintf(stdout, "input-parameters:\n"); fprintf(stdout, "sct_id: %d\n", sct_id); fprintf(stdout, "display_text: %s\n", display_text); if (alarm == TRUE) fprintf(stdout, "alarm switched on\n"); else fprintf(stdout, "alarm switched off\n"); fprintf(stdout, "\n\n");#endif /*-----------------------------------------------------*/ /* call check_sct_sc */ /*-----------------------------------------------------*/ if (check_sct_sc(sct_id, sc_expect) == -1) return (-1); /*-----------------------------------------------------*/ /* Check input parameters */ /*-----------------------------------------------------*/ if (display_text != NULL) { if (strlen(display_text) > MAXL_SCT_DISPLAY) { sca_errno = M_ETEXT; set_errmsg(); return (-1); } } if ((alarm != TRUE) && (alarm != FALSE)) { sca_errno = M_EALARM; set_errmsg(); return (-1); } /*-----------------------------------------------------*/ /* Prepare parameters for the SCT Interface */ /*-----------------------------------------------------*/ command = S_EJECT_SC;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -