librsync  2.0.1
isprefix.c
1 /*= -*- c-basic-offset: 4; indent-tabs-mode: nil; -*-
2  * librsync -- dynamic caching and delta update in HTTP
3  *
4  * Copyright (C) 2000, 2001 by Martin Pool <[email protected]>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation; either version 2.1 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this program; if not, write to the Free Software
18  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */
20 
21 
22 #include "isprefix.h"
23 
24 /**
25  * Return true if TIP is a prefix of ICEBERG.
26  */
27 int
28 isprefix(char const *tip, char const *iceberg)
29 {
30  while (*tip) {
31  if (*tip != *iceberg)
32  return 0;
33  tip++; iceberg++;
34  }
35 
36  return 1;
37 }