]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/testgetdests.c
Fix build/test suite errors on Linux.
[thirdparty/cups.git] / cups / testgetdests.c
CommitLineData
0bc1a539
MS
1/*
2 * CUPS cupsGetDests API test program for CUPS.
3 *
4 * Copyright 2017 by Apple Inc.
5 *
6 * These coded instructions, statements, and computer programs are the
7 * property of Apple Inc. and are protected by Federal copyright
8 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
9 * which should have been included with this file. If this file is
10 * missing or damaged, see the license at "http://www.cups.org/".
11 *
12 * This file is subject to the Apple OS-Developed Software exception.
13 */
14
15/*
16 * Include necessary headers...
17 */
18
86390cbf
MS
19#include <stdio.h>
20#include "cups.h"
21#include <sys/time.h>
22
23
0bc1a539
MS
24/*
25 * 'main()' - Loop calling cupsGetDests.
26 */
27
28int /* O - Exit status */
29main(void)
86390cbf 30{
0bc1a539
MS
31 int num_dests; /* Number of destinations */
32 cups_dest_t *dests; /* Destinations */
33 struct timeval start, end; /* Start and stop time */
34 double secs; /* Total seconds to run cupsGetDests */
86390cbf 35
0bc1a539
MS
36
37 for (;;)
86390cbf
MS
38 {
39 gettimeofday(&start, NULL);
40 num_dests = cupsGetDests(&dests);
41 gettimeofday(&end, NULL);
42 secs = end.tv_sec - start.tv_sec + 0.000001 * (end.tv_usec - start.tv_usec);
0bc1a539 43
86390cbf 44 printf("Found %d printers in %.3f seconds...\n", num_dests, secs);
0bc1a539
MS
45
46 cupsFreeDests(num_dests, dests);
47 sleep(1);
86390cbf 48 }
86390cbf
MS
49
50 return (0);
51}