]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
75bd9771 | 2 | * "$Id: test1284.c 7465 2008-04-18 16:20:11Z mike $" |
ef416fc2 | 3 | * |
4 | * IEEE-1284 support functions test program for the Common UNIX Printing | |
5 | * System (CUPS). | |
6 | * | |
bc44d920 | 7 | * Copyright 2007 by Apple Inc. |
ef416fc2 | 8 | * Copyright 1997-2006 by Easy Software Products, all rights reserved. |
9 | * | |
10 | * These coded instructions, statements, and computer programs are the | |
bc44d920 | 11 | * property of Apple Inc. and are protected by Federal copyright |
12 | * law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
ef416fc2 | 13 | * "LICENSE" which should have been included with this file. If this |
bc44d920 | 14 | * file is missing or damaged, see the license at "http://www.cups.org/". |
ef416fc2 | 15 | * |
16 | * This file is subject to the Apple OS-Developed Software exception. | |
17 | * | |
18 | * Contents: | |
19 | * | |
c0e1af83 | 20 | * main() - Test the device-ID functions. |
ef416fc2 | 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 */ | |
ed486911 | 36 | |
ef416fc2 | 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 | ||
ed486911 | 71 | backendGetDeviceID(fd, device_id, sizeof(device_id), make_model, |
72 | sizeof(make_model), "test", uri, sizeof(uri)); | |
ef416fc2 | 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 | /* | |
75bd9771 | 86 | * End of "$Id: test1284.c 7465 2008-04-18 16:20:11Z mike $". |
ef416fc2 | 87 | */ |