fcrc.c

来自「umon bootloader source code, support mip」· C语言 代码 · 共 55 行

C
55 行
字号
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "utils.h"
#include "crc32.h"
#ifndef BUILD_WITH_VCC
#include <unistd.h>
#endif

#ifndef O_BINARY
#define O_BINARY 0
#endif

int debug;

/* Run the same CRC on a file as is run in the "mt -C" command
 * in the monitor...
 */

int
main(int argc,char *argv[])
{
	char *buf;
	int	ifd, opt;
	unsigned long crc;
	struct	stat	mstat;

	while((opt=getopt(argc,argv,"V")) != EOF) {
		switch(opt) {
			case 'V':
				showVersion();
				break;
			default:
				exit(1);
		}
	}
	if (argc != optind + 1)
		usage(0);

	if (fcrc32(argv[optind],&crc,1) < 0)
		usage(0);

	exit(0);
}

char *usage_txt[] = {
	"Usage: fcrc [options] {ifile}",
	" Run the same CRC as is used in 'mt -c'",
	" Options:",
	" -V   show version (build date) of tool",
	(char *)0,
};

⌨️ 快捷键说明

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