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