1/*
| 1/*
|
2 *
| 2 *
|
3 * match.c
| 3 * match.c
|
4 *
| 4 *
|
5 * Author: Tatu Ylonen <ylo@cs.hut.fi>
| 5 * Author: Tatu Ylonen <ylo@cs.hut.fi>
|
6 *
| 6 *
|
7 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 8 * All rights reserved
| 7 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 8 * All rights reserved
|
9 *
| 9 *
|
10 * Created: Thu Jun 22 01:17:50 1995 ylo
| 10 * Created: Thu Jun 22 01:17:50 1995 ylo
|
11 *
| 11 *
|
12 * Simple pattern matching, with '*' and '?' as wildcards.
| 12 * Simple pattern matching, with '*' and '?' as wildcards.
|
13 *
| 13 *
|
14 */ 15 16#include "includes.h"
| 14 */ 15 16#include "includes.h"
|
17RCSID("$Id: match.c,v 1.5 2000/03/23 22:15:33 markus Exp $");
| 17RCSID("$Id: match.c,v 1.6 2000/04/14 10:30:31 markus Exp $");
|
18 19#include "ssh.h" 20 21/* 22 * Returns true if the given string matches the pattern (which may contain ? 23 * and * as wildcards), and zero if it does not match. 24 */ 25
| 18 19#include "ssh.h" 20 21/* 22 * Returns true if the given string matches the pattern (which may contain ? 23 * and * as wildcards), and zero if it does not match. 24 */ 25
|
26int
| 26int
|
27match_pattern(const char *s, const char *pattern) 28{ 29 for (;;) { 30 /* If at end of pattern, accept if also at end of string. */ 31 if (!*pattern) 32 return !*s; 33 34 if (*pattern == '*') {
--- 107 unchanged lines hidden --- | 27match_pattern(const char *s, const char *pattern) 28{ 29 for (;;) { 30 /* If at end of pattern, accept if also at end of string. */ 31 if (!*pattern) 32 return !*s; 33 34 if (*pattern == '*') {
--- 107 unchanged lines hidden --- |