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

📄 sense.c

📁 开源备份软件源码 AMANDA, the Advanced Maryland Automatic Network Disk Archiver, is a backup system that a
💻 C
📖 第 1 页 / 共 5 页
字号:
 *	text is a pointer to store the clear text reason from the table. * *	TODO: **/intSense2Action(    char *		ident,    unsigned char	type,    unsigned char	ignsense,    unsigned char	sense,    unsigned char	asc,    unsigned char	ascq,    char **		text){	/*	 * Decode the combination of sense key, ASC, ASCQ and return what to do with this	 * status	 * A future extension could be to call direct a function which handles this case	 *	 */	SenseType_T *pwork = (SenseType_T *)&SenseType;	SenseType_T *generic = NULL;        int in = 0;	dbprintf(_("Sense2Action START : type(%d), ignsense(%d), sense(%02X), asc(%02X), ascq(%02X)\n"),		type,		ignsense,		sense,		asc,		ascq);	while (pwork->ident != NULL)	{		if (strcmp(pwork->ident, "generic") == 0 && pwork->type == type && generic == NULL)		{			generic = pwork;		}		if (strcmp((char *)pwork->ident, (char *)ident) == 0 && pwork->type == type)                {			in = 1;                } else {			if (in == 1)			{				dbprintf(_("Sense2Action       : no match\n"));				break;			}			pwork++;			continue;		}		if (in == 1)		{			/* End of definitions for this device */			if (pwork->sense == UCHAR_MAX)			{				*text = stralloc(pwork->text);				dbprintf(_("Sense2Action   END : no match for %s %s\n"),					pwork->ident,					pwork->vendor);				return(pwork->ret);			}			if (ignsense)			{				if (pwork->asc ==  asc && pwork->ascq == ascq)				{					*text = stralloc(pwork->text);					dbprintf(_("Sense2Action END(IGN) : match for %s %s  return -> %d/%s\n"),						pwork->ident,						pwork->vendor,						pwork->ret,						_(*text));					return(pwork->ret);				}				pwork++;				continue;			}			if (pwork->sense == sense)			{				/* Matching ASC/ASCQ, if yes return the defined result code */				if (pwork->asc ==  asc && pwork->ascq == ascq)				{					*text = (char *)stralloc(pwork->text);					dbprintf(_("Sense2Action   END : match for %s %s  return -> %d/%s\n"),						pwork->ident,						pwork->vendor,						pwork->ret,						_(*text));					return(pwork->ret);				}				/* End of definitions for this sense type, if yes return the default				 * for this type				 */				if ( 	pwork->asc == UCHAR_MAX && pwork->ascq == UCHAR_MAX)				{					*text = (char *)stralloc(pwork->text);					dbprintf(_("Sense2Action   END : no match for %s %s  return -> %d/%s\n"),						pwork->ident,						pwork->vendor,						pwork->ret,						_(*text));					return(pwork->ret);				}			}		}		pwork++;	}	/*	 * Ok no match found, so lets return the values from the generic table	 */	dbprintf(_("Sense2Action generic start :\n"));	while (generic != NULL) {		if (generic->ident == NULL)		   break;		if (generic->sense == UCHAR_MAX)		{			*text = (char *)stralloc(generic->text);			dbprintf(_("Sense2Action generic END : match for %s %s  return -> %d/%s\n"),				generic->ident,				generic->vendor,				generic->ret,				_(*text));			return(generic->ret);		}		if (ignsense)		{			if (generic->asc ==  asc && generic->ascq == ascq)			{				*text = (char *)stralloc(generic->text);				dbprintf(_("Sense2Action generic END(IGN) : match for %s %s  return -> %d/%s\n"),					generic->ident,					generic->vendor,					generic->ret,					_(*text));				return(generic->ret);			}			generic++;			continue;		}		if (generic->sense == sense)		{			/* Matching ASC/ASCQ, if yes return the defined result code */			if (generic->asc ==  asc && generic->ascq == ascq)			{				*text = (char *)stralloc(generic->text);				dbprintf(_("Sense2Action generic END : match for %s %s  return -> %d/%s\n"),					generic->ident,					generic->vendor,					generic->ret,					_(*text));				return(generic->ret);			}			/* End of definitions for this sense type, if yes return the default			 * for this type			 */			if ( 	generic->asc == UCHAR_MAX && generic->ascq == UCHAR_MAX)			{				*text = (char *)stralloc(generic->text);				dbprintf(_("Sense2Action generic END : no match for %s %s  return -> %d/%s\n"),					generic->ident,					generic->vendor,					generic->ret,					_(*text));				return(generic->ret);			}			generic++;			continue;		}		generic++;	}	dbprintf(_("Sense2Action END:\n"));	*text = (char *)stralloc("No match found");	return(SENSE_ABORT);}

⌨️ 快捷键说明

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