]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
2 | * "$Id: test1284.c 4903 2006-01-10 20:02:46Z 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 | #define DEBUG | |
45 | #include "ieee1284.c" | |
46 | ||
47 | ||
48 | /* | |
49 | * 'main()' - Test the device-ID functions. | |
50 | */ | |
51 | ||
52 | int /* O - Exit status */ | |
53 | main(int argc, /* I - Number of command-line args */ | |
54 | char *argv[]) /* I - Command-line arguments */ | |
55 | { | |
56 | int i, /* Looping var */ | |
57 | fd; /* File descriptor */ | |
58 | char device_id[1024], /* 1284 device ID string */ | |
59 | make_model[1024], /* make-and-model string */ | |
60 | uri[1024]; /* URI string */ | |
61 | ||
62 | ||
63 | if (argc < 2) | |
64 | { | |
65 | puts("Usage: test1284 device-file [... device-file-N]"); | |
66 | exit(1); | |
67 | } | |
68 | ||
69 | for (i = 1; i < argc; i ++) | |
70 | { | |
71 | if ((fd = open(argv[i], O_RDWR)) < 0) | |
72 | { | |
73 | perror(argv[i]); | |
74 | return (errno); | |
75 | } | |
76 | ||
77 | printf("%s:\n", argv[i]); | |
78 | ||
79 | get_device_id(fd, device_id, sizeof(device_id), make_model, | |
80 | sizeof(make_model), "test", uri, sizeof(uri)); | |
81 | ||
82 | printf(" device_id=\"%s\"\n", device_id); | |
83 | printf(" make_model=\"%s\"\n", make_model); | |
84 | printf(" uri=\"%s\"\n", uri); | |
85 | ||
86 | close(fd); | |
87 | } | |
88 | ||
89 | return (0); | |
90 | } | |
91 | ||
92 | ||
93 | /* | |
94 | * End of "$Id: test1284.c 4903 2006-01-10 20:02:46Z mike $". | |
95 | */ |