/*1* IEEE-1284 support functions test program for CUPS.2*3* Copyright © 2007-2010 by Apple Inc.4* Copyright © 1997-2006 by Easy Software Products, all rights reserved.5*6* Licensed under Apache License v2.0. See the file "LICENSE" for more7* information.8*/910/*11* Include necessary headers.12*/1314#include <cups/string-private.h>15#ifdef _WIN3216# include <io.h>17#else18# include <unistd.h>19# include <fcntl.h>20#endif /* _WIN32 */2122#include "ieee1284.c"232425/*26* 'main()' - Test the device-ID functions.27*/2829int /* O - Exit status */30main(int argc, /* I - Number of command-line args */31char *argv[]) /* I - Command-line arguments */32{33int i, /* Looping var */34fd; /* File descriptor */35char device_id[1024], /* 1284 device ID string */36make_model[1024], /* make-and-model string */37uri[1024]; /* URI string */383940if (argc < 2)41{42puts("Usage: test1284 device-file [... device-file-N]");43exit(1);44}4546for (i = 1; i < argc; i ++)47{48if ((fd = open(argv[i], O_RDWR)) < 0)49{50perror(argv[i]);51return (errno);52}5354printf("%s:\n", argv[i]);5556backendGetDeviceID(fd, device_id, sizeof(device_id), make_model,57sizeof(make_model), "test", uri, sizeof(uri));5859printf(" device_id=\"%s\"\n", device_id);60printf(" make_model=\"%s\"\n", make_model);61printf(" uri=\"%s\"\n", uri);6263close(fd);64}6566return (0);67}686970