* reordered a little bit
[mascara-docs.git] / i86 / elks / elkscmd / levee / ucsd.c
blob7ac13389ed1da33b860713aa4cf335f4966a8859
1 /*
2 * LEVEE, or Captain Video; A vi clone
4 * Copyright (c) 1982-1997 David L Parsons
5 * All rights reserved.
7 * Redistribution and use in source and binary forms are permitted
8 * provided that the above copyright notice and this paragraph are
9 * duplicated in all such forms and that any documentation,
10 * advertising materials, and other materials related to such
11 * distribution and use acknowledge that the software was developed
12 * by David L Parsons (orc@pell.chi.il.us). My name may not be used
13 * to endorse or promote products derived from this software without
14 * specific prior written permission. THIS SOFTWARE IS PROVIDED
15 * AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
16 * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
17 * FITNESS FOR A PARTICULAR PURPOSE.
19 #include "levee.h"
20 #include "extern.h"
22 #ifndef moveleft
24 PROC
25 moveleft(src,dest,length)
26 register char *src;
27 register char *dest;
28 register int length;
30 while (--length >= 0)
31 *(dest++) = *(src++);
34 #endif /*moveleft*/
36 #ifndef moveright
38 PROC
39 moveright(src,dest,length)
40 register char *src,*dest;
41 register int length;
43 src = &src[length];
44 dest = &dest[length];
45 while (--length >= 0)
46 *(--dest) = *(--src);
49 #endif /*moveright*/
51 #ifndef fillchar
53 PROC
54 fillchar(src,length,ch)
55 register char *src,ch;
56 register int length;
58 while (--length >= 0)
59 *(src++) = ch;
62 #endif
64 int PROC
65 scan(length,tst,ch,src)
66 int length;
67 char tst,ch;
68 register char *src;
70 register inc,l;
72 if (length < 0)
73 inc = -1;
74 else
75 inc = 1;
76 if (tst == '!') {
77 for(l = ((int)inc)*length; l > 0; l--,src += (long)inc)
78 if (*src != ch)
79 break;
81 else {
82 for(l = ((int)inc)*length; l > 0; l--,src += (long)inc)
83 if (*src == ch)
84 break;
86 return length-(inc*l);