getline.c
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· C语言 代码 · 共 52 行
C
52 行
#ifndef lintstatic char *sccsid = "@(#)getline.c 4.1 (ULTRIX) 7/17/90";#endif lint#include "../hdr/defines.h"/* Routine to read a line into the packet. The main reason for it is to make sure that pkt->p_wrttn gets turned off, and to increment pkt->p_slnno.*/char *getline(pkt)register struct packet *pkt;{ char *n, *fgets(); register char *p; if(pkt->p_wrttn==0) putline(pkt,(char *) 0); if ((n = fgets(pkt->p_line,sizeof(pkt->p_line),pkt->p_iop)) != NULL) { pkt->p_slnno++; pkt->p_wrttn = 0; for (p = pkt->p_line; *p; ) pkt->p_chash += *p++; } else { if (!pkt->p_reopen) { fclose(pkt->p_iop); pkt->p_iop = 0; } if (!pkt->p_chkeof) fatal("premature eof (co5)"); if (pkt->do_chksum && (pkt->p_chash ^ pkt->p_ihash)&0xFFFF) fatal("corrupted file (co6)"); if (pkt->p_reopen) { fseek(pkt->p_iop,0L,0); pkt->p_reopen = 0; pkt->p_slnno = 0; pkt->p_ihash = 0; pkt->p_chash = 0; pkt->p_nhash = 0; pkt->p_keep = 0; pkt->do_chksum = 0; } } return(n);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?