]> git.ipfire.org Git - thirdparty/cups.git/blob - backend/test1284.c
Merge changes from CUPS 1.4svn-r7874.
[thirdparty/cups.git] / backend / test1284.c
1 /*
2 * "$Id: test1284.c 7465 2008-04-18 16:20:11Z mike $"
3 *
4 * IEEE-1284 support functions test program for the Common UNIX Printing
5 * System (CUPS).
6 *
7 * Copyright 2007 by Apple Inc.
8 * Copyright 1997-2006 by Easy Software Products, all rights reserved.
9 *
10 * These coded instructions, statements, and computer programs are the
11 * property of Apple Inc. and are protected by Federal copyright
12 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
13 * "LICENSE" which should have been included with this file. If this
14 * file is missing or damaged, see the license at "http://www.cups.org/".
15 *
16 * This file is subject to the Apple OS-Developed Software exception.
17 *
18 * Contents:
19 *
20 * main() - Test the device-ID functions.
21 */
22
23 /*
24 * Include necessary headers.
25 */
26
27 #include <cups/string.h>
28 #include <stdlib.h>
29 #include <errno.h>
30 #ifdef WIN32
31 # include <io.h>
32 #else
33 # include <unistd.h>
34 # include <fcntl.h>
35 #endif /* WIN32 */
36
37 #include "ieee1284.c"
38
39
40 /*
41 * 'main()' - Test the device-ID functions.
42 */
43
44 int /* O - Exit status */
45 main(int argc, /* I - Number of command-line args */
46 char *argv[]) /* I - Command-line arguments */
47 {
48 int i, /* Looping var */
49 fd; /* File descriptor */
50 char device_id[1024], /* 1284 device ID string */
51 make_model[1024], /* make-and-model string */
52 uri[1024]; /* URI string */
53
54
55 if (argc < 2)
56 {
57 puts("Usage: test1284 device-file [... device-file-N]");
58 exit(1);
59 }
60
61 for (i = 1; i < argc; i ++)
62 {
63 if ((fd = open(argv[i], O_RDWR)) < 0)
64 {
65 perror(argv[i]);
66 return (errno);
67 }
68
69 printf("%s:\n", argv[i]);
70
71 backendGetDeviceID(fd, device_id, sizeof(device_id), make_model,
72 sizeof(make_model), "test", uri, sizeof(uri));
73
74 printf(" device_id=\"%s\"\n", device_id);
75 printf(" make_model=\"%s\"\n", make_model);
76 printf(" uri=\"%s\"\n", uri);
77
78 close(fd);
79 }
80
81 return (0);
82 }
83
84
85 /*
86 * End of "$Id: test1284.c 7465 2008-04-18 16:20:11Z mike $".
87 */