librsync  2.3.4
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 <mbp@sourcefrog.net>
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#include "config.h" /* IWYU pragma: keep */
22#include "isprefix.h"
23
24int isprefix(char const *tip, char const *iceberg)
25{
26 while (*tip) {
27 if (*tip != *iceberg)
28 return 0;
29 tip++;
30 iceberg++;
31 }
32
33 return 1;
34}
String prefix text function.
int isprefix(char const *tip, char const *iceberg)
Return true if TIP is a prefix of ICEBERG.
Definition: isprefix.c:24