1 /* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
3 * Permission to use, copy, modify, and distribute this software
4 * is freely granted, provided that this notice is preserved.
12 #include "buf_findstr.h"
14 /* Find string str in buffer buf of length buf_len. Point buf to character after string,
15 or set it to NULL if end of buffer is reached. Return 1 if found, 0 if not. */
17 _buf_findstr(const char *str
, char **buf
, size_t *buf_len
)
22 for (i
= 0; i
< *buf_len
; i
++)
24 if (str
[0] == (*buf
)[i
])
27 while (str
[j
- i
] && (str
[j
- i
] == (*buf
)[j
])) j
++;
28 if(str
[j
- i
] == '\0')