util.c

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· C语言 代码 · 共 63 行

C
63
字号
#ifndef lintstatic char *sccsid = "@(#)util.c	4.1	ULTRIX	7/2/90";#endif lint/**************************************************************** *								* *  Licensed to Digital Equipment Corporation, Maynard, MA	* *		Copyright 1985 Sun Microsystems, Inc.		* *			All rights reserved.			* *								* ****************************************************************/#include <stdio.h>#include "util.h"/* * This is just like fgets, but recognizes that "\\n" signals a * continuation  of a line */char *getline(line,maxlen,fp)	char *line;	int maxlen;	FILE *fp;{	register char *p;	register char *start;	start = line;nextline:	if (fgets(start,maxlen,fp) == NULL) {		return(NULL);	}		for (p = start; ; p++) {		if (*p == '\n') {       			if (*(p-1) == '\\') {				start = p - 1;				goto nextline;			} else {				return(line);				}		}	}}		voidfatal(message)	char *message;{	(void) fprintf(stderr,"fatal error: %s\n",message);	exit(1);}

⌨️ 快捷键说明

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