]>
Commit | Line | Data |
---|---|---|
a4d04587 | 1 | /* |
75bd9771 | 2 | * "$Id: backend.c 7583 2008-05-16 17:47:16Z mike $" |
a4d04587 | 3 | * |
4 | * Backend functions for the Common UNIX Printing System (CUPS). | |
5 | * | |
ac884b6a | 6 | * Copyright 2007-2008 by Apple Inc. |
a4d04587 | 7 | * Copyright 2006 by Easy Software Products. |
8 | * | |
9 | * These coded instructions, statements, and computer programs are the | |
bc44d920 | 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/". | |
a4d04587 | 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" | |
5eb9da71 | 28 | #include "globals.h" |
a4d04587 | 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 | ||
ac884b6a | 40 | const char * /* O - Device URI or @code NULL@ */ |
a4d04587 | 41 | cupsBackendDeviceURI(char **argv) /* I - Command-line arguments */ |
42 | { | |
43 | const char *device_uri; /* Device URI */ | |
5eb9da71 | 44 | _cups_globals_t *cg = _cupsGlobals(); /* Global info */ |
a4d04587 | 45 | |
46 | ||
5eb9da71 MS |
47 | if ((device_uri = getenv("DEVICE_URI")) == NULL) |
48 | { | |
49 | if (!argv || !argv[0] || !strchr(argv[0], ':')) | |
50 | return (NULL); | |
a4d04587 | 51 | |
5eb9da71 MS |
52 | device_uri = argv[0]; |
53 | } | |
54 | ||
55 | return (_httpResolveURI(device_uri, cg->resolved_uri, | |
56 | sizeof(cg->resolved_uri))); | |
a4d04587 | 57 | } |
58 | ||
59 | ||
60 | /* | |
75bd9771 | 61 | * End of "$Id: backend.c 7583 2008-05-16 17:47:16Z mike $". |
a4d04587 | 62 | */ |