Blame SOURCES/ncp.backend

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