]> git.ipfire.org Git - thirdparty/cups.git/blame - backend/test1284.c
License change: Apache License, Version 2.0.
[thirdparty/cups.git] / backend / test1284.c
CommitLineData
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 */
13
14/*
15 * Include necessary headers.
16 */
17
71e16022 18#include <cups/string-private.h>
ef416fc2 19#ifdef WIN32
20# include <io.h>
21#else
22# include <unistd.h>
23# include <fcntl.h>
24#endif /* WIN32 */
ed486911 25
ef416fc2 26#include "ieee1284.c"
27
28
29/*
30 * 'main()' - Test the device-ID functions.
31 */
32
33int /* O - Exit status */
34main(int argc, /* I - Number of command-line args */
35 char *argv[]) /* I - Command-line arguments */
36{
37 int i, /* Looping var */
38 fd; /* File descriptor */
39 char device_id[1024], /* 1284 device ID string */
40 make_model[1024], /* make-and-model string */
41 uri[1024]; /* URI string */
42
43
44 if (argc < 2)
45 {
46 puts("Usage: test1284 device-file [... device-file-N]");
47 exit(1);
48 }
49
50 for (i = 1; i < argc; i ++)
51 {
52 if ((fd = open(argv[i], O_RDWR)) < 0)
53 {
54 perror(argv[i]);
55 return (errno);
56 }
57
58 printf("%s:\n", argv[i]);
59
ed486911 60 backendGetDeviceID(fd, device_id, sizeof(device_id), make_model,
61 sizeof(make_model), "test", uri, sizeof(uri));
ef416fc2 62
63 printf(" device_id=\"%s\"\n", device_id);
64 printf(" make_model=\"%s\"\n", make_model);
65 printf(" uri=\"%s\"\n", uri);
66
67 close(fd);
68 }
69
70 return (0);
71}