aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/closedir.c
blob: 8a0430e68653c6e8fd5833660966d0b77153f2c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * closedir.c
 */

#include <dirent.h>
#include <stdio.h>
#include <errno.h>

#include <com32.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>

int closedir(DIR *dir)
{
	int rv;
	com32sys_t regs;
	if (dir == NULL) {
		rv = 0;
	} else {
		memset(&regs, 0, sizeof regs);	/* ?Needed? */
		regs.eax.w[0] = 0x0022;
		regs.esi.w[0] = dir->dd_fd;
		__com32.cs_intcall(0x22, &regs, &regs);
		free(dir);	/* garbage collection? */
		rv = 0;
	}
	return rv;
}