Blame SOURCES/ncp.backend

1d75c0
#!/bin/sh
1d75c0
# This is a modified version of 'ncpprint'.  It can now be used as a CUPS
1d75c0
# backend.
1d75c0
# Modifications:
1d75c0
# Copyright (C) 2002  Red Hat, inc
1d75c0
# Copyright (C) 2002  Tim Waugh
1d75c0
# Before modification: shipped as /usr/share/printconf/util/ncpprint
1d75c0
1d75c0
if [ -z "$*" ]
1d75c0
then
1d75c0
  # This is where we would enumerate all the URIs we support.
1d75c0
  # Patches welcome.
1d75c0
  exit 0
1d75c0
fi
1d75c0
1d75c0
FILE=$6
1d75c0
if [ -z "$FILE" ]
1d75c0
then
1d75c0
  FILE=-
1d75c0
fi
1d75c0
1d75c0
# $DEVICE_URI is 'ncp://[user:password@]server/queue'
1d75c0
URI=${DEVICE_URI#*://}
1d75c0
queue=${URI#*/}
1d75c0
URI=${URI%/$queue}
1d75c0
server=${URI#*@}
1d75c0
URI=${URI%$server}
1d75c0
URI=${URI%@}
1d75c0
if [ -n "$URI" ]
1d75c0
then
1d75c0
  user=${URI%:*}
1d75c0
  URI=${URI#$user}
1d75c0
  password=${URI#:}
1d75c0
fi
1d75c0
1d75c0
#echo user: ${user-(none)}
1d75c0
#echo password: ${password-(none)}
1d75c0
#echo server: $server
1d75c0
#echo queue: $queue
1d75c0
1d75c0
if [ -n "$user" ]
1d75c0
then
1d75c0
  if [ -n "$password" ]
1d75c0
  then
1d75c0
    /usr/bin/nprint -S "$server" -q "$queue" -U "$user" -P "$password" -N "$FILE" 2>/dev/null
1d75c0
  else
1d75c0
    /usr/bin/nprint -S "$server" -q "$queue" -U "$user" -n -N "$FILE" 2>/dev/null
1d75c0
  fi
1d75c0
else
1d75c0
  /usr/bin/nprint -S "$server" -q "$queue" -N "$FILE" 2>/dev/null
1d75c0
fi