Blob


1 #if TEST__MMD
2 int
3 main(void)
4 {
5 return 0;
6 }
7 #endif /* TEST_NOOP */
8 #if TEST___PROGNAME
9 int
10 main(void)
11 {
12 extern char *__progname;
14 return !__progname;
15 }
16 #endif /* TEST___PROGNAME */
17 #if TEST_ARC4RANDOM
18 #include <stdlib.h>
20 int
21 main(void)
22 {
23 return (arc4random() + 1) ? 0 : 1;
24 }
25 #endif /* TEST_ARC4RANDOM */
26 #if TEST_B64_NTOP
27 #include <netinet/in.h>
28 #include <resolv.h>
30 int
31 main(void)
32 {
33 const char *src = "hello world";
34 char output[1024];
36 return b64_ntop((const unsigned char *)src, 11, output, sizeof(output)) > 0 ? 0 : 1;
37 }
38 #endif /* TEST_B64_NTOP */
39 #if TEST_CAPSICUM
40 #include <sys/capsicum.h>
42 int
43 main(void)
44 {
45 cap_enter();
46 return(0);
47 }
48 #endif /* TEST_CAPSICUM */
49 #if TEST_CRYPT
50 #if defined(__linux__)
51 # define _GNU_SOURCE /* old glibc */
52 # define _DEFAULT_SOURCE /* new glibc */
53 #endif
54 #if defined(__sun)
55 # ifndef _XOPEN_SOURCE /* SunOS already defines */
56 # define _XOPEN_SOURCE /* XPGx */
57 # endif
58 # define _XOPEN_SOURCE_EXTENDED 1 /* XPG4v2 */
59 # ifndef __EXTENSIONS__ /* SunOS already defines */
60 # define __EXTENSIONS__ /* reallocarray, etc. */
61 # endif
62 #endif
63 #include <unistd.h>
65 int main(void)
66 {
67 char *v;
69 v = crypt("this_is_a_key", "123455");
70 return v == NULL;
71 }
72 #endif /* TEST_CRYPT */
73 #if TEST_CRYPT_NEWHASH
74 #include <pwd.h> /* _PASSWORD_LEN */
75 #include <unistd.h>
77 int
78 main(void)
79 {
80 const char *v = "password";
81 char hash[_PASSWORD_LEN];
83 if (crypt_newhash(v, "bcrypt,a", hash, sizeof(hash)) == -1)
84 return 1;
85 if (crypt_checkpass(v, hash) == -1)
86 return 1;
88 return 0;
89 }
90 #endif /* TEST_CRYPT_NEWHASH */
91 #if TEST_ENDIAN_H
92 #ifdef __linux__
93 # define _DEFAULT_SOURCE
94 #endif
95 #include <endian.h>
97 int
98 main(void)
99 {
100 return !htole32(23);
102 #endif /* TEST_ENDIAN_H */
103 #if TEST_ERR
104 /*
105 * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
107 * Permission to use, copy, modify, and distribute this software for any
108 * purpose with or without fee is hereby granted, provided that the above
109 * copyright notice and this permission notice appear in all copies.
111 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
112 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
113 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
114 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
115 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
116 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
117 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
118 */
120 #include <err.h>
121 #include <errno.h>
123 int
124 main(void)
126 warnx("%d. warnx", 1);
127 warnc(ENOENT, "%d. warn", ENOENT);
128 warn("%d. warn", 2);
129 err(0, "%d. err", 3);
130 errx(0, "%d. err", 3);
131 errc(0, ENOENT, "%d. err", 3);
132 /* NOTREACHED */
133 return 1;
135 #endif /* TEST_ERR */
136 #if TEST_EXPLICIT_BZERO
137 #include <string.h>
139 int
140 main(void)
142 char foo[10];
144 explicit_bzero(foo, sizeof(foo));
145 return(0);
147 #endif /* TEST_EXPLICIT_BZERO */
148 #if TEST_FLOCK
149 #include <fcntl.h>
151 int
152 main(void)
154 flock(0, LOCK_SH|LOCK_NB);
155 return 0;
157 #endif /* TEST_FLOCK */
158 #if TEST_FREEZERO
159 #include <stdlib.h>
161 int
162 main(void)
164 freezero(NULL, 0);
165 return 0;
167 #endif /* TEST_FREEZERO */
168 #if TEST_FTS
169 #include <stddef.h>
170 #include <sys/types.h>
171 #include <sys/stat.h>
172 #include <fts.h>
174 int
175 main(void)
177 const char *argv[2];
178 FTS *ftsp;
179 FTSENT *entry;
181 argv[0] = ".";
182 argv[1] = (char *)NULL;
184 ftsp = fts_open((char * const *)argv,
185 FTS_PHYSICAL | FTS_NOCHDIR, NULL);
187 if (ftsp == NULL)
188 return 1;
190 entry = fts_read(ftsp);
192 if (entry == NULL)
193 return 1;
195 if (fts_set(ftsp, entry, FTS_SKIP) != 0)
196 return 1;
198 if (fts_close(ftsp) != 0)
199 return 1;
201 return 0;
203 #endif /* TEST_FTS */
204 #if TEST_GETEXECNAME
205 #include <stdlib.h>
207 int
208 main(void)
210 const char * progname;
212 progname = getexecname();
213 return progname == NULL;
215 #endif /* TEST_GETEXECNAME */
216 #if TEST_GETPROGNAME
217 #include <stdlib.h>
219 int
220 main(void)
222 const char * progname;
224 progname = getprogname();
225 return progname == NULL;
227 #endif /* TEST_GETPROGNAME */
228 #if TEST_IMSG
229 #include <sys/types.h>
230 #include <sys/queue.h>
231 #include <sys/uio.h>
232 #include <stdint.h>
233 #include <imsg.h>
235 int
236 main(void)
238 struct imsgbuf ibuf;
240 imsg_init(&ibuf, 3);
241 imsg_clear(&ibuf);
242 return 0;
244 #endif /* TEST_IMSG */
245 #if TEST_INFTIM
246 /*
247 * Linux doesn't (always?) have this.
248 */
250 #include <poll.h>
251 #include <stdio.h>
253 int
254 main(void)
256 printf("INFTIM is defined to be %ld\n", (long)INFTIM);
257 return 0;
259 #endif /* TEST_INFTIM */
260 #if TEST_LANDLOCK
261 #include <linux/landlock.h>
262 #include <linux/prctl.h>
263 #include <stdlib.h>
264 #include <sys/prctl.h>
265 #include <sys/syscall.h>
266 #include <unistd.h>
267 #include <stdint.h>
269 #ifndef landlock_create_ruleset
270 static inline int landlock_create_ruleset(const struct landlock_ruleset_attr *const attr,
271 const size_t size, const __u32 flags)
273 return syscall(__NR_landlock_create_ruleset, attr, size, flags);
275 #endif
277 #ifndef landlock_restrict_self
278 static inline int landlock_restrict_self(const int ruleset_fd,
279 const __u32 flags)
281 return syscall(__NR_landlock_restrict_self, ruleset_fd, flags);
283 #endif
285 int
286 main(void)
288 uint64_t mask = LANDLOCK_ACCESS_FS_READ_FILE | LANDLOCK_ACCESS_FS_WRITE_FILE;
289 struct landlock_ruleset_attr rules = {
290 .handled_access_fs = mask
291 };
292 int fd = landlock_create_ruleset(&rules, sizeof(rules), 0);
294 if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0))
295 return 1;
296 return landlock_restrict_self(fd, 0) ? 1 : 0;
298 #endif /* TEST_LANDLOCK */
299 #if TEST_LIB_SOCKET
300 #include <sys/socket.h>
302 int
303 main(void)
305 int fds[2], c;
307 c = socketpair(AF_UNIX, SOCK_STREAM, 0, fds);
308 return c == -1;
310 #endif /* TEST_LIB_SOCKET */
311 #if TEST_MD5
312 #include <sys/types.h>
313 #include <md5.h>
315 int main(void)
317 MD5_CTX ctx;
318 char result[MD5_DIGEST_STRING_LENGTH];
320 MD5Init(&ctx);
321 MD5Update(&ctx, (const unsigned char *)"abcd", 4);
322 MD5End(&ctx, result);
324 return 0;
326 #endif /* TEST_MD5 */
327 #if TEST_MEMMEM
328 #define _GNU_SOURCE
329 #include <string.h>
331 int
332 main(void)
334 char *a = memmem("hello, world", strlen("hello, world"), "world", strlen("world"));
335 return(NULL == a);
337 #endif /* TEST_MEMMEM */
338 #if TEST_MEMRCHR
339 #if defined(__linux__) || defined(__MINT__)
340 #define _GNU_SOURCE /* See test-*.c what needs this. */
341 #endif
342 #include <string.h>
344 int
345 main(void)
347 const char *buf = "abcdef";
348 void *res;
350 res = memrchr(buf, 'a', strlen(buf));
351 return(NULL == res ? 1 : 0);
353 #endif /* TEST_MEMRCHR */
354 #if TEST_MEMSET_S
355 #include <string.h>
357 int main(void)
359 char buf[10];
360 memset_s(buf, 0, 'c', sizeof(buf));
361 return 0;
363 #endif /* TEST_MEMSET_S */
364 #if TEST_MKFIFOAT
365 #include <sys/stat.h>
366 #include <fcntl.h>
368 int main(void) {
369 mkfifoat(AT_FDCWD, "this/path/should/not/exist", 0600);
370 return 0;
372 #endif /* TEST_MKFIFOAT */
373 #if TEST_MKNODAT
374 #include <sys/stat.h>
375 #include <fcntl.h>
377 int main(void) {
378 mknodat(AT_FDCWD, "this/path/should/not/exist", S_IFIFO | 0600, 0);
379 return 0;
381 #endif /* TEST_MKNODAT */
382 #if TEST_OPTRESET
383 #include <unistd.h>
385 int
386 main(int argc, char **argv)
388 optreset = 1;
389 getopt(argc, argv, "");
390 return 0;
392 #endif /* TEST_OPTRESET */
393 #if TEST_OSBYTEORDER_H
394 #include <libkern/OSByteOrder.h>
396 int
397 main(void)
399 return !OSSwapHostToLittleInt32(23);
401 #endif /* TEST_OSBYTEORDER_H */
402 #if TEST_PATH_MAX
403 /*
404 * POSIX allows PATH_MAX to not be defined, see
405 * http://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.html;
406 * the GNU Hurd is an example of a system not having it.
408 * Arguably, it would be better to test sysconf(_SC_PATH_MAX),
409 * but since the individual *.c files include "config.h" before
410 * <limits.h>, overriding an excessive value of PATH_MAX from
411 * "config.h" is impossible anyway, so for now, the simplest
412 * fix is to provide a value only on systems not having any.
413 * So far, we encountered no system defining PATH_MAX to an
414 * impractically large value, even though POSIX explicitly
415 * allows that.
417 * The real fix would be to replace all static buffers of size
418 * PATH_MAX by dynamically allocated buffers. But that is
419 * somewhat intrusive because it touches several files and
420 * because it requires changing struct mlink in mandocdb.c.
421 * So i'm postponing that for now.
422 */
424 #include <limits.h>
425 #include <stdio.h>
427 int
428 main(void)
430 printf("PATH_MAX is defined to be %ld\n", (long)PATH_MAX);
431 return 0;
433 #endif /* TEST_PATH_MAX */
434 #if TEST_PLEDGE
435 #include <unistd.h>
437 int
438 main(void)
440 return !!pledge("stdio", NULL);
442 #endif /* TEST_PLEDGE */
443 #if TEST_PROGRAM_INVOCATION_SHORT_NAME
444 #define _GNU_SOURCE /* See feature_test_macros(7) */
445 #include <errno.h>
447 int
448 main(void)
451 return !program_invocation_short_name;
453 #endif /* TEST_PROGRAM_INVOCATION_SHORT_NAME */
454 #if TEST_PR_SET_NAME
455 #include <sys/prctl.h>
457 int
458 main(void)
460 prctl(PR_SET_NAME, "foo");
461 return 0;
463 #endif /* TEST_PR_SET_NAME */
464 #if TEST_READPASSPHRASE
465 #include <stddef.h>
466 #include <readpassphrase.h>
468 int
469 main(void)
471 return !!readpassphrase("prompt: ", NULL, 0, 0);
473 #endif /* TEST_READPASSPHRASE */
474 #if TEST_REALLOCARRAY
475 #ifdef __NetBSD__
476 # define _OPENBSD_SOURCE
477 #endif
478 #include <stdlib.h>
480 int
481 main(void)
483 return !reallocarray(NULL, 2, 2);
485 #endif /* TEST_REALLOCARRAY */
486 #if TEST_RECALLOCARRAY
487 #include <stdlib.h>
489 int
490 main(void)
492 return !recallocarray(NULL, 0, 2, 2);
494 #endif /* TEST_RECALLOCARRAY */
495 #if TEST_SANDBOX_INIT
496 #include <sandbox.h>
498 int
499 main(void)
501 char *ep;
502 int rc;
504 rc = sandbox_init(kSBXProfileNoInternet, SANDBOX_NAMED, &ep);
505 if (-1 == rc)
506 sandbox_free_error(ep);
507 return(-1 == rc);
509 #endif /* TEST_SANDBOX_INIT */
510 #if TEST_SETPROCTITLE
511 #include <stdlib.h>
513 int
514 main(void)
516 setproctitle("#%d test program", 7);
517 return 0;
519 #endif
520 #if TEST_SIO_FLUSH
521 #include <sndio.h>
523 int
524 main(void)
526 struct sio_hdl *hdl;
527 hdl = sio_open(SIO_DEVANY, SIO_PLAY, 1);
528 sio_flush(hdl);
529 sio_close(hdl);
531 #endif /* TEST_SIO_FLUSH */
532 #if TEST_SCAN_SCALED
533 #include <util.h>
535 int
536 main(void)
538 char *cinput = (char *)"1.5K", buf[FMT_SCALED_STRSIZE];
539 long long ninput = 10483892, result;
540 return scan_scaled(cinput, &result) == 0;
542 #endif /* TEST_SCAN_SCALED */
543 #if TEST_SECCOMP_FILTER
544 #include <sys/prctl.h>
545 #include <linux/seccomp.h>
546 #include <errno.h>
548 int
549 main(void)
552 prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, 0);
553 return(EFAULT == errno ? 0 : 1);
555 #endif /* TEST_SECCOMP_FILTER */
556 #if TEST_SETRESGID
557 #define _GNU_SOURCE /* linux */
558 #include <sys/types.h>
559 #include <unistd.h>
561 int
562 main(void)
564 return setresgid(-1, -1, -1) == -1;
566 #endif /* TEST_SETRESGID */
567 #if TEST_SETRESUID
568 #define _GNU_SOURCE /* linux */
569 #include <sys/types.h>
570 #include <unistd.h>
572 int
573 main(void)
575 return setresuid(-1, -1, -1) == -1;
577 #endif /* TEST_SETRESUID */
578 #if TEST_SHA2
579 #include <sys/types.h>
580 #include <sha2.h>
582 int main(void)
584 SHA2_CTX ctx;
585 char result[SHA256_DIGEST_STRING_LENGTH];
587 SHA256Init(&ctx);
588 SHA256Update(&ctx, (const unsigned char *)"abcd", 4);
589 SHA256End(&ctx, result);
591 return 0;
593 #endif /* TEST_SHA2 */
594 #if TEST_SOCK_NONBLOCK
595 /*
596 * Linux doesn't (always?) have this.
597 */
599 #include <sys/socket.h>
601 int
602 main(void)
604 int fd[2];
605 socketpair(AF_UNIX, SOCK_STREAM|SOCK_NONBLOCK, 0, fd);
606 return 0;
608 #endif /* TEST_SOCK_NONBLOCK */
609 #if TEST_STATIC
610 int
611 main(void)
613 return 0; /* not meant to do anything */
615 #endif /* TEST_STATIC */
616 #if TEST_STRLCAT
617 #include <string.h>
619 int
620 main(void)
622 char buf[3] = "a";
623 return ! (strlcat(buf, "b", sizeof(buf)) == 2 &&
624 buf[0] == 'a' && buf[1] == 'b' && buf[2] == '\0');
626 #endif /* TEST_STRLCAT */
627 #if TEST_STRLCPY
628 #include <string.h>
630 int
631 main(void)
633 char buf[2] = "";
634 return ! (strlcpy(buf, "a", sizeof(buf)) == 1 &&
635 buf[0] == 'a' && buf[1] == '\0');
637 #endif /* TEST_STRLCPY */
638 #if TEST_STRNDUP
639 #include <string.h>
641 int
642 main(void)
644 const char *foo = "bar";
645 char *baz;
647 baz = strndup(foo, 1);
648 return(0 != strcmp(baz, "b"));
650 #endif /* TEST_STRNDUP */
651 #if TEST_STRNLEN
652 #include <string.h>
654 int
655 main(void)
657 const char *foo = "bar";
658 size_t sz;
660 sz = strnlen(foo, 1);
661 return(1 != sz);
663 #endif /* TEST_STRNLEN */
664 #if TEST_STRTONUM
665 /*
666 * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
668 * Permission to use, copy, modify, and distribute this software for any
669 * purpose with or without fee is hereby granted, provided that the above
670 * copyright notice and this permission notice appear in all copies.
672 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
673 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
674 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
675 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
676 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
677 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
678 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
679 */
680 #ifdef __NetBSD__
681 # define _OPENBSD_SOURCE
682 #endif
683 #include <stdlib.h>
685 int
686 main(void)
688 const char *errstr;
690 if (strtonum("1", 0, 2, &errstr) != 1)
691 return 1;
692 if (errstr != NULL)
693 return 2;
694 if (strtonum("1x", 0, 2, &errstr) != 0)
695 return 3;
696 if (errstr == NULL)
697 return 4;
698 if (strtonum("2", 0, 1, &errstr) != 0)
699 return 5;
700 if (errstr == NULL)
701 return 6;
702 if (strtonum("0", 1, 2, &errstr) != 0)
703 return 7;
704 if (errstr == NULL)
705 return 8;
706 return 0;
708 #endif /* TEST_STRTONUM */
709 #if TEST_SYS_BYTEORDER_H
710 #include <sys/byteorder.h>
712 int
713 main(void)
715 return !LE_32(23);
717 #endif /* TEST_SYS_BYTEORDER_H */
718 #if TEST_SYS_ENDIAN_H
719 #include <sys/endian.h>
721 int
722 main(void)
724 return !htole32(23);
726 #endif /* TEST_SYS_ENDIAN_H */
727 #if TEST_SYS_MKDEV_H
728 #include <sys/types.h>
729 #include <sys/mkdev.h>
731 int
732 main(void)
734 return !minor(0);
736 #endif /* TEST_SYS_MKDEV_H */
737 #if TEST_SYS_FILE
738 #include <sys/file.h>
740 int
741 main(void)
743 flock(0, LOCK_SH|LOCK_NB);
744 return 0;
746 #endif /* TEST_SYS_FILE */
747 #if TEST_SYS_QUEUE
748 #include <sys/queue.h>
749 #include <stddef.h>
751 struct foo {
752 int bar;
753 TAILQ_ENTRY(foo) entries;
754 };
756 TAILQ_HEAD(fooq, foo);
758 int
759 main(void)
761 struct fooq foo_q, bar_q;
762 struct foo *p, *tmp;
763 int i = 0;
765 TAILQ_INIT(&foo_q);
766 TAILQ_INIT(&bar_q);
768 /*
769 * Use TAILQ_FOREACH_SAFE because some systems (e.g., Linux)
770 * have TAILQ_FOREACH but not the safe variant.
771 */
773 TAILQ_FOREACH_SAFE(p, &foo_q, entries, tmp)
774 p->bar = i++;
776 /* Test for newer macros as well. */
778 TAILQ_CONCAT(&foo_q, &bar_q, entries);
779 return 0;
781 #endif /* TEST_SYS_QUEUE */
782 #if TEST_SYS_SYSMACROS_H
783 #include <sys/sysmacros.h>
785 int
786 main(void)
788 return !minor(0);
790 #endif /* TEST_SYS_SYSMACROS_H */
791 #if TEST_SYS_TREE
792 #include <sys/tree.h>
793 #include <stdlib.h>
795 struct node {
796 RB_ENTRY(node) entry;
797 int i;
798 };
800 static int
801 intcmp(struct node *e1, struct node *e2)
803 return (e1->i < e2->i ? -1 : e1->i > e2->i);
806 RB_HEAD(inttree, node) head = RB_INITIALIZER(&head);
807 RB_PROTOTYPE(inttree, node, entry, intcmp)
808 RB_GENERATE(inttree, node, entry, intcmp)
810 int testdata[] = {
811 20, 16, 17, 13, 3, 6, 1, 8, 2, 4
812 };
814 int
815 main(void)
817 size_t i;
818 struct node *n;
820 for (i = 0; i < sizeof(testdata) / sizeof(testdata[0]); i++) {
821 if ((n = malloc(sizeof(struct node))) == NULL)
822 return 1;
823 n->i = testdata[i];
824 RB_INSERT(inttree, &head, n);
827 return 0;
830 #endif /* TEST_SYS_TREE */
831 #if TEST_UNVEIL
832 #include <unistd.h>
834 int
835 main(void)
837 return -1 != unveil(NULL, NULL);
839 #endif /* TEST_UNVEIL */
840 #if TEST_WAIT_ANY
841 #include <sys/wait.h>
843 int
844 main(void)
846 int st;
848 return waitpid(WAIT_ANY, &st, WNOHANG) != -1;
850 #endif /* TEST_WAIT_ANY */
851 #if TEST_LIBEVENT
852 #include <event.h>
854 int
855 main(void)
857 struct event ev;
859 event_set(&ev, 0, EV_READ, NULL, NULL);
860 event_add(&ev, NULL);
861 event_del(&ev);
862 return 0;
864 #endif /* TEST_LIBEVENT */
865 #if TEST_LIBEVENT2
866 #include <event2/event.h>
867 #include <event2/event_compat.h>
868 #include <event2/event_struct.h>
869 #include <event2/buffer.h>
870 #include <event2/buffer_compat.h>
871 #include <event2/bufferevent.h>
872 #include <event2/bufferevent_struct.h>
873 #include <event2/bufferevent_compat.h>
875 int
876 main(void)
878 struct event ev;
880 event_set(&ev, 0, EV_READ, NULL, NULL);
881 event_add(&ev, NULL);
882 event_del(&ev);
883 return 0;
885 #endif /* TEST_LIBEVENT2 */
886 #if TEST_LIB_FLAC
887 #include <FLAC/stream_decoder.h>
889 int
890 main(void)
892 FLAC__StreamDecoder *decoder = NULL;
893 FLAC__StreamDecoderInitStatus init_status;
895 decoder = FLAC__stream_decoder_new();
896 FLAC__stream_decoder_delete(decoder);
897 return 0;
899 #endif /* TEST_LIB_FLAC */
900 #if TEST_LIB_MPG123
901 #include <mpg123.h>
903 int
904 main(void)
906 mpg123_handle *mh;
908 mh = mpg123_new(NULL, NULL);
909 mpg123_delete(mh);
910 return 0;
912 #endif/* TEST_LIB_MPG123 */
913 #if TEST_LIB_OPUSFILE
914 #include <stdio.h>
915 #include <opusfile.h>
917 int
918 main(void)
920 FILE *f;
921 OggOpusFile *of;
922 OpusFileCallbacks cb = {NULL, NULL, NULL, NULL};
923 int r;
925 f = op_fdopen(&cb, 0, "r");
926 of = op_open_callbacks(f, &cb, NULL, 0, &r);
927 op_free(of);
928 return 0;
930 #endif /* TEST_LIB_OPUSFILE */
931 #if TEST_LIB_VORBISFILE
932 #include <stdio.h>
933 #include <vorbis/vorbisfile.h>
935 int
936 main(void)
938 OggVorbis_File vf;
940 ov_open_callbacks(stdin, &vf, NULL, 0, OV_CALLBACKS_NOCLOSE);
941 ov_clear(&vf);
942 return 0;
944 #endif /* TEST_LIB_VORBISFILE */
945 #if TEST_LIB_SNDIO
946 #include <sndio.h>
948 int
949 main(void)
951 struct sio_hdl *hdl;
952 hdl = sio_open(SIO_DEVANY, SIO_PLAY, 1);
953 sio_close(hdl);
955 #endif /* TEST_LIB_SNDIO */