#!/bin/sh -e

# Author: Martin Pitt <martin.pitt@ubuntu.com>
# (C) 2005  Canonical Ltd.
#
# Get the status of IPP network browsing through exit code:
#
# 0: browsing is disabled (default configuration)
# 1: browsing is enabled for LAN
# 2: the configuration was adapted manually; in this case enable_browsing cannot
#    be used

CONF=/etc/cups/cupsd.conf

[ -f $CONF ] || exit 2

if egrep -qi '^[[:space:]]*Browsing[[:space:]]+(No|Off)[[:space:]]*(#.*)?$' $CONF; then
    exit 0
fi
if egrep -qi '^[[:space:]]*Browsing[[:space:]]+(Yes|On)[[:space:]]*(#.*)?$' $CONF; then
    exit 1
fi
exit 2
