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