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

📄 mkmsg.c

📁 mips架构的bootloader,99左右的版本 但源代码现在没人更新了
💻 C
字号:
/************************************************************* * File: tools/mkmsg.c * Purpose: Generate text files during the make process * Author: Phil Bunce (pjb@carmel.com) * Revision History: *	970221	Deleted the stuff about "auto generated file - do not edit" *	970313	Reinstated stuff about "auto generated file..." */#include <stdio.h>#include <time.h>#define strequ(x,y)	((strcmp((x),(y))==0)?1:0)main(argc,argv)int argc;char *argv[];{char *name,*value,*ofile,*ifile,*p;long now;int i,c;FILE *ofp,*ifp;name = value = ofile = ifile = 0;ofp = stdout;for (i=1;i<argc;i++) {	if (argv[i][0] == '-') {		if (argv[i][1] == 'o') {			i++;			if (i >= argc) break;			ofile = argv[i];			}		else if (argv[i][1] == 'f') {			i++;			if (i >= argc) break;			ifile = argv[i];			}		else if (argv[i][1] == 'd') {			now = time(0L);			value = ctime(&now);			if (value[strlen(value)-1] == '\n') 				value[strlen(value)-1] = 0;			}		else {			fprintf(stderr,"%c: bad option\n",argv[i][1]);			exit(1);			}		}	else {		if (!name) name = argv[i];		else value = argv[i];		}	}if (ifile) {	ifp = fopen(ifile,"r");	if (!ifp) {		fprintf(stderr,"can't open %s\n",ifile);		exit(1);		}	value = (char *)malloc(200);	for (p=value,i=0;i<200;i++) {		c = getc(ifp);		if (c == EOF) break;		if (c == '\r' ||c == '\n') continue;		if (isspace(c)) c = ' ';		*p++ = c;		}	*p = 0;	fclose(ifp);	}		if (!name || !value) {	fprintf(stderr,"usage: mkmsg [-o ofile] name {value|-date|-f file}\n");	exit(1);	}if (ofile) {	ofp = fopen(ofile,"w");	if (ofp == 0) {		fprintf(stderr,"can't open %s\n",ofile);		exit(1);		}	}fprintf(ofp,"/* this file was generated automatically - do not edit */\n");fprintf(ofp,"char %s[] = \"%s\";\n",name,value);exit(0);}

⌨️ 快捷键说明

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