]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/backend.c
Merge CUPS 1.4svn-r7319.
[thirdparty/cups.git] / cups / backend.c
1 /*
2 * "$Id: backend.c 6649 2007-07-11 21:46:42Z mike $"
3 *
4 * Backend functions for the Common UNIX Printing System (CUPS).
5 *
6 * Copyright 2007-2008 by Apple Inc.
7 * Copyright 2006 by Easy Software Products.
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 * which should have been included with this file. If this file is
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 * cupsBackendDeviceURI() - Get the device URI for a backend.
20 */
21
22 /*
23 * Include necessary headers...
24 */
25
26 #include <stdlib.h>
27 #include "backend.h"
28 #include "string.h"
29
30
31 /*
32 * 'cupsBackendDeviceURI()' - Get the device URI for a backend.
33 *
34 * The "argv" argument is the argv argument passed to main(). This
35 * function returns the device URI passed in the DEVICE_URI environment
36 * variable or the device URI passed in argv[0], whichever is found
37 * first.
38 */
39
40 const char * /* O - Device URI or @code NULL@ */
41 cupsBackendDeviceURI(char **argv) /* I - Command-line arguments */
42 {
43 const char *device_uri; /* Device URI */
44
45
46 if ((device_uri = getenv("DEVICE_URI")) != NULL)
47 return (device_uri);
48
49 if (!argv || !argv[0] || !strchr(argv[0], ':'))
50 return (NULL);
51 else
52 return (argv[0]);
53 }
54
55
56 /*
57 * End of "$Id: backend.c 6649 2007-07-11 21:46:42Z mike $".
58 */