📄 criterr.c
字号:
/*
* EBS - RTFS (Real Time File Manager)
*
* Copyright EBS Inc. 1996
* All rights reserved.
* This code may not be redistributed in source or linkable object form
* without the consent of its author.
*/
#include "pcdisk.h"
char *med_st[] =
{
"", "BAD_FORMAT",
"CRERR_NO_CARD", "CRERR_BAD_CARD", "CRERR_CHANGED_CARD",
"CRERR_CARD_FAILURE"
};
static void tstshow(PFCHAR str1)
{
tm_printf_2("%s\n", str1);
}
static void tstshow2(PFCHAR str1, PFCHAR str2)
{
char buf[80];
tc_strcpy(buf, str1);
tc_strcat(buf, str2);
tstshow(buf);
}
int critical_error_handler(int driveno, int media_status, dword sector)
{
char inbuf[20];
DDRIVE *pdr;
BOOLEAN needs_flush;
// If you don't have console input you may return abort unconditionally
// return (CRITICAL_ERROR_ABORT);
pdr = pc_drno_to_drive_struct(driveno);
if (pdr->fat_is_dirty || pc_test_all_fil(pdr))
needs_flush = TRUE;
else
needs_flush = FALSE;
tstshow2("Media status == ", med_st[media_status]);
tstshow2("Volume == ", (PFCHAR)(pdr->volume_label));
if (needs_flush)
tstshow("Volume is dirty");
else
tstshow("Volume is clean");
while(1)
{
inbuf[0] = 'A'; /* If tm_gets is a noop we will still abort */
tm_printf( "Type A to abort R to Retry");
tm_gets( (PFCHAR)inbuf);
pc_str2upper(inbuf, inbuf);
if (inbuf[0] == 'A')
return (CRITICAL_ERROR_ABORT);
else if (inbuf[0] == 'R')
return (CRITICAL_ERROR_RETRY);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -