File: chk_fmsg.c

package info (click to toggle)
arj 3.10.22-28
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,964 kB
  • sloc: ansic: 33,002; makefile: 2,014; sh: 1,587; asm: 436
file content (49 lines) | stat: -rw-r--r-- 1,126 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * $Id: chk_fmsg.c,v 1.2 2003/02/07 17:21:01 andrew_belov Exp $
 * ---------------------------------------------------------------------------
 * The purpose of this module is to check the integrity of the message section
 * by comparing its CRC-32 with the stored value.
 *
 */

#include "arj.h"

DEBUGHDR(__FILE__)                      /* Debug information block */

/* Checks the integrity of FMSG section. Reports CRC error in case of CRC
   mismatch. */

void check_fmsg(int skip_check)
{
 FMSGP *index_ptr;
 #if SFX_LEVEL>=ARJ
  char fmsg_buf[MSGTEXT_MAX];
 #endif

 crc32term=CRC_MASK;
 #if SFX_LEVEL>=ARJ
 if(skip_check!=CHKMSG_SKIP)
 #else
 if(skip_check==CHKMSG_SKIP)
 #endif
 {
  for(index_ptr=FARMSGS; *index_ptr!=NULL; index_ptr++)
  {
   #ifdef FMSG_ST
    far_strcpyn((char FAR *)fmsg_buf, (char FAR *)*index_ptr, sizeof(fmsg_buf));
    crc32_for_string(fmsg_buf);
   #else
    crc32_for_string(*index_ptr);
   #endif
  }
  if(crc32term!=FARMSGS_CRC32)
   error(M_CRC_ERROR);
 }
 #if SFX_LEVEL<=ARJSFXV
 else
 {
  msg_cprintf(0, strform, M_SFX_USAGE);
  msg_cprintf(0, strform, M_SFX_COMMANDS);
 }
 #endif
}