39 lines
1.1 KiB
C
39 lines
1.1 KiB
C
/* Copyright (c) 1993 UNIX System Laboratories, Inc. */
|
|
/* All Rights Reserved */
|
|
|
|
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
|
|
/* UNIX System Laboratories, Inc. */
|
|
/* The copyright notice above does not evidence any */
|
|
/* actual or intended publication of such source code. */
|
|
|
|
/* copyright "%c%" */
|
|
|
|
#ident "@(#)acct:common/cmd/acct/lib/substr.c 1.5.3.3"
|
|
#ident "$Header: /proj/irix6.5.7m/isms/eoe/cmd/acct/lib/RCS/substr.c,v 1.2 1993/11/05 04:25:59 jwag Exp $"
|
|
/*
|
|
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);
|
|
}
|