]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
503b54c9 | 2 | * IEEE-1284 support functions test program for CUPS. |
ef416fc2 | 3 | * |
53f8d64f MS |
4 | * Copyright © 2007-2010 by Apple Inc. |
5 | * Copyright © 1997-2006 by Easy Software Products, all rights reserved. | |
ef416fc2 | 6 | * |
53f8d64f MS |
7 | * Licensed under Apache License v2.0. See the file "LICENSE" for more |
8 | * information. | |
ef416fc2 | 9 | */ |
10 | ||
11 | /* | |
12 | * Include necessary headers. | |
13 | */ | |
14 | ||
71e16022 | 15 | #include <cups/string-private.h> |
24a06ed3 | 16 | #ifdef _WIN32 |
ef416fc2 | 17 | # include <io.h> |
18 | #else | |
19 | # include <unistd.h> | |
20 | # include <fcntl.h> | |
24a06ed3 | 21 | #endif /* _WIN32 */ |
ed486911 | 22 | |
ef416fc2 | 23 | #include "ieee1284.c" |
24 | ||
25 | ||
26 | /* | |
27 | * 'main()' - Test the device-ID functions. | |
28 | */ | |
29 | ||
30 | int /* O - Exit status */ | |
31 | main(int argc, /* I - Number of command-line args */ | |
32 | char *argv[]) /* I - Command-line arguments */ | |
33 | { | |
34 | int i, /* Looping var */ | |
35 | fd; /* File descriptor */ | |
36 | char device_id[1024], /* 1284 device ID string */ | |
37 | make_model[1024], /* make-and-model string */ | |
38 | uri[1024]; /* URI string */ | |
39 | ||
40 | ||
41 | if (argc < 2) | |
42 | { | |
43 | puts("Usage: test1284 device-file [... device-file-N]"); | |
44 | exit(1); | |
45 | } | |
46 | ||
47 | for (i = 1; i < argc; i ++) | |
48 | { | |
49 | if ((fd = open(argv[i], O_RDWR)) < 0) | |
50 | { | |
51 | perror(argv[i]); | |
52 | return (errno); | |
53 | } | |
54 | ||
55 | printf("%s:\n", argv[i]); | |
56 | ||
ed486911 | 57 | backendGetDeviceID(fd, device_id, sizeof(device_id), make_model, |
58 | sizeof(make_model), "test", uri, sizeof(uri)); | |
ef416fc2 | 59 | |
60 | printf(" device_id=\"%s\"\n", device_id); | |
61 | printf(" make_model=\"%s\"\n", make_model); | |
62 | printf(" uri=\"%s\"\n", uri); | |
63 | ||
64 | close(fd); | |
65 | } | |
66 | ||
67 | return (0); | |
68 | } |