Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
srohatgi01
GitHub Repository: srohatgi01/cups
Path: blob/master/backend/test1284.c
1090 views
1
/*
2
* IEEE-1284 support functions test program for CUPS.
3
*
4
* Copyright © 2007-2010 by Apple Inc.
5
* Copyright © 1997-2006 by Easy Software Products, all rights reserved.
6
*
7
* Licensed under Apache License v2.0. See the file "LICENSE" for more
8
* information.
9
*/
10
11
/*
12
* Include necessary headers.
13
*/
14
15
#include <cups/string-private.h>
16
#ifdef _WIN32
17
# include <io.h>
18
#else
19
# include <unistd.h>
20
# include <fcntl.h>
21
#endif /* _WIN32 */
22
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
57
backendGetDeviceID(fd, device_id, sizeof(device_id), make_model,
58
sizeof(make_model), "test", uri, sizeof(uri));
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
}
69
70