home *** CD-ROM | disk | FTP | other *** search
/ Nebula / nebula.bin / SourceCode / libcs / stlmatch.c < prev    next >
C/C++ Source or Header  |  1990-12-11  |  2KB  |  62 lines

  1. /*
  2.  * Copyright (c) 1990 Carnegie Mellon University
  3.  * All Rights Reserved.
  4.  * 
  5.  * Permission to use, copy, modify and distribute this software and its
  6.  * documentation is hereby granted, provided that both the copyright
  7.  * notice and this permission notice appear in all copies of the
  8.  * software, derivative works or modified versions, and any portions
  9.  * thereof, and that both notices appear in supporting documentation.
  10.  *
  11.  * THE SOFTWARE IS PROVIDED "AS IS" AND CARNEGIE MELLON UNIVERSITY
  12.  * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  13.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT
  14.  * SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE FOR ANY SPECIAL, DIRECT,
  15.  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
  16.  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
  17.  * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  18.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  19.  *
  20.  * Users of this software agree to return to Carnegie Mellon any
  21.  * improvements or extensions that they make and grant Carnegie the
  22.  * rights to redistribute these changes.
  23.  *
  24.  * Export of this software is permitted only after complying with the
  25.  * regulations of the U.S. Deptartment of Commerce relating to the
  26.  * Export of Technical Data.
  27.  */
  28. /*  stlmatch  --  match leftmost part of string
  29.  *
  30.  *  Usage:  i = stlmatch (big,small)
  31.  *    int i;
  32.  *    char *small, *big;
  33.  *
  34.  *  Returns 1 iff initial characters of big match small exactly;
  35.  *  else 0.
  36.  *
  37.  *  HISTORY
  38.  * $Log:    stlmatch.c,v $
  39.  * Revision 1.2  90/12/11  17:59:51  mja
  40.  *     Add copyright/disclaimer for distribution.
  41.  * 
  42.  * 20-Nov-79  Steven Shafer (sas) at Carnegie-Mellon University
  43.  *    Rewritten for VAX from Ken Greer's routine.
  44.  *
  45.  *  Originally from klg (Ken Greer) on IUS/SUS UNIX
  46.  */
  47.  
  48. #include <c.h>
  49.  
  50. int stlmatch (big,small)
  51. char *small, *big;
  52. {
  53.     register char *s, *b;
  54.     s = small;
  55.     b = big;
  56.     do {
  57.         if (*s == '\0')  return (TRUE);
  58.     } 
  59.     while (*s++ == *b++);
  60.     return (FALSE);
  61. }
  62.