From 5df79c53745fde5d6c3340a2979b1429cd5892c1 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Sat, 8 Oct 2011 20:30:28 +0200 Subject: Initial import of htcd system 1.0 Signed-off-by: Henrik Rydberg --- src/mt/sfind.f | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/mt/sfind.f (limited to 'src/mt/sfind.f') diff --git a/src/mt/sfind.f b/src/mt/sfind.f new file mode 100644 index 0000000..2cc2954 --- /dev/null +++ b/src/mt/sfind.f @@ -0,0 +1,40 @@ +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +c +c HTCd - Copyright (C) 1998-2006 Henrik Rydberg +c +c This program is free software; you can redistribute it and/or modify +c it under the terms of the GNU General Public License as published by +c the Free Software Foundation; either version 2 of the License, or +c (at your option) any later version. +c +c This program is distributed in the hope that it will be useful, +c but WITHOUT ANY WARRANTY; without even the implied warranty of +c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +c GNU General Public License for more details. +c +c You should have received a copy of the GNU General Public License +c along with this program; if not, write to the Free Software +c Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +c + + integer function sfind(s,sn,c,cn) + character s(0:1),c(0:1) + integer i,j,m,sn,cn + m=mod(cn,4) + do 10 i=0,sn-1 + do 20 j=0,m-1 + if(s(i+j).ne.c(j))go to 50 + 20 continue + do 30 j=m,cn-1,4 + if(s(i+j).ne.c(j))go to 50 + if(s(i+j+1).ne.c(j+1))go to 50 + if(s(i+j+2).ne.c(j+2))go to 50 + if(s(i+j+3).ne.c(j+3))go to 50 + 30 continue + 50 if(j.eq.cn)go to 100 + 10 continue + sfind=-1 + return + 100 sfind=i + return + end -- cgit v1.2.3