From 65608e0f8bbc0190cc1b7646f653e796c807f02b Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Tue, 27 Dec 2011 16:50:50 +0100
Subject: import cups from F16

---
 ncp.backend | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100755 ncp.backend

(limited to 'ncp.backend')

diff --git a/ncp.backend b/ncp.backend
new file mode 100755
index 0000000..d57ada1
--- /dev/null
+++ b/ncp.backend
@@ -0,0 +1,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
-- 
cgit