]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
503b54c9 | 2 | * IEEE-1284 support functions test program for CUPS. |
ef416fc2 | 3 | * |
503b54c9 MS |
4 | * Copyright 2007-2010 by Apple Inc. |
5 | * Copyright 1997-2006 by Easy Software Products, all rights reserved. | |
ef416fc2 | 6 | * |
503b54c9 MS |
7 | * These coded instructions, statements, and computer programs are the |
8 | * property of Apple Inc. and are protected by Federal copyright | |
9 | * law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
10 | * "LICENSE" which should have been included with this file. If this | |
11 | * file is missing or damaged, see the license at "http://www.cups.org/". | |
ef416fc2 | 12 | * |
503b54c9 | 13 | * This file is subject to the Apple OS-Developed Software exception. |
ef416fc2 | 14 | */ |
15 | ||
16 | /* | |
17 | * Include necessary headers. | |
18 | */ | |
19 | ||
71e16022 | 20 | #include <cups/string-private.h> |
ef416fc2 | 21 | #ifdef WIN32 |
22 | # include <io.h> | |
23 | #else | |
24 | # include <unistd.h> | |
25 | # include <fcntl.h> | |
26 | #endif /* WIN32 */ | |
ed486911 | 27 | |
ef416fc2 | 28 | #include "ieee1284.c" |
29 | ||
30 | ||
31 | /* | |
32 | * 'main()' - Test the device-ID functions. | |
33 | */ | |
34 | ||
35 | int /* O - Exit status */ | |
36 | main(int argc, /* I - Number of command-line args */ | |
37 | char *argv[]) /* I - Command-line arguments */ | |
38 | { | |
39 | int i, /* Looping var */ | |
40 | fd; /* File descriptor */ | |
41 | char device_id[1024], /* 1284 device ID string */ | |
42 | make_model[1024], /* make-and-model string */ | |
43 | uri[1024]; /* URI string */ | |
44 | ||
45 | ||
46 | if (argc < 2) | |
47 | { | |
48 | puts("Usage: test1284 device-file [... device-file-N]"); | |
49 | exit(1); | |
50 | } | |
51 | ||
52 | for (i = 1; i < argc; i ++) | |
53 | { | |
54 | if ((fd = open(argv[i], O_RDWR)) < 0) | |
55 | { | |
56 | perror(argv[i]); | |
57 | return (errno); | |
58 | } | |
59 | ||
60 | printf("%s:\n", argv[i]); | |
61 | ||
ed486911 | 62 | backendGetDeviceID(fd, device_id, sizeof(device_id), make_model, |
63 | sizeof(make_model), "test", uri, sizeof(uri)); | |
ef416fc2 | 64 | |
65 | printf(" device_id=\"%s\"\n", device_id); | |
66 | printf(" make_model=\"%s\"\n", make_model); | |
67 | printf(" uri=\"%s\"\n", uri); | |
68 | ||
69 | close(fd); | |
70 | } | |
71 | ||
72 | return (0); | |
73 | } |