Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
26
cde/programs/dtprintegrate/Default_Print
Executable file
26
cde/programs/dtprintegrate/Default_Print
Executable file
@@ -0,0 +1,26 @@
|
||||
######################################################################
|
||||
#
|
||||
# action
|
||||
#
|
||||
# Common Desktop Environment (CDE)
|
||||
#
|
||||
# (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
# (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
# (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
# Novell, Inc.
|
||||
#
|
||||
# $XConsortium: Default_Print /main/3 1995/10/31 13:13:16 rswiston $
|
||||
#
|
||||
######################################################################
|
||||
|
||||
# This file represents a CDE DT action. The contents of the file do not
|
||||
# matter; the action will work even if the file is empty. If this file is
|
||||
# executable and the name of the file matches an entry in the action
|
||||
# database (*.dt files), the CDE DT File Manager will treat this file as an
|
||||
# action.
|
||||
#
|
||||
# For more information on DT actions, see the CDE DT manuals.
|
||||
|
||||
echo "Common Desktop Environment DT action. Invoke using the DT File Manager"
|
||||
|
||||
20
cde/programs/dtprintegrate/Imakefile
Normal file
20
cde/programs/dtprintegrate/Imakefile
Normal file
@@ -0,0 +1,20 @@
|
||||
XCOMM $XConsortium: Imakefile /main/6 1996/04/21 19:50:24 drk $
|
||||
|
||||
CPP_DEFINES = -DCDE_INSTALLATION_TOP=$(CDE_INSTALLATION_TOP) \
|
||||
-DCDE_CONFIGURATION_TOP=$(CDE_CONFIGURATION_TOP)
|
||||
|
||||
#if defined (SunArchitecture)
|
||||
LOCAL_CPP_DEFINES = $(CPP_DEFINES) -D__sun
|
||||
#else
|
||||
# if defined (AlphaArchitecture)
|
||||
LOCAL_CPP_DEFINES = $(CPP_DEFINES) -D__osf__
|
||||
# else
|
||||
LOCAL_CPP_DEFINES = $(CPP_DEFINES)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
all:: dtprintegrate dtlp dtlpsetup
|
||||
|
||||
CppScriptTarget(dtprintegrate,dtprintegrate.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppScriptTarget(dtlp,dtlp.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppScriptTarget(dtlpsetup,dtlpsetup.src,$(LOCAL_CPP_DEFINES),)
|
||||
165
cde/programs/dtprintegrate/dtlp.msg
Normal file
165
cde/programs/dtprintegrate/dtlp.msg
Normal file
@@ -0,0 +1,165 @@
|
||||
|
||||
$ "$XConsortium: dtlp.msg /main/5 1996/08/11 17:26:52 pascale $";
|
||||
|
||||
$ *************************************<+>*************************************
|
||||
$ *****************************************************************************
|
||||
$ **
|
||||
$ ** File: dtlp.msg
|
||||
$ **
|
||||
$ ** Project: DT printer utility (dtlp)
|
||||
$ **
|
||||
$ ** Description:
|
||||
$ ** -----------
|
||||
$ ** This file is the source for the message catalog for dtlp
|
||||
$ **
|
||||
$ **
|
||||
$ *****************************************************************************
|
||||
$ **
|
||||
$ ** (c) Copyright 1990, 1992, 1993, 1994 Hewlett-Packard Company
|
||||
$ ** (c) Copyright 1994 International Business Machines Corp.
|
||||
$ ** (c) Copyright 1994 Sun Microsystems, Inc.
|
||||
$ ** (c) Copyright 1994 Novell, Inc.
|
||||
$ **
|
||||
$ ** All Rights reserved
|
||||
$ **
|
||||
$ *****************************************************************************
|
||||
$ *************************************<+>*************************************
|
||||
|
||||
$ *************************************<L>*************************************
|
||||
$ ** -----------------GENERAL LOCALIZATION NOTES SECTION---------------------
|
||||
$ * Comment lines begin with a $ except $set which indicates the start of a
|
||||
$ * new set.
|
||||
$ *
|
||||
$ * Do not delete any comments; you may add comments for your use.
|
||||
$ *
|
||||
$ * You don't need to localize the following sets:
|
||||
$ *
|
||||
$ * Please localize the following sets:
|
||||
$ * sets 1
|
||||
$ ** ----------------GENERAL LOCALIZATION NOTES SECTION END------------------
|
||||
$ *************************************<L>*************************************
|
||||
|
||||
$quote "
|
||||
|
||||
$set 1
|
||||
$
|
||||
$ -- The first group of messages all appear on the Print dialog --
|
||||
$
|
||||
|
||||
|
||||
$ This is the message that appears in the "Printer Name:" field when no
|
||||
$ printer name has been specified and no there is no default printer.
|
||||
10 "Default"
|
||||
|
||||
$ This is the label that appears in the title bar of the print dialog.
|
||||
20 "Print"
|
||||
|
||||
$ This is the label for the field indicating the file that will be printed.
|
||||
30 "File:"
|
||||
|
||||
$ This is the label for the field indicating the name of the printer.
|
||||
40 "Printer:"
|
||||
|
||||
$ This is the message that will appear in the "Printer:" field if no printer
|
||||
$ has been specified.
|
||||
50 "Default"
|
||||
|
||||
$ This is the label for the field indicating the number of copies to print.
|
||||
60 "Copies:"
|
||||
|
||||
$ This is the label for the field indicating the title for the banner page.
|
||||
70 "Banner Page Title:"
|
||||
|
||||
$ This is the label for the field indicating if page numbers are to be added.
|
||||
80 "Print Page Numbers"
|
||||
|
||||
$ This is thef label for the field indicating additional options for the
|
||||
$ "lp" command.
|
||||
90 "Print Command Options:"
|
||||
|
||||
$ This is the label on the left button. Pushing this button causes the
|
||||
$ dialog to disappear and the print operation to start.
|
||||
100 "Print"
|
||||
|
||||
$ This is the label on the center button. Pushing this button causes the
|
||||
$ dialog to disappear and cancels the print operation.
|
||||
110 "Cancel"
|
||||
|
||||
$ This is the label on the right button. Pushing this button causes a
|
||||
$ help dialog to be posted.
|
||||
120 "Help"
|
||||
|
||||
$
|
||||
$ -- The following are error messages. --
|
||||
$
|
||||
|
||||
$ This message is posted when there is a problem with the file specified.
|
||||
$ The file name will be appended to the message. One additional message
|
||||
$ from the list below will also be included in the dialog to provide
|
||||
$ more details.
|
||||
130 "Sorry--Unable to print:"
|
||||
|
||||
$ This message is added to the error dialog when the file is not printable
|
||||
$ or does not exist.
|
||||
132 "This is not a printable file or doesn't exist."
|
||||
|
||||
$ This message is added to the error dialog when the file is not readable
|
||||
$ by the user invoking dtlp.
|
||||
134 "You don't have permission to read that file."
|
||||
|
||||
$ This message is added to the error dialog when there is a general failure
|
||||
$ in setting up to print.
|
||||
136 "Please check whether this file exists."
|
||||
|
||||
$ This is the label that appears in the title bar of the error dialog.
|
||||
160 "Print Information"
|
||||
|
||||
$
|
||||
$ -- Strings used in the Print dialog and Select Printer dialog in CDEnext --
|
||||
$
|
||||
$ This is the label for the field indicating the file(s) that will be printed.
|
||||
170 "File Name(s): "
|
||||
|
||||
$ This is used as the window title of the Select Printer dialog and a button
|
||||
$ in that dialog.
|
||||
180 "Select Printer"
|
||||
|
||||
$ This is the label for the printer list in the Select Printer dialog.
|
||||
190 "Available Printers:"
|
||||
|
||||
$ This is the label for the text box in the Select Printer dialog.
|
||||
200 "Printer Information:"
|
||||
|
||||
$
|
||||
$ -- The following are error messages added for CDEnext --
|
||||
$
|
||||
$ File is not printable or does not exist.
|
||||
210 "That file is either not printable or it does not exist."
|
||||
|
||||
$ File is not printable or does not exist.
|
||||
220 "There is either no printer defined for this system or no printer is enabled."
|
||||
|
||||
$ Printer does not exist.
|
||||
230 "The printer does not exist."
|
||||
|
||||
$ Printer is not enabled.
|
||||
240 "The printer is not enabled."
|
||||
|
||||
$ No default printer.
|
||||
250 "There is not default printer destination."
|
||||
|
||||
$ Printer not accepting requests.
|
||||
260 "The printer is currently not accepting requests."
|
||||
|
||||
$ Number of copies is not a positive integer.
|
||||
270 "Number of copies must be a positive number."
|
||||
|
||||
|
||||
$set 99
|
||||
$ DO NOT TRANSLATE THESE MESSAGES
|
||||
$ DO NOT CHANGE THESE MESSAGES
|
||||
$ DO NOT LOCALIZE THESE MESSAGES
|
||||
$ These messages are used for the version information.
|
||||
$quote
|
||||
1 @(#)version_goes_here
|
||||
2 \n@(#)_DtMessage catalog source $XConsortium: dtlp.msg /main/5 1996/08/11 17:26:52 pascale $
|
||||
1737
cde/programs/dtprintegrate/dtlp.src
Executable file
1737
cde/programs/dtprintegrate/dtlp.src
Executable file
File diff suppressed because it is too large
Load Diff
241
cde/programs/dtprintegrate/dtlpsetup.src
Executable file
241
cde/programs/dtprintegrate/dtlpsetup.src
Executable file
@@ -0,0 +1,241 @@
|
||||
XCOMM!/bin/sh
|
||||
XCOMM
|
||||
XCOMM $XConsortium: dtlpsetup.src /main/3 1996/04/23 12:01:59 drk $
|
||||
XCOMM
|
||||
XCOMM COMPONENT_NAME: desktop
|
||||
XCOMM
|
||||
XCOMM FUNCTIONS: dtlpsetup
|
||||
XCOMM
|
||||
XCOMM ORIGINS: 27
|
||||
XCOMM
|
||||
XCOMM (C) COPYRIGHT International Business Machines Corp. 1995
|
||||
XCOMM All Rights Reserved
|
||||
XCOMM US Government Users Restricted Rights - Use, duplication or
|
||||
XCOMM disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
|
||||
XCOMM
|
||||
XCOMM
|
||||
XCOMM Add /usr/dt/lib/nls/msg/%L/%N.cat to NLSPATH
|
||||
XCOMM
|
||||
|
||||
NLSPATH=/usr/dt/lib/nls/msg/%L/%N.cat:$NLSPATH
|
||||
export NLSPATH
|
||||
|
||||
XCOMM Return Codes
|
||||
NO_VALID_FILE_ERR=7
|
||||
NO_READ_FILE_ERR=8
|
||||
|
||||
usage="$0 [-b banner_title] [-d lpdest] [-f print_file]
|
||||
[-m print_command] [-n copy_count] [-o other_options]
|
||||
[-u user_filename] [-a] [-e] [-h] [-r] [-s] [-v] [-w]"
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-b)
|
||||
if [ $2 ]; then
|
||||
banner_title="$1 $2"
|
||||
shift; shift;
|
||||
else
|
||||
echo "$usage" 1>&2
|
||||
exit 2
|
||||
fi
|
||||
;;
|
||||
-b*)
|
||||
banner_title="-b `expr "$1" : '-b\(.*\)'`"
|
||||
shift
|
||||
;;
|
||||
-d)
|
||||
if [ $2 ]; then
|
||||
lpdest="$1 $2"
|
||||
shift; shift;
|
||||
else
|
||||
echo "$usage" 1>&2
|
||||
exit 2
|
||||
fi
|
||||
;;
|
||||
-d*)
|
||||
lpdest="-d `expr "$1" : '-d\(.*\)'`"
|
||||
shift
|
||||
;;
|
||||
-c)
|
||||
NOT_SUPPORTED=true
|
||||
ARGS="$ARGS $1"
|
||||
if [ $2 ]; then
|
||||
shift; shift;
|
||||
else
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
-c*)
|
||||
NOT_SUPPORTED=true
|
||||
ARGS="$ARGS -c"
|
||||
shift
|
||||
;;
|
||||
-t)
|
||||
NOT_SUPPORTED=true
|
||||
ARGS="$ARGS $1"
|
||||
if [ $2 ]; then
|
||||
shift; shift;
|
||||
else
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
-t*)
|
||||
NOT_SUPPORTED=true
|
||||
ARGS="$ARGS -t"
|
||||
shift
|
||||
;;
|
||||
-i)
|
||||
NOT_SUPPORTED=true
|
||||
ARGS="$ARGS $1"
|
||||
if [ $2 ]; then
|
||||
shift; shift;
|
||||
else
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
-i*)
|
||||
NOT_SUPPORTED=true
|
||||
ARGS="$ARGS -i"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
NOT_SUPPORTED=true
|
||||
ARGS="$ARGS $1"
|
||||
if [ $2 ]; then
|
||||
shift; shift;
|
||||
else
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
-l*)
|
||||
NOT_SUPPORTED=true
|
||||
ARGS="$ARGS -l"
|
||||
shift
|
||||
;;
|
||||
-f)
|
||||
if [ $2 ]; then
|
||||
print_file=$2
|
||||
shift; shift;
|
||||
else
|
||||
echo "$usage" 1>&2
|
||||
exit 2
|
||||
fi
|
||||
;;
|
||||
-f*)
|
||||
print_file=`expr "$1" : '-f\(.*\)'`
|
||||
shift
|
||||
;;
|
||||
-m)
|
||||
if [ $2 ]; then
|
||||
print_command="$1 $2"
|
||||
shift; shift;
|
||||
else
|
||||
echo "$usage" 1>&2
|
||||
exit 2
|
||||
fi
|
||||
;;
|
||||
-m*)
|
||||
print_command="-m `expr "$1" : '-m\(.*\)'`"
|
||||
shift
|
||||
;;
|
||||
-n)
|
||||
if [ $2 ]; then
|
||||
copy_count="$1 $2"
|
||||
shift; shift;
|
||||
else
|
||||
echo "$usage" 1>&2
|
||||
exit 2
|
||||
fi
|
||||
;;
|
||||
-n*)
|
||||
copy_count="-n `expr "$1" : '-n\(.*\)'`"
|
||||
shift
|
||||
;;
|
||||
-o)
|
||||
if [ $2 ]; then
|
||||
other_options="$1 $2"
|
||||
shift; shift;
|
||||
else
|
||||
echo "$usage" 1>&2
|
||||
exit 2
|
||||
fi
|
||||
;;
|
||||
-o*)
|
||||
other_options="-o `expr "$1" : '-o\(.*\)'`"
|
||||
shift
|
||||
;;
|
||||
-u)
|
||||
if [ $2 ]; then
|
||||
user_filename="$1 $2"
|
||||
shift; shift;
|
||||
else
|
||||
echo "$usage" 1>&2
|
||||
exit 2
|
||||
fi
|
||||
;;
|
||||
-u*)
|
||||
user_filename="-u `expr "$1" : '-u\(.*\)'`"
|
||||
shift
|
||||
;;
|
||||
-a)
|
||||
a=$1
|
||||
shift
|
||||
;;
|
||||
-e)
|
||||
e=$1
|
||||
shift
|
||||
;;
|
||||
-r)
|
||||
r=$1
|
||||
shift
|
||||
;;
|
||||
-s)
|
||||
s=$1
|
||||
shift
|
||||
;;
|
||||
-v)
|
||||
v=$1
|
||||
shift
|
||||
;;
|
||||
-w)
|
||||
w=$1
|
||||
shift
|
||||
;;
|
||||
-*)
|
||||
echo "$usage" 1>&2
|
||||
exit 2
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
echo "$usage" 1>&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ $NOT_SUPPORTED ]; then
|
||||
dspmsg -s 1 dtmigrate 2 'dtlpsetup: dtlpsetup has been replaced with dtlp.\
|
||||
\tdtlp will be automatically called in its place. \
|
||||
\tThe following flags and parameters on the dtlpsetup call \
|
||||
\thave been ignored because dtlp does not support these flags: \
|
||||
\t%1$s \n' "$ARGS"
|
||||
fi
|
||||
|
||||
/usr/dt/bin/dtlp $banner_title $lpdest $print_command $copy_count $other_options $user_filename $a $e $h $r $s $v $w $print_file
|
||||
|
||||
status=$?
|
||||
|
||||
XCOMM dtlp return code of 5 maps to return code 7 of dtlpsetup
|
||||
if [[ $status -eq 5 ]]
|
||||
then exit NO_VALID_FILE_ERR
|
||||
XCOMM dtlp return code of 6 maps to return code 8 of dtlpsetup
|
||||
elif [[ $status -eq 6 ]]
|
||||
then exit NO_READ_FILE_ERR
|
||||
else
|
||||
XCOMM all others are synonomous
|
||||
exit $status
|
||||
fi
|
||||
|
||||
697
cde/programs/dtprintegrate/dtprintegrate.src
Executable file
697
cde/programs/dtprintegrate/dtprintegrate.src
Executable file
@@ -0,0 +1,697 @@
|
||||
XCOMM!/bin/ksh
|
||||
XCOMM $XConsortium: dtprintegrate.src /main/5 1996/04/23 12:02:04 drk $
|
||||
XCOMM ####################################################################
|
||||
XCOMM ## File: dtprintegrate
|
||||
XCOMM ##
|
||||
XCOMM ## Default Location: /usr/dt/bin/dtprintegrate
|
||||
XCOMM ##
|
||||
XCOMM ## Purpose: Set up the desktop configuration files for
|
||||
XCOMM ## the desktop components.
|
||||
XCOMM ##
|
||||
XCOMM ## Description: This script is invoked as a means to create the
|
||||
XCOMM ## desktop configuration files for newly installed
|
||||
XCOMM ## printers on a given host.
|
||||
XCOMM ##
|
||||
XCOMM ## Invoked by: System administrators, either by hand or by means
|
||||
XCOMM ## of the printer installation script.
|
||||
XCOMM ##
|
||||
XCOMM ## Product: @(#)Common Desktop Environment 1.0
|
||||
XCOMM ##
|
||||
XCOMM ## (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM ## (c) Copyright 1993, 1994 International Business
|
||||
XCOMM ## Machines Corp.
|
||||
XCOMM ## (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM ##
|
||||
XCOMM ##
|
||||
XCOMM ## Note: Please do not modify this file.
|
||||
XCOMM ## Later product updates will overwrite this file.
|
||||
XCOMM ##
|
||||
XCOMM ####################################################################
|
||||
#define HASH #
|
||||
|
||||
XCOMM #################################################################
|
||||
XCOMM ## Internal Globals
|
||||
XCOMM ##
|
||||
XCOMM ## Set default values.
|
||||
XCOMM ##
|
||||
COMMAND_NAME=dtprintegrate
|
||||
|
||||
ACTION_STUB_FILE=/usr/dt/appconfig/appmanager/C/Desktop_Apps/Dtcalc
|
||||
|
||||
base_icon_name="Fpprnt"
|
||||
|
||||
XCOMM
|
||||
XCOMM Return codes
|
||||
XCOMM
|
||||
SUCCESS=0
|
||||
USAGE_ERR=1
|
||||
CREATE_ERR=2
|
||||
NO_WRITE_ERR=3
|
||||
|
||||
XCOMM #################################################################
|
||||
XCOMM ## Initialize()
|
||||
XCOMM ##
|
||||
XCOMM ## Do upfront processing.
|
||||
XCOMM ##
|
||||
XCOMM #################################################################
|
||||
Initialize()
|
||||
{
|
||||
if (( ${#LANG} ))
|
||||
then
|
||||
if [[ $LANG != C ]]
|
||||
then
|
||||
non_default_lang=1
|
||||
fi
|
||||
fi
|
||||
|
||||
HASH
|
||||
HASH Location for Print action files...
|
||||
HASH
|
||||
DEFAULT_FOLDER=/etc/dt/appconfig/appmanager/C/Printers
|
||||
DTPRINTERFOLDER=${DTPRINTERFOLDER:-$DEFAULT_FOLDER}
|
||||
|
||||
if (( ${#DTUSERPRINTERFOLDER} ))
|
||||
then
|
||||
DTPRINTERFOLDER="$DTUSERPRINTERFOLDER"
|
||||
fi
|
||||
|
||||
if [ ! -d $DTPRINTERFOLDER ]
|
||||
then
|
||||
mkdir -p $DTPRINTERFOLDER > /dev/null 2>/dev/null
|
||||
fi
|
||||
|
||||
HASH
|
||||
HASH Location for Print definition (*.dt) files...
|
||||
HASH
|
||||
DEFAULT_FOLDER=/etc/dt/appconfig/types/C
|
||||
DTPRINTACTIONFOLDER=${DTPRINTACTIONFOLDER:-$DEFAULT_FOLDER}
|
||||
|
||||
if [ ! -d $DTPRINTACTIONFOLDER ]
|
||||
then
|
||||
mkdir -p $DTPRINTACTIONFOLDER > /dev/null 2>/dev/null
|
||||
fi
|
||||
|
||||
HASH
|
||||
HASH Search path for printer icons...
|
||||
HASH
|
||||
DEFAULT_PATH=.,$HOME/.dt/icons,/usr/dt/appconfig/icons/C
|
||||
DTPRINTICONPATH=${DTPRINTICONPATH:-$DEFAULT_PATH}
|
||||
|
||||
HASH
|
||||
HASH Location for printer icons...
|
||||
HASH
|
||||
DEFAULT_FOLDER=/etc/dt/appconfig/icons/C
|
||||
DTPRINTERICONFOLDER=${DTPRINTERICONFOLDER:-$DEFAULT_FOLDER}
|
||||
|
||||
HASH
|
||||
HASH Other...
|
||||
HASH
|
||||
database_file=${printer_name}.dt
|
||||
|
||||
databasefile_path=$DTPRINTACTIONFOLDER/$database_file
|
||||
|
||||
action_file=${printer_name}_Print
|
||||
|
||||
action_path=$DTPRINTERFOLDER/$action_file
|
||||
}
|
||||
|
||||
XCOMM #################################################################
|
||||
XCOMM ## CheckOptions()
|
||||
XCOMM ##
|
||||
XCOMM ## Check the options supplied in the command line
|
||||
XCOMM ## interface
|
||||
XCOMM ##
|
||||
XCOMM #################################################################
|
||||
CheckOptions()
|
||||
{
|
||||
if (( $printer_flag == "0" ))
|
||||
HASH
|
||||
HASH We require a printer specification
|
||||
HASH
|
||||
then
|
||||
PrintUsage
|
||||
Exit $USAGE_ERR
|
||||
fi
|
||||
}
|
||||
|
||||
XCOMM #################################################################
|
||||
XCOMM ## AddHelpFileContents
|
||||
XCOMM ##
|
||||
XCOMM ## Add the contents of the help file to $1
|
||||
XCOMM ##
|
||||
XCOMM #################################################################
|
||||
AddHelpFileContents()
|
||||
{
|
||||
if [[ ! -r $help_file || ! -s $help_file ]]
|
||||
then
|
||||
print ""
|
||||
print " Sorry--Unable to read the help file: "
|
||||
print " \"$help_file\"."
|
||||
print ""
|
||||
failure_flag=1
|
||||
if (( $verbose_flag ))
|
||||
then
|
||||
PrintEndLog
|
||||
fi
|
||||
Exit $CREATE_ERR
|
||||
fi
|
||||
echo " DESCRIPTION \\" >> $databasefile_path
|
||||
|
||||
exec 8< $help_file
|
||||
|
||||
while read -u8 this_line
|
||||
do
|
||||
print $this_line " \\" >> $databasefile_path
|
||||
done
|
||||
print "**" >> $databasefile_path
|
||||
|
||||
exec 8<&-
|
||||
}
|
||||
|
||||
XCOMM #################################################################
|
||||
XCOMM ## MakeDatabaseFile()
|
||||
XCOMM ##
|
||||
XCOMM ## Make the *.dt file for the printer
|
||||
XCOMM ##
|
||||
XCOMM #################################################################
|
||||
MakeDatabaseFile()
|
||||
{
|
||||
|
||||
touch $databasefile_path > /dev/null 2>/dev/null
|
||||
|
||||
chmod +w $databasefile_path > /dev/null 2>/dev/null
|
||||
|
||||
if [[ ! -f $databasefile_path || ! -w $databasefile_path ]]
|
||||
then
|
||||
failure_flag=1
|
||||
PrintCreateError "$DTPRINTACTIONFOLDER" "$database_file"
|
||||
if (( $verbose_flag ))
|
||||
then
|
||||
PrintEndLog
|
||||
fi
|
||||
Exit $CREATE_ERR
|
||||
fi
|
||||
|
||||
HASH
|
||||
HASH First, write the preamble for this *.dt file
|
||||
HASH
|
||||
(
|
||||
echo "################################################################"
|
||||
echo "# "
|
||||
echo "# Actions and Datatypes for Printer \"$printer_name\""
|
||||
echo "# "
|
||||
echo "# Common Desktop Environment 1.0"
|
||||
echo "# "
|
||||
echo "# This file created by the \"dtprintegrate\" utility."
|
||||
echo "# "
|
||||
echo "# Date of integration: `date`. "
|
||||
echo "# "
|
||||
echo "################################################################"
|
||||
echo " "
|
||||
) > $databasefile_path
|
||||
|
||||
HASH
|
||||
HASH Now, create the Print action for the printer
|
||||
HASH
|
||||
|
||||
(
|
||||
echo "ACTION ${printer_name}_Print"
|
||||
echo "{"
|
||||
echo " ARG_TYPE *"
|
||||
echo " LABEL $printer_name"
|
||||
echo " ICON ${base_icon_name}"
|
||||
echo " TYPE COMMAND"
|
||||
echo " WINDOW_TYPE NO_STDIO"
|
||||
if (( destination_flag ))
|
||||
then
|
||||
echo " EXEC_STRING env LPDEST=$destination \\"
|
||||
else
|
||||
echo " EXEC_STRING env LPDEST=$printer_name \\"
|
||||
fi
|
||||
|
||||
echo " /usr/dt/bin/dtaction Print %(File)Arg_1%"
|
||||
) >> $databasefile_path
|
||||
|
||||
if (( $help_flag ))
|
||||
then
|
||||
echo " DESCRIPTION $help_text" >> $databasefile_path
|
||||
elif (( $helpfile_flag ))
|
||||
then
|
||||
AddHelpFileContents $databasefile_path
|
||||
fi
|
||||
|
||||
echo "}" >> $databasefile_path
|
||||
|
||||
HASH
|
||||
HASH Next, create the print manager action for the printer
|
||||
HASH
|
||||
(
|
||||
echo ""
|
||||
echo "ACTION ${printer_name}_Print"
|
||||
echo "{"
|
||||
echo " ARG_COUNT 0"
|
||||
echo " TYPE COMMAND"
|
||||
echo " WINDOW_TYPE NO_STDIO"
|
||||
if (( destination_flag ))
|
||||
then
|
||||
echo " EXEC_STRING env LPDEST=$destination \\"
|
||||
else
|
||||
echo " EXEC_STRING env LPDEST=$printer_name \\"
|
||||
fi
|
||||
echo " /usr/dt/bin/dtaction Dtqueueinfo"
|
||||
echo "}"
|
||||
) >> $databasefile_path
|
||||
}
|
||||
|
||||
XCOMM #################################################################
|
||||
XCOMM ##
|
||||
XCOMM ## TraversePath()
|
||||
XCOMM ##
|
||||
XCOMM ## Parse a given search path, using comma (,) and colon (:) as
|
||||
XCOMM ## delimiters. Pass each path element to another
|
||||
XCOMM ## function.
|
||||
XCOMM ##
|
||||
XCOMM #################################################################
|
||||
TraversePath ()
|
||||
{
|
||||
gotahost=0
|
||||
typeset -i path=0
|
||||
IFSsave=$IFS
|
||||
search_path=$1
|
||||
dir_function=$2
|
||||
|
||||
if [[ -n "$search_path" && -n "$dir_function" ]]; then
|
||||
HASH
|
||||
HASH look for colon and comma delimiters
|
||||
HASH
|
||||
IFS=':,'
|
||||
set -A dir_array $search_path
|
||||
while ((path<=${#dir_array[*]}-1)) ;do
|
||||
$dir_function ${dir_array[$path]}
|
||||
path=path+1
|
||||
done
|
||||
else return
|
||||
fi
|
||||
IFS=$IFSsave
|
||||
}
|
||||
|
||||
XCOMM #################################################################
|
||||
XCOMM ##
|
||||
XCOMM ## GetIconBaseName()
|
||||
XCOMM ##
|
||||
XCOMM ## Given a file name of the form "base.l.bm" where size
|
||||
XCOMM ## can be ".l", ".m", ".s.", or ".t" and visual type can be
|
||||
XCOMM ## ".bm" or ".pm", set $base_icon_name to just the base.
|
||||
XCOMM ##
|
||||
XCOMM #################################################################
|
||||
GetIconBaseName()
|
||||
{
|
||||
base_icon_name=`basename $1 .bm`
|
||||
base_icon_name=`basename $base_icon_name .pm`
|
||||
base_icon_name=`basename $base_icon_name .l`
|
||||
base_icon_name=`basename $base_icon_name .m`
|
||||
base_icon_name=`basename $base_icon_name .s`
|
||||
base_icon_name=`basename $base_icon_name .t`
|
||||
}
|
||||
|
||||
XCOMM #################################################################
|
||||
XCOMM ##
|
||||
XCOMM ## DoTheActualIconCopy()
|
||||
XCOMM ##
|
||||
XCOMM ## Once we've determined the base name, and we've got the
|
||||
XCOMM ## source icon directory ($1), then copy all the icons
|
||||
XCOMM ## with the same base name into the destination $DTPRINTERICONFOLDER.
|
||||
XCOMM ##
|
||||
XCOMM #################################################################
|
||||
DoTheActualIconCopy()
|
||||
{
|
||||
for i in $1/${base_icon_name}.*
|
||||
do
|
||||
if [ -f $i ]
|
||||
then
|
||||
simple_icon_name=${i##*/}
|
||||
|
||||
if [ -f $DTPRINTERICONFOLDER/$simple_icon_name ]
|
||||
then
|
||||
mv -f $DTPRINTERICONFOLDER/$simple_icon_name $DTPRINTERICONFOLDER/#$simple_icon_name
|
||||
fi
|
||||
|
||||
cp $i $DTPRINTERICONFOLDER
|
||||
|
||||
if (( $verbose_flag ))
|
||||
then
|
||||
print " Copied icon file $i "
|
||||
print " to $DTPRINTERICONFOLDER."
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
XCOMM #################################################################
|
||||
XCOMM ## CopyIconFiles()
|
||||
XCOMM ##
|
||||
XCOMM ## Given $icon_name, get its base name, ensure that
|
||||
XCOMM ## the destination icon folder exists, and march down
|
||||
XCOMM ## the icon path, looking for matching icons, and copying
|
||||
XCOMM ## them to the destination folder.
|
||||
XCOMM ##
|
||||
XCOMM #################################################################
|
||||
CopyIconFiles()
|
||||
{
|
||||
|
||||
GetIconBaseName $icon_name
|
||||
|
||||
touch $DTPRINTERICONFOLDER/$icon_name.install > /dev/null 2>/dev/null
|
||||
|
||||
if [[ ! -f $DTPRINTERICONFOLDER/$icon_name.install ]]
|
||||
then
|
||||
failure_flag=1
|
||||
PrintCreateError "$DTPRINTERICONFOLDER" "$DTPRINTERICONFOLDER/$icon_name.*"
|
||||
if (( $verbose_flag ))
|
||||
then
|
||||
PrintEndLog
|
||||
fi
|
||||
Exit $CREATE_ERR
|
||||
fi
|
||||
|
||||
rm -f $DTPRINTERICONFOLDER/$icon_name.install
|
||||
|
||||
TraversePath "$DTPRINTICONPATH" DoTheActualIconCopy
|
||||
|
||||
XCOMM ## install default icon if none found above. ###
|
||||
|
||||
}
|
||||
|
||||
XCOMM #################################################################
|
||||
XCOMM ## MakeActionFile()
|
||||
XCOMM ##
|
||||
XCOMM ## Make the Action file for the printer in the
|
||||
XCOMM ## $DTPRINTERFOLDER
|
||||
XCOMM ##
|
||||
XCOMM #################################################################
|
||||
MakeActionFile()
|
||||
{
|
||||
|
||||
touch $action_path > /dev/null 2>/dev/null
|
||||
|
||||
chmod +x $action_path > /dev/null 2>/dev/null
|
||||
|
||||
if [[ ! -f $action_path || ! -x $action_path ]]
|
||||
then
|
||||
failure_flag=1
|
||||
PrintCreateError "$DTPRINTERFOLDER" "$action_file"
|
||||
if (( $verbose_flag ))
|
||||
then
|
||||
PrintEndLog
|
||||
fi
|
||||
Exit $CREATE_ERR
|
||||
fi
|
||||
|
||||
if [ -x $ACTION_STUB_FILE ]
|
||||
then
|
||||
|
||||
cp $ACTION_STUB_FILE "$action_path"
|
||||
else
|
||||
failure_flag=1
|
||||
PrintCreateError "$DTPRINTERFOLDER" "$action_file"
|
||||
if (( $verbose_flag ))
|
||||
then
|
||||
PrintEndLog
|
||||
fi
|
||||
Exit $CREATE_ERR
|
||||
fi
|
||||
}
|
||||
|
||||
XCOMM #################################################################
|
||||
XCOMM ## PrintStartLog()
|
||||
XCOMM ##
|
||||
XCOMM ## Print the start of the log
|
||||
XCOMM ##
|
||||
XCOMM #################################################################
|
||||
PrintStartLog() {
|
||||
print "$COMMAND_NAME..."
|
||||
print ""
|
||||
}
|
||||
|
||||
XCOMM #################################################################
|
||||
XCOMM ## PrintEndLog()
|
||||
XCOMM ##
|
||||
XCOMM ## Print the values of the variables.
|
||||
XCOMM ##
|
||||
XCOMM #################################################################
|
||||
PrintEndLog() {
|
||||
print " DTPRINTACTIONFOLDER == $DTPRINTACTIONFOLDER"
|
||||
print ""
|
||||
print " DTPRINTERFOLDER == $DTPRINTERFOLDER"
|
||||
print ""
|
||||
if (( $failure_flag == 0 )) && (( $unintegrate_flag == 0))
|
||||
then
|
||||
print " Created one database file,"
|
||||
print " \"$databasefile_path\","
|
||||
print " and one action file, "
|
||||
print " \"$action_path\"."
|
||||
print ""
|
||||
fi
|
||||
if (( $failure_flag ==0 ))
|
||||
then
|
||||
print "...successfully completed."
|
||||
else
|
||||
print "...completed UNsuccesfully."
|
||||
fi
|
||||
print ""
|
||||
}
|
||||
|
||||
XCOMM #################################################################
|
||||
XCOMM ## PrintCreateError()
|
||||
XCOMM ##
|
||||
XCOMM ## Print an error message
|
||||
XCOMM ##
|
||||
XCOMM #################################################################
|
||||
PrintCreateError() {
|
||||
print ""
|
||||
print " Sorry--Unable to create the file \"$2\" under subdirectory"
|
||||
print " \"$1\"."
|
||||
print ""
|
||||
failure_flag=1
|
||||
}
|
||||
|
||||
XCOMM #################################################################
|
||||
XCOMM ## PrintUsage()
|
||||
XCOMM ##
|
||||
XCOMM ## Print a usage message.
|
||||
XCOMM ##
|
||||
XCOMM #################################################################
|
||||
PrintUsage() {
|
||||
print ""
|
||||
print "Usage: $COMMAND_NAME [-d <destination>] [-i <icon_name>]"
|
||||
print " [-h <help_text> | -f <help_file>]"
|
||||
print " [-r] [-u] [-v] printer_name"
|
||||
print " where:"
|
||||
print " <destination> specifies print destination known to the print"
|
||||
print " <icon_name> specifies the icon to use to represent the printer"
|
||||
print " <help_text> specifies the help text for the printer"
|
||||
print " <help_file> specifies the help file for the printer"
|
||||
print " -r forces reloading of the action database"
|
||||
print " -u unintegrates the printer"
|
||||
print " -v directs verbose messages to standard out"
|
||||
print " printer_name specifies the printer name"
|
||||
print ""
|
||||
print " All parameters except \"<printer_name>\" are optional."
|
||||
print ""
|
||||
}
|
||||
|
||||
XCOMM #################################################################
|
||||
XCOMM ## ReloadActions()
|
||||
XCOMM ##
|
||||
XCOMM ##
|
||||
XCOMM #################################################################
|
||||
ReloadActions() {
|
||||
HASH
|
||||
HASH Shorten forms like "host:0.0" to "host"
|
||||
HASH
|
||||
display_host=${DISPLAY%:*}
|
||||
display_host=${display_host%%.*}
|
||||
|
||||
HASH
|
||||
HASH Shorten forms like "host.dom.com" to "host"
|
||||
HASH
|
||||
session_host=`uname -n`
|
||||
session_host=${session_host%%.*}
|
||||
|
||||
if (( reloadactions_flag ))
|
||||
then
|
||||
HASH
|
||||
HASH User wants to force reloading actions
|
||||
HASH
|
||||
if [[ -x /usr/dt/bin/dtaction && -n "$DISPLAY" ]]
|
||||
then
|
||||
/usr/dt/bin/dtaction ReloadActions
|
||||
fi
|
||||
elif [[ "$display_host" = "$session_host" ]]
|
||||
HASH
|
||||
HASH Our session server is running on the desktop
|
||||
HASH
|
||||
then
|
||||
if [ -x /usr/dt/bin/dtaction ]
|
||||
then
|
||||
/usr/dt/bin/dtaction ReloadActions
|
||||
fi
|
||||
elif [[ -z "$display_host" && -n "$DISPLAY" ]]
|
||||
then
|
||||
HASH
|
||||
HASH Covers the case in which the simple value ":0.0" is our $DISPLAY
|
||||
HASH
|
||||
if [ -x /usr/dt/bin/dtaction ]
|
||||
then
|
||||
/usr/dt/bin/dtaction ReloadActions
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
XCOMM #################################################################
|
||||
XCOMM ## UnintegratePrinter()
|
||||
XCOMM ##
|
||||
XCOMM ##
|
||||
XCOMM #################################################################
|
||||
UnintegratePrinter() {
|
||||
|
||||
if [[ -f $action_path ]]
|
||||
then
|
||||
rm -fr $action_path
|
||||
if (( verbose_flag ))
|
||||
then
|
||||
print " Removed one action file: "
|
||||
print " \"$action_path\"."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -f $databasefile_path ]]
|
||||
then
|
||||
rm -fr $databasefile_path
|
||||
if (( verbose_flag ))
|
||||
then
|
||||
print " Removed one database file:"
|
||||
print " \"$databasefile_path\"."
|
||||
print ""
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
XCOMM #################################################################
|
||||
XCOMM ## Exit()
|
||||
XCOMM ##
|
||||
XCOMM ##
|
||||
XCOMM #################################################################
|
||||
Exit() {
|
||||
exit $1
|
||||
}
|
||||
|
||||
XCOMM #################################################################
|
||||
XCOMM ## Main()
|
||||
XCOMM ##
|
||||
XCOMM ## Set up and call the routines
|
||||
XCOMM ##
|
||||
XCOMM #################################################################
|
||||
|
||||
printer_name=""
|
||||
printer_flag=0
|
||||
help_flag=0
|
||||
helpfile_flag=0
|
||||
icon_flag=0
|
||||
language_flag=0
|
||||
verbose_flag=0
|
||||
unintegrate_flag=0
|
||||
failure_flag=0
|
||||
destination_flag=0
|
||||
destination=""
|
||||
reloadactions_flag=0
|
||||
|
||||
while getopts d:f:h:i:ruv argument
|
||||
do
|
||||
case $argument in
|
||||
d) destination=$OPTARG
|
||||
destination_flag=1
|
||||
HASH print the destination name is $destination.
|
||||
;;
|
||||
f) help_file=$OPTARG
|
||||
helpfile_flag=1
|
||||
;;
|
||||
h) help_text=$OPTARG
|
||||
help_flag=1
|
||||
;;
|
||||
i) icon_name=$OPTARG
|
||||
icon_flag=1
|
||||
;;
|
||||
r) reloadactions_flag=1
|
||||
;;
|
||||
u) unintegrate_flag=1
|
||||
;;
|
||||
v) verbose_flag=1
|
||||
;;
|
||||
\?)
|
||||
PrintUsage
|
||||
Exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
((shift_positions = OPTIND - 1))
|
||||
|
||||
if (( $shift_positions < $# ))
|
||||
then
|
||||
XCOMM
|
||||
XCOMM We have at least one remaining non-switch command line argument
|
||||
XCOMM
|
||||
shift $shift_positions
|
||||
HASH
|
||||
HASH We assume that any remaining arguments constitute the
|
||||
HASH filename.
|
||||
HASH At some later point, may want to parse a list of filenames.
|
||||
HASH
|
||||
printer_name=$*
|
||||
printer_flag=1
|
||||
fi
|
||||
|
||||
XCOMM
|
||||
XCOMM Time to get to work.
|
||||
XCOMM
|
||||
Initialize
|
||||
|
||||
if (( $verbose_flag ))
|
||||
then
|
||||
PrintStartLog
|
||||
fi
|
||||
|
||||
CheckOptions
|
||||
|
||||
if (( $unintegrate_flag ))
|
||||
then
|
||||
|
||||
UnintegratePrinter
|
||||
|
||||
else
|
||||
|
||||
if (( $icon_flag ))
|
||||
then
|
||||
CopyIconFiles
|
||||
HASH Doing so will set the $base_icon_name for inclusion in the
|
||||
HASH filetypes action definition
|
||||
fi
|
||||
|
||||
MakeDatabaseFile
|
||||
|
||||
MakeActionFile
|
||||
|
||||
ReloadActions
|
||||
|
||||
fi
|
||||
|
||||
if (( $verbose_flag ))
|
||||
then
|
||||
PrintEndLog
|
||||
fi
|
||||
|
||||
Exit 0
|
||||
|
||||
XCOMM ######################### eof ##############################
|
||||
21
cde/programs/dtprintegrate/lpdefault.fp
Normal file
21
cde/programs/dtprintegrate/lpdefault.fp
Normal file
@@ -0,0 +1,21 @@
|
||||
##################################################################
|
||||
#
|
||||
# Control Definition for Default Printer
|
||||
#
|
||||
# Common Desktop Environment 1.0
|
||||
#
|
||||
# (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
# (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
#
|
||||
##################################################################
|
||||
|
||||
CONTROL PRINTER_default
|
||||
{
|
||||
TYPE icon
|
||||
ICON djet
|
||||
LABEL Default
|
||||
PUSH_ACTION Manage_default
|
||||
DROP_ACTION Print_default
|
||||
HELP_STRING This is the default printer.
|
||||
}
|
||||
Reference in New Issue
Block a user