1/* 2 * "$Id: test1284.c 11093 2013-07-03 20:48:42Z msweet $" 3 * 4 * IEEE-1284 support functions test program for CUPS. 5 * 6 * Copyright 2007-2010 by Apple Inc. 7 * Copyright 1997-2006 by Easy Software Products, all rights reserved. 8 * 9 * These coded instructions, statements, and computer programs are the 10 * property of Apple Inc. and are protected by Federal copyright 11 * law. Distribution and use rights are outlined in the file "LICENSE.txt" 12 * "LICENSE" which should have been included with this file. If this 13 * file is missing or damaged, see the license at "http://www.cups.org/". 14 * 15 * This file is subject to the Apple OS-Developed Software exception. 16 * 17 * Contents: 18 * 19 * main() - Test the device-ID functions. 20 */ 21 22/* 23 * Include necessary headers. 24 */ 25 26#include <cups/string-private.h> 27#ifdef WIN32 28# include <io.h> 29#else 30# include <unistd.h> 31# include <fcntl.h> 32#endif /* WIN32 */ 33 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 68 backendGetDeviceID(fd, device_id, sizeof(device_id), make_model, 69 sizeof(make_model), "test", uri, sizeof(uri)); 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: test1284.c 11093 2013-07-03 20:48:42Z msweet $". 84 */ 85