cmrcheck.c
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· C语言 代码 · 共 91 行
C
91 行
#ifndef lintstatic char *sccsid = "@(#)cmrcheck.c 4.1 (ULTRIX) 7/17/90";#endif lint/************************************************************************ * * * Copyright (c) 1984 by * * Digital Equipment Corporation, Maynard, MA * * All rights reserved. * * * * This software is furnished under a license and may be used and * * copied only in accordance with the terms of such license and * * with the inclusion of the above copyright notice. This * * software or any other copies thereof may not be provided or * * otherwise made available to any other person. No title to and * * ownership of the software is hereby transferred. * * * * This software is derived from software received from the * * University of California, Berkeley, and from Bell * * Laboratories. Use, duplication, or disclosure is subject to * * restrictions under license agreements with University of * * California and with AT&T. * * * * The information in this software is subject to change without * * notice and should not be construed as a commitment by Digital * * Equipment Corporation. * * * * Digital assumes no responsibility for the use or reliability * * of its software on equipment which is not supplied by Digital. * * * ************************************************************************//* EMACS_MODES: c tabstop=4 !fill *//* * cmrcheck -- Check list in p file to see if this cmr is valid. * * */#include "filehand.h"#include <stdio.h>/* Debugging options. */#define MAXLENCMR 12#ifdef TRACE#define TR(W,X,Y,Z) fprintf (stdout, W, X, Y, Z)#else#define TR(W,X,Y,Z) /* W X Y Z */#endif#define CMRLIMIT 128 /* Length of cmr string. */cmrcheck (cmr, appl)char *cmr, *appl;{ char lcmr[CMRLIMIT], /* Local copy of CMR list. */ *p[2], /* Field to match in .FRED file. */ *format = "%s is not a valid CMR.\n"; extern char *rindex (), *gf (); /* Quiet lint. */ TR("Cmrcheck: cmr=(%s) appl=(%s)\n", cmr, appl, NULL); p[1] = EMPTY; strcpy (lcmr, cmr); while ((p[0] = rindex (lcmr, ',')) != EMPTY) { p[0]++; /* Skip the ','. */ if (strlen (p[0]) != MAXLENCMR || sweep (SEQVERIFY, gf (appl), EMPTY, '\n', WHITE, 40, p, EMPTY, (char**) NULL, (int (*)()) NULL, (int (*)()) NULL) != FOUND) { fprintf (stdout, format, p[0]); TR("Cmrcheck: return=1\n", NULL, NULL, NULL); return (1); } p[0]--; /* Go back to comma. */ *p[0] = NULL; /* Clobber comma to end string. */ } TR("Cmrcheck: last entry\n", NULL, NULL, NULL); p[0] = lcmr; /* Last entry on the list. */ if (strlen (p[0]) != MAXLENCMR || sweep (SEQVERIFY, gf (appl), EMPTY, '\n', WHITE, 40, p, EMPTY, (char**) NULL, (int (*)()) NULL, (int (*)()) NULL) != FOUND) { fprintf (stdout, format, p[0]); TR("Cmrcheck: return=1\n", NULL, NULL, NULL); return (1); } TR("Cmrcheck: return=0\n", NULL, NULL, NULL); return (0);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?