Blame SOURCES/ncp.backend

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