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