blob: d57ada1bcf99a05ecc87f3265213a8cbaff73da9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#!/bin/sh
# This is a modified version of 'ncpprint'. It can now be used as a CUPS
# backend.
# Modifications:
# Copyright (C) 2002 Red Hat, inc
# Copyright (C) 2002 Tim Waugh
# Before modification: shipped as /usr/share/printconf/util/ncpprint
if [ -z "$*" ]
then
# This is where we would enumerate all the URIs we support.
# Patches welcome.
exit 0
fi
FILE=$6
if [ -z "$FILE" ]
then
FILE=-
fi
# $DEVICE_URI is 'ncp://[user:password@]server/queue'
URI=${DEVICE_URI#*://}
queue=${URI#*/}
URI=${URI%/$queue}
server=${URI#*@}
URI=${URI%$server}
URI=${URI%@}
if [ -n "$URI" ]
then
user=${URI%:*}
URI=${URI#$user}
password=${URI#:}
fi
#echo user: ${user-(none)}
#echo password: ${password-(none)}
#echo server: $server
#echo queue: $queue
if [ -n "$user" ]
then
if [ -n "$password" ]
then
/usr/bin/nprint -S "$server" -q "$queue" -U "$user" -P "$password" -N "$FILE" 2>/dev/null
else
/usr/bin/nprint -S "$server" -q "$queue" -U "$user" -n -N "$FILE" 2>/dev/null
fi
else
/usr/bin/nprint -S "$server" -q "$queue" -N "$FILE" 2>/dev/null
fi
|