source: branches/samba-3.3.x/examples/validchars/validchr.c@ 534

Last change on this file since 534 was 206, checked in by Herwig Bauernfeind, 17 years ago

Import Samba 3.3 branch at 3.0.0 level (psmedley's port)

File size: 2.6 KB
Line 
1/* by [email protected]
2 */
3
4#include <stdio.h>
5#include <string.h>
6
7#include <dirent.h>
8
9unsigned char
10test(void)
11{
12 DIR *dir;
13 struct dirent *dp;
14 unsigned char c;
15
16 if ((dir=opendir("."))==0)
17 {
18 perror("open .");
19 return 0;
20 }
21 c = 0;
22 while ((dp=readdir(dir))!=0)
23 {
24 size_t len;
25
26 len = strlen(dp->d_name);
27 if (len<4)
28 continue;
29 if (strcmp(dp->d_name+len-4, ".TST"))
30 continue;
31 if (len!=5)
32 {
33 fprintf(stderr, "warning: %s\n", dp->d_name);
34 printf(" length");
35 continue;