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

📄 chkfsize.c

📁 Boot code for ADM5120 with serial console for Edimax router.
💻 C
字号:
/* *	Tool to determine whether a file exceeds a given size. *	Author: HH *	Copyright 2006 HH, All Rights Reserved */#include <sys/stat.h>#include <unistd.h>void usage(char *me){	printf("Usage: %s input-file MAXSIZE\n", me);	printf("       where MAXSIZE is the maximum file size for which the program\n");	printf("       will return 0.  If the input-file size is greater than MAXSIZE\n");	printf("       the program will return 1.  Intended for use with Makefiles.\n");}int main(int argc, char** argv){	char *infile = NULL;	int fh, size, rc = 1;	struct stat status;	/*	Parse input arguments */	if ((argc != 3) || (sscanf(argv[2], "%i", &size) != 1)) {		usage((char *) basename(argv[0]));	} else {		/*	Input arguments look good */		infile  = argv[1];		if (stat(infile, &status) < 0) {			printf("%s: Can't stat file \"%s\"\n", basename(argv[0]), infile);		} else {			if (status.st_size <= size)				rc = 0;			else				printf("%s: File \"%s\" exceeds %d bytes (0x%.8X) in size\n", basename(argv[0]), infile, size, size);		}	}	return rc;}

⌨️ 快捷键说明

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