]> git.ipfire.org Git - thirdparty/cups.git/blob - backend/test1284.c
Import CUPS 1.4svn-r7464.
[thirdparty/cups.git] / backend / test1284.c
1 /*
2 * "$Id: test1284.c 6649 2007-07-11 21:46:42Z 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 #ifndef DEBUG
38 # define DEBUG
39 #endif /* !DEBUG */
40 #include "ieee1284.c"
41
42
43 /*
44 * 'main()' - Test the device-ID functions.
45 */
46
47 int /* O - Exit status */
48 main(int argc, /* I - Number of command-line args */
49 char *argv[]) /* I - Command-line arguments */
50 {
51 int i, /* Looping var */
52 fd; /* File descriptor */
53 char device_id[1024], /* 1284 device ID string */
54 make_model[1024], /* make-and-model string */
55 uri[1024]; /* URI string */
56
57
58 if (argc < 2)
59 {
60 puts("Usage: test1284 device-file [... device-file-N]");
61 exit(1);
62 }
63
64 for (i = 1; i < argc; i ++)
65 {
66 if ((fd = open(argv[i], O_RDWR)) < 0)
67 {
68 perror(argv[i]);
69 return (errno);
70 }
71
72 printf("%s:\n", argv[i]);
73
74 backendGetDeviceID(fd, device_id, sizeof(device_id), make_model,
75 sizeof(make_model), "test", uri, sizeof(uri));
76
77 printf(" device_id=\"%s\"\n", device_id);
78 printf(" make_model=\"%s\"\n", make_model);
79 printf(" uri=\"%s\"\n", uri);
80
81 close(fd);
82 }
83
84 return (0);
85 }
86
87
88 /*
89 * End of "$Id: test1284.c 6649 2007-07-11 21:46:42Z mike $".
90 */