date and time created 87/02/15 16:03:37 by lepreau
authorJay Lepreau <lepreau@ucbvax.Berkeley.EDU>
Mon, 16 Feb 1987 08:03:37 +0000 (00:03 -0800)
committerJay Lepreau <lepreau@ucbvax.Berkeley.EDU>
Mon, 16 Feb 1987 08:03:37 +0000 (00:03 -0800)
SCCS-vsn: local/sccscmds/sccscmds.2/util/substr.c 1.1
SCCS-vsn: local/sccscmds/sccscmds.ok/util/substr.c 1.1

usr/src/local/sccscmds/sccscmds.2/util/substr.c [new file with mode: 0644]
usr/src/local/sccscmds/sccscmds.ok/util/substr.c [new file with mode: 0644]

diff --git a/usr/src/local/sccscmds/sccscmds.2/util/substr.c b/usr/src/local/sccscmds/sccscmds.2/util/substr.c
new file mode 100644 (file)
index 0000000..1689530
--- /dev/null
@@ -0,0 +1,27 @@
+static char Sccsid[] "@(#)substr       2.2";
+/*
+       Place the `len' length substring of `as' starting at `as[origin]'
+       in `aresult'.
+       Return `aresult'.
+  Note: The copying of as to aresult stops if either the
+       specified number (len) characters have been copied,
+       or if the end of as is found.
+       A negative len generally guarantees that everything gets copied.
+*/
+
+char *substr(as, aresult, origin, len)
+char *as, *aresult;
+int origin;
+register unsigned len;
+{
+       register char *s, *result;
+
+       s = as + origin;
+       result = aresult;
+       ++len;
+       while (--len && (*result++ = *s++)) ;
+       if (len == 0)
+               *result = 0;
+       return(aresult);
+}
diff --git a/usr/src/local/sccscmds/sccscmds.ok/util/substr.c b/usr/src/local/sccscmds/sccscmds.ok/util/substr.c
new file mode 100644 (file)
index 0000000..1689530
--- /dev/null
@@ -0,0 +1,27 @@
+static char Sccsid[] "@(#)substr       2.2";
+/*
+       Place the `len' length substring of `as' starting at `as[origin]'
+       in `aresult'.
+       Return `aresult'.
+  Note: The copying of as to aresult stops if either the
+       specified number (len) characters have been copied,
+       or if the end of as is found.
+       A negative len generally guarantees that everything gets copied.
+*/
+
+char *substr(as, aresult, origin, len)
+char *as, *aresult;
+int origin;
+register unsigned len;
+{
+       register char *s, *result;
+
+       s = as + origin;
+       result = aresult;
+       ++len;
+       while (--len && (*result++ = *s++)) ;
+       if (len == 0)
+               *result = 0;
+       return(aresult);
+}