1295009Sjkim/* crypto/o_dir.h */
2280297Sjkim/*
3280297Sjkim * Copied from Richard Levitte's (richard@levitte.org) LP library.  All
4160814Ssimon * symbol names have been changed, with permission from the author.
5160814Ssimon */
6160814Ssimon
7160814Ssimon/* $LP: LPlib/test/test_dir.c,v 1.1 2004/06/16 22:59:47 _cvs_levitte Exp $ */
8160814Ssimon/*
9160814Ssimon * Copyright (c) 2004, Richard Levitte <richard@levitte.org>
10160814Ssimon * All rights reserved.
11160814Ssimon *
12160814Ssimon * Redistribution and use in source and binary forms, with or without
13160814Ssimon * modification, are permitted provided that the following conditions
14160814Ssimon * are met:
15160814Ssimon * 1. Redistributions of source code must retain the above copyright
16160814Ssimon *    notice, this list of conditions and the following disclaimer.
17160814Ssimon * 2. Redistributions in binary form must reproduce the above copyright
18160814Ssimon *    notice, this list of conditions and the following disclaimer in the
19160814Ssimon *    documentation and/or other materials provided with the distribution.
20160814Ssimon *
21160814Ssimon * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22160814Ssimon * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23160814Ssimon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24160814Ssimon * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25160814Ssimon * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26160814Ssimon * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27160814Ssimon * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28160814Ssimon * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29160814Ssimon * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30160814Ssimon * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31160814Ssimon * SUCH DAMAGE.
32160814Ssimon */
33160814Ssimon
34160814Ssimon#include <stddef.h>
35160814Ssimon#include <stdlib.h>
36160814Ssimon#include <stdio.h>
37160814Ssimon#include <errno.h>
38160814Ssimon#include "e_os2.h"
39160814Ssimon#include "o_dir.h"
40160814Ssimon
41160814Ssimon#if defined OPENSSL_SYS_UNIX || defined OPENSSL_SYS_WIN32 || defined OPENSSL_SYS_WINCE
42280297Sjkim# define CURRDIR "."
43160814Ssimon#elif defined OPENSSL_SYS_VMS
44280297Sjkim# define CURRDIR "SYS$DISK:[]"
45160814Ssimon#else
46280297Sjkim# error "No supported platform defined!"
47160814Ssimon#endif
48160814Ssimon
49160814Ssimonint main()
50160814Ssimon{
51280297Sjkim    OPENSSL_DIR_CTX *ctx = NULL;
52280297Sjkim    const char *result;
53160814Ssimon
54280297Sjkim    while ((result = OPENSSL_DIR_read(&ctx, CURRDIR)) != NULL) {
55280297Sjkim        printf("%s\n", result);
56160814Ssimon    }
57160814Ssimon
58280297Sjkim    if (errno) {
59280297Sjkim        perror("test_dir");
60280297Sjkim        exit(1);
61160814Ssimon    }
62160814Ssimon
63280297Sjkim    if (!OPENSSL_DIR_end(&ctx)) {
64280297Sjkim        perror("test_dir");
65280297Sjkim        exit(2);
66160814Ssimon    }
67280297Sjkim    exit(0);
68160814Ssimon}
69