home *** CD-ROM | disk | FTP | other *** search
- /*
- * getfield.c
- * contains: getfield()
- *
- */
-
- #include <stdio.h>
- #include <string.h>
- #include "gfuncts.h"
-
- /*
- * char *
- * getfield(dest,source,width)
- *
- * ARGUMENT
- * (char *) dest = Pointer to destination string
- * (char *) source = Pointer to source string
- * (int) width = Number of characters in field to be extracted
- *
- * DESCRIPTION
- * Characters are extracted from the source string and copied to
- * the destination string. The number of characters transferred is the
- * lesser of "width" or the length of the source string. No newlines or
- * other delineators are recognized in the transfer. The destination is
- * terminated but no newline is added.
- *
- * RETURNS
- * Pointer to next part of source string, or NULL when end of
- * source string is reached.
- *
- * AUTHOR
- * Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- */
- char* GF_CONV getfield(pd,ps,count)
- char *pd,*ps;
- int count;
- {
- int i,chs,tmp;
-
- tmp=xmin(count,strlen(ps));
- chs=xmax(0,tmp);
- if(!chs)
- return(char *)0;
- for(i=1;i<=chs;i++)
- *pd++=*ps++;
- *pd='\0';
- return ps;
- }
-