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