Blame SOURCES/ncp.backend

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