📄 rindex_.c
字号:
#ifndef lintstatic char *sccsid = "@(#)rindex_.c 4.1 (ULTRIX) 7/3/90";#endif lint/************************************************************************ * * * Copyright (c) 1985 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. * * * ************************************************************************//************************************************************************** Modification History** David Metsky, 04-Dec-1985** 001 Replaced a broken version of rindex with a working version from* BSD 4.3. This answers BAR 5m.** Based on: rindex_.c 5.2 6/7/85**************************************************************************//* * find last occurrence of substring in string * * calling sequence: * character*(*) substr, string * indx = rindex (string, substr) * where: * indx will be the index of the first character of the last occurence * of substr in string, or zero if not found. */long rindex_(str, substr, slen, sublen)char *str, *substr; long slen, sublen;{ register char *p = str + (slen - sublen); register char *p1, *p2; register int len; if (sublen == 0) return(0L); while (p >= str) { p1 = p; p2 = substr; len = sublen; while ( *p1++ == *p2++ && --len > 0) ; if ( len <= 0 ) return((long)(++p - str)); p--; } return(0L);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -