aboutsummaryrefslogtreecommitdiffstats
path: root/com32/modules/ady2.c
diff options
context:
space:
mode:
Diffstat (limited to 'com32/modules/ady2.c')
-rw-r--r--com32/modules/ady2.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/com32/modules/ady2.c b/com32/modules/ady2.c
new file mode 100644
index 00000000..95eb0d17
--- /dev/null
+++ b/com32/modules/ady2.c
@@ -0,0 +1,37 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <console.h>
+#include <errno.h>
+
+int main(int argc, char *argv[])
+{
+ static unsigned char iterations = 1;
+ int src_fd;
+
+ openconsole(&dev_stdcon_r, &dev_stdcon_w);
+
+ if (argc < 2) {
+ fprintf(stderr, "Usage: %s filename...\n", argv[0]);
+ return 1;
+ }
+
+ while (1) {
+
+ errno = 0;
+ printf("---OPEN---");
+ src_fd = open(argv[1], O_RDONLY);
+ if (src_fd < 0) {
+ printf("Finally failed after %u iterations with error: %d\n",
+ iterations, errno);
+ return 1;
+ }
+ close(src_fd);
+ printf("---CLOSE---");
+ if (!iterations++)
+ return 1;
+ }
+ printf("No failure\n");
+ return 0;
+}