OLD | NEW |
1 /* $LP: LPlib/source/LPdir_win.c,v 1.10 2004/08/26 13:36:05 _cvs_levitte Exp $ *
/ | 1 /* $LP: LPlib/source/LPdir_win.c,v 1.10 2004/08/26 13:36:05 _cvs_levitte Exp $ *
/ |
2 /* | 2 /* |
3 * Copyright (c) 2004, Richard Levitte <richard@levitte.org> | 3 * Copyright (c) 2004, Richard Levitte <richard@levitte.org> |
4 * All rights reserved. | 4 * All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 struct LP_dir_context_st | 48 struct LP_dir_context_st |
49 { | 49 { |
50 WIN32_FIND_DATA ctx; | 50 WIN32_FIND_DATA ctx; |
51 HANDLE handle; | 51 HANDLE handle; |
52 char entry_name[NAME_MAX+1]; | 52 char entry_name[NAME_MAX+1]; |
53 }; | 53 }; |
54 | 54 |
55 const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory) | 55 const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory) |
56 { | 56 { |
57 struct dirent *direntry = NULL; | |
58 | |
59 if (ctx == NULL || directory == NULL) | 57 if (ctx == NULL || directory == NULL) |
60 { | 58 { |
61 errno = EINVAL; | 59 errno = EINVAL; |
62 return 0; | 60 return 0; |
63 } | 61 } |
64 | 62 |
65 errno = 0; | 63 errno = 0; |
66 if (*ctx == NULL) | 64 if (*ctx == NULL) |
67 { | 65 { |
68 *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX)); | 66 *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX)); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 if (ctx != NULL && *ctx != NULL) | 144 if (ctx != NULL && *ctx != NULL) |
147 { | 145 { |
148 FindClose((*ctx)->handle); | 146 FindClose((*ctx)->handle); |
149 free(*ctx); | 147 free(*ctx); |
150 *ctx = NULL; | 148 *ctx = NULL; |
151 return 1; | 149 return 1; |
152 } | 150 } |
153 errno = EINVAL; | 151 errno = EINVAL; |
154 return 0; | 152 return 0; |
155 } | 153 } |
OLD | NEW |