зеркало из https://github.com/mozilla/gecko-dev.git
Add assorted tools used by some of the mozilla/directory (LDAP) developers.
This commit is contained in:
Родитель
181b2a7685
Коммит
5d39d924ae
|
@ -0,0 +1 @@
|
|||
Assorted tools used by some of the mozilla/directory (LDAP) developers.
|
|
@ -0,0 +1,56 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mark Smith <MarkCSmithWork@aol.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
#
|
||||
# short stdin/stdout filter to clean up the raw output from a 'cvs ci' command
|
||||
#
|
||||
|
||||
REP_PREFIX1=/cvsroot/
|
||||
REP_PREFIX2=/anothercvsroot/
|
||||
|
||||
GREP=grep
|
||||
SED=sed
|
||||
|
||||
$GREP -v '^Checking in' | grep -v '^done$' | grep -v '^Removing ' | \
|
||||
grep -v '^cvs commit: Examining ' | \
|
||||
$SED -e "s#^$REP_PREFIX1##" \
|
||||
-e "s#^$REP_PREFIX2##" \
|
||||
-e 's#,v.*$##' -e 's#Attic/##' \
|
||||
-e 's#^new revision:# new revision:#'
|
|
@ -0,0 +1,104 @@
|
|||
#!/bin/sh
|
||||
# uncomment the following line on NT (change the path as needed) and move
|
||||
# it to the first line of this file.
|
||||
#!c:/appls/mksnt/mksnt/sh
|
||||
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mark Smith <MarkCSmithWork@aol.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
#
|
||||
# cvsco: checkout using the branch and module found in BRANCH and MODULE
|
||||
# files located in the current directory. If a file called REPOSITORY
|
||||
# exists, its contents are used to set CVSROOT.
|
||||
#
|
||||
# usage: cvsco [-H] [-dry] [cvsco-flags]
|
||||
#
|
||||
|
||||
BRANCH_FILENAME="BRANCH"
|
||||
MODULE_FILENAME="MODULE"
|
||||
REPOSITORY_FILENAME="REPOSITORY"
|
||||
DATE_FILENAME="DATE"
|
||||
EXTRAOPTS="-q"
|
||||
DRYRUN=0
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
if [ "$1" = "-H" ]; then
|
||||
echo "usage: $0 [-dry] [cvsco-flags]";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if [ "$1" = "-dry" ]; then
|
||||
shift;
|
||||
DRYRUN=1;
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -r $BRANCH_FILENAME -o ! -s $BRANCH_FILENAME ]; then
|
||||
echo "Please put the branch name in $BRANCH_FILENAME and try again."
|
||||
echo "Use the name -TRUNK- to pull from the trunk (no branch)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BRANCH=`cat $BRANCH_FILENAME`
|
||||
if [ "$BRANCH" = "-TRUNK-" ]; then
|
||||
BRANCH_ARGS="-P"
|
||||
else
|
||||
BRANCH_ARGS="-r $BRANCH"
|
||||
fi
|
||||
|
||||
if [ -r $DATE_FILENAME -a -s $DATE_FILENAME ]; then
|
||||
DATE=`cat $DATE_FILENAME`
|
||||
BRANCH_ARGS="$BRANCH_ARGS -D $DATE"
|
||||
fi
|
||||
|
||||
if [ ! -r $MODULE_FILENAME -o ! -s $MODULE_FILENAME ]; then
|
||||
echo "Please put the module name in $MODULE_FILENAME and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -r $REPOSITORY_FILENAME -a -s $REPOSITORY_FILENAME ]; then
|
||||
CVSROOT=`cat $REPOSITORY_FILENAME`
|
||||
export CVSROOT
|
||||
echo "Repository (CVSROOT): $CVSROOT"
|
||||
fi
|
||||
|
||||
|
||||
echo cvs $EXTRAOPTS co $* $BRANCH_ARGS `cat $MODULE_FILENAME`
|
||||
if [ $DRYRUN -eq 0 ]; then
|
||||
cvs $EXTRAOPTS co $* $BRANCH_ARGS `cat $MODULE_FILENAME`
|
||||
fi
|
|
@ -0,0 +1,144 @@
|
|||
#!/bin/sh
|
||||
# uncomment the following line on NT (change the path as needed) and move
|
||||
# it to the first line of this file.
|
||||
#!c:/appls/mksnt/mksnt/sh
|
||||
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mark Smith <MarkCSmithWork@aol.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
#
|
||||
# cvsdl: perform a 'cvs diff' to examine the last change made to a file on the
|
||||
# current branch.
|
||||
#
|
||||
# usage: cvsdl [-n] [-v] [-revs] [cvs-diff-options] [files...]
|
||||
# where:
|
||||
# "revs" is a number that indicates how many revisions to go back
|
||||
# when diffing (default is 1)
|
||||
# and "-n" shows the cvs diff command that would be executed without
|
||||
# actually executing it.
|
||||
# and "-v" enables verbose output.
|
||||
#
|
||||
# e.g., cvsdl -c mozilla/directory/c-sdk/ldap/Makefile
|
||||
# e.g., cvsdl -n mozilla/directory/c-sdk/ldap/Makefile
|
||||
# e.g., cvsdl -3 mozilla/directory/c-sdk/ldap/Makefile
|
||||
#
|
||||
# if no files are listed, all in the current directory are diff'd.
|
||||
# cvs-diff-options can also be passed in the CVSDLOPTIONS environment variable.
|
||||
#
|
||||
# Known Bug: the detection of "first revision on a branch" is broken.
|
||||
|
||||
DIFFOPTIONS="$CVSDLOPTIONS"
|
||||
REVSBACK=1
|
||||
EXECUTE=1
|
||||
VERBOSE=0
|
||||
|
||||
while [ $# -ne 0 ]; do
|
||||
if [ `expr $1 : '\(.\)'` != "-" ]; then
|
||||
break;
|
||||
fi
|
||||
OPTION=`echo $1 | sed -e 's/^-//'`
|
||||
echo $OPTION | grep '^[0-9]*$' > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
REVSBACK=$OPTION
|
||||
elif [ $OPTION = "n" ]; then
|
||||
EXECUTE=0
|
||||
elif [ $OPTION = "v" ]; then
|
||||
VERBOSE=1
|
||||
else
|
||||
if [ -z "$DIFFOPTIONS" ]; then
|
||||
DIFFOPTIONS=$1
|
||||
else
|
||||
DIFFOPTIONS="$DIFFOPTIONS "$1
|
||||
fi
|
||||
fi
|
||||
shift;
|
||||
done
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
FILES=*
|
||||
else
|
||||
FILES=$*
|
||||
fi
|
||||
|
||||
|
||||
if [ $VERBOSE -ne 0 ]; then
|
||||
echo revsback=$REVSBACK
|
||||
echo diffoptions=$DIFFOPTIONS
|
||||
echo files=$FILES
|
||||
fi
|
||||
|
||||
for FN in $FILES; do
|
||||
if [ -d "$FN" ]; then
|
||||
echo "Skipping directory $FN"
|
||||
else
|
||||
CURREV=`cvs -n stat $FN | grep 'Working revision' | awk '{print $3}'`
|
||||
RC=$?
|
||||
if [ "$RC" != 0 ]; then
|
||||
exit $RC;
|
||||
fi
|
||||
if [ "$CURREV" = "No" ]; then
|
||||
echo "$FN: No CVS entry"
|
||||
continue;
|
||||
fi
|
||||
|
||||
LASTDIGITOFCUR=`echo $CURREV | awk -F. '{print ($NF)}'`
|
||||
LASTDIGITOFPREV=`echo $CURREV | awk -F. '{print ($NF)-1}'`
|
||||
if [ "$LASTDIGITOFCUR" -lt "$REVSBACK" ]; then
|
||||
echo "$FN: there are only $LASTDIGITOFCUR revision(s) on this branch. Nothing to diff."
|
||||
continue;
|
||||
elif [ "$LASTDIGITOFCUR" -eq "$REVSBACK" ]; then
|
||||
PREVREV=`echo $CURREV | sed -e 's/\.[0-9]*\.[0-9]*$//'`
|
||||
echo "$FN: diffing with branch point..."
|
||||
elif [ "$LASTDIGITOFPREV" -eq 0 ]; then
|
||||
PREVREV=`echo $CURREV | sed -e 's/\.[0-9]*\.[0-9]*$//'`
|
||||
if [ -z "$PREVREV" ]; then
|
||||
echo "$FN: the current revision is the first one. Nothing to diff."
|
||||
continue;
|
||||
fi
|
||||
# echo "$FN: the current revision is the first one on this branch..."
|
||||
# diff PREVREV and CURREV
|
||||
else
|
||||
PREVREV=`echo $CURREV | awk -F. '{for (i=1; i < NF; ++i) \
|
||||
printf( "%s.", $i ); print ($NF)-revsback}' revsback=$REVSBACK`
|
||||
fi
|
||||
echo cvs -n diff $DIFFOPTIONS -r $PREVREV -r $CURREV $FN
|
||||
if [ $EXECUTE -ne 0 ]; then
|
||||
cvs -n diff $DIFFOPTIONS -r $PREVREV -r $CURREV $FN
|
||||
fi
|
||||
fi
|
||||
done
|
|
@ -0,0 +1,218 @@
|
|||
#!/bin/sh
|
||||
# uncomment the following line on NT (change the path as needed) and move
|
||||
# it to the first line of this file.
|
||||
#!c:/appls/mksnt/mksnt/sh
|
||||
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mark Smith <MarkCSmithWork@aol.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
#
|
||||
# cvslb: 'cvs log' filtered to only show revisions on the current branch
|
||||
#
|
||||
# usage: cvslb [-l count] [-b branch] [files...]
|
||||
# where count is the maximum number of revisions to display.
|
||||
# and branch specifies a branch to focus on (instead of the current one).
|
||||
# (use -b TRUNK to see changes made on the trunk).
|
||||
# options can also be passed in the CVSLBOPTIONS environment variable.
|
||||
#
|
||||
|
||||
PROG=`basename $0`
|
||||
USAGE="$0 [-v] [ -l count ] [ -b branch ] [ file... ]"
|
||||
SEP="=============================================================================="
|
||||
REVLIMIT=0
|
||||
BRANCH=""
|
||||
VERBOSE=0
|
||||
|
||||
|
||||
# process arguments
|
||||
set -- `getopt vb:l: $CVSLBOPTIONS $*`
|
||||
if [ $? != 0 ]; then
|
||||
echo $USAGE
|
||||
exit 2
|
||||
fi
|
||||
|
||||
for i in $*; do
|
||||
case $i in
|
||||
-l) REVLIMIT=$2; shift 2;;
|
||||
-b) BRANCH=$2; shift 2;;
|
||||
-v) VERBOSE=`expr $VERBOSE + 1`; shift;;
|
||||
--) shift; break;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
FILES=*
|
||||
else
|
||||
FILES=$*
|
||||
fi
|
||||
|
||||
for FN in $FILES; do
|
||||
if [ -d $FN ]; then
|
||||
echo "$PROG: Skipping directory $FN..."
|
||||
else
|
||||
if [ -z "$BRANCH" ]; then
|
||||
LINE=`cvs -n stat $FN | grep 'Sticky Tag:'`
|
||||
RC=$?
|
||||
if [ $RC != 0 ]; then
|
||||
echo "$PROG: skipping $FN (cvs stat failed or no sticky tag)..."
|
||||
continue
|
||||
fi
|
||||
|
||||
CURTAG=`echo $LINE | awk '{print $3}'`
|
||||
if [ $CURTAG = "(none)" ]; then
|
||||
CURTAG="";
|
||||
fi
|
||||
else
|
||||
if [ $BRANCH = "TRUNK" ]; then
|
||||
CURTAG=""
|
||||
else
|
||||
CURTAG=$BRANCH
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$CURTAG" ]; then
|
||||
DISPLAY_CURTAG="the trunk";
|
||||
else
|
||||
DISPLAY_CURTAG="$CURTAG";
|
||||
fi
|
||||
|
||||
if [ $VERBOSE -gt 0 ]; then
|
||||
echo $FN: current revision: $DISPLAY_CURTAG
|
||||
fi
|
||||
|
||||
cvs -n log $FN | awk '
|
||||
BEGIN {
|
||||
echoing = 1;
|
||||
no_more = 0;
|
||||
}
|
||||
/^symbolic names:/ {
|
||||
looking_for_branch = 1;
|
||||
echoing = 0;
|
||||
next;
|
||||
}
|
||||
/^description:/ {
|
||||
print;
|
||||
echoing = 1;
|
||||
if ( revlimit > 0 ) {
|
||||
printf( "Displaying at most %d revisions from %s:\n", \
|
||||
revlimit, display_curtag );
|
||||
} else {
|
||||
printf( "Displaying all revisions from %s:\n", display_curtag );
|
||||
}
|
||||
next;
|
||||
}
|
||||
/^========================================================/ {
|
||||
next;
|
||||
}
|
||||
/^total revisions:/ {
|
||||
if ( looking_for_branch ) {
|
||||
if ( curtag == "" ) {
|
||||
looking_for_branch = 0;
|
||||
} else {
|
||||
printf( "This file not on branch %s (?)\n", display_curtag );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
/^revision [0-9]*\.[0-9]*$/ {
|
||||
found_rev = 0;
|
||||
if ( !no_more && !looking_for_branch && curtag == "" ) {
|
||||
if ( revlimit > 0 && --revlimit <= 0 ) {
|
||||
no_more = 1;
|
||||
}
|
||||
print;
|
||||
echoing = 1;
|
||||
} else {
|
||||
echoing = 0;
|
||||
}
|
||||
next;
|
||||
}
|
||||
/^revision [0-9]/ {
|
||||
found_rev = 0;
|
||||
if ( !no_more && !looking_for_branch ) {
|
||||
if ( length( $2 ) > numerictaglen && \
|
||||
substr( $2, 1, numerictaglen ) == numerictag && \
|
||||
index( substr( $2, numerictaglen + 1 ), "." ) == 0 ) {
|
||||
found_rev = 1;
|
||||
}
|
||||
}
|
||||
if ( found_rev ) {
|
||||
if ( revlimit > 0 && --revlimit <= 0 ) {
|
||||
no_more = 1;
|
||||
}
|
||||
print;
|
||||
echoing = 1;
|
||||
} else {
|
||||
echoing = 0;
|
||||
}
|
||||
next;
|
||||
}
|
||||
/ .*: [0-9]/ {
|
||||
tag = substr( $1, 1, length( $1 ) - 1 );
|
||||
if ( looking_for_branch && tag == curtag ) {
|
||||
print;
|
||||
count = split($2,digits,".");
|
||||
numerictag="";
|
||||
zero_suppressed = 0;
|
||||
for ( i = 1; i <= count; ++i ) {
|
||||
if ( !zero_suppressed && digits[i] == "0" ) {
|
||||
zero_suppressed = 1;
|
||||
} else {
|
||||
numerictag = numerictag digits[i] ".";
|
||||
}
|
||||
}
|
||||
numerictaglen = length( numerictag );
|
||||
looking_for_branch = 0;
|
||||
# printf( "got branch: %s ($2 was %s)\n", numerictag, $2 );
|
||||
} else if ( echoing ) {
|
||||
print;
|
||||
}
|
||||
next;
|
||||
}
|
||||
/.*/ {
|
||||
if ( echoing ) {
|
||||
print;
|
||||
}
|
||||
next;
|
||||
}
|
||||
' curtag="$CURTAG" display_curtag="$DISPLAY_CURTAG" revlimit="$REVLIMIT"
|
||||
echo $SEP
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,65 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mark Smith <MarkCSmithWork@aol.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
SDKPATH=/usr/local/packages/ldapcsdk
|
||||
INSTALLEDLIBPATH=$(SDKPATH)/lib
|
||||
FILES = Makefile ldaperr2string.c
|
||||
PROGS = ldaperr2string
|
||||
#CFLAGS = -g -I$(SDKPATH)/include
|
||||
CFLAGS = -g -I$(SDKPATH)/include -xarch=v9
|
||||
RPATH=-Wl,-R,$(INSTALLEDLIBPATH)
|
||||
#LDAPLIBS=-lldapssl30
|
||||
#LDAPLIBS=-lldap50 -lssldap50 -lprldap50
|
||||
LDAPLIBS=-lldap50
|
||||
#NSSLIBS=-lnss3 -lssl3
|
||||
#NSPRLIBS=-lnspr4 -lplc4 -lplds4
|
||||
OS_LIBS=-lsocket -lnsl
|
||||
LIBS=$(RPATH) -L$(SDKPATH)/lib $(LDAPLIBS) $(NSSLIBS) $(NSPRLIBS) $(OS_LIBS)
|
||||
|
||||
all: progs
|
||||
|
||||
progs: $(PROGS)
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
|
||||
distclean: clean
|
||||
rm -f $(PROGS)
|
||||
|
||||
ldaperr2string: ldaperr2string.o
|
||||
cc ldaperr2string.o $(CFLAGS) $(LIBS) -o $@
|
|
@ -0,0 +1,54 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mark Smith <MarkCSmithWork@aol.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <ldap.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
int i, lderr;
|
||||
char *s;
|
||||
|
||||
for ( i = 1; i < argc; ++i ) {
|
||||
lderr = (int)strtol( argv[ i ], NULL, 0 );
|
||||
printf( "LDAP error %d (0x%x): %s\n",
|
||||
lderr, lderr, ldap_err2string( lderr ));
|
||||
}
|
||||
|
||||
exit( 0 );
|
||||
}
|
|
@ -0,0 +1,595 @@
|
|||
#!/bin/sh
|
||||
#!c:/appls/cygwin/bin/sh
|
||||
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mark Smith <MarkCSmithWork@aol.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
#UNAME=c:/appls/relbld-tools/gmake3.76.1/uname.exe
|
||||
UNAME=uname
|
||||
#
|
||||
# Perform a sanity check on the LDAP C SDK by executing the command line tools
|
||||
#
|
||||
# cd to the directory that contains platform subdirectories before executing
|
||||
# this script, e.g.,
|
||||
# cd /shared-builds/ldapsdk50/20011120D
|
||||
# ~/tests/sdk/accept/test-sdk
|
||||
#
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "usage: $0 [-v] [-c] [S] [-3] [-b basedn] [-d debuglevel] [-h server] [-p ldap-port] [-P ldaps-port] [-W ssl-keyfile-passwd] [-L extra-lib-path ]" 2>&1
|
||||
exit 2
|
||||
}
|
||||
|
||||
# component dependencies
|
||||
NSS_RELEASE=nss/NSS_3_7_7_RTM
|
||||
NSS_RELEASE_ROOT=/shared-builds
|
||||
NSPR_RELEASE=nspr20/v4.2.2
|
||||
NSPR_RELEASE_ROOT=/shared-builds
|
||||
|
||||
# hard coded variables
|
||||
BINDDN="cn=Directory Manager"
|
||||
BINDPW="secret"
|
||||
CERTDB=/tmp/certdb
|
||||
CERTNAME="Kirsten Vaughan's Example ID"
|
||||
TOOLS_OUTFILE=/dev/null
|
||||
TOOLS_TMPFILE=/tmp/testsdk-tools-tmp.$$
|
||||
|
||||
# defaults
|
||||
LDAPHOST=ldap.example.com
|
||||
LDAPPORT=389
|
||||
LDAPSPORT=636
|
||||
LDAPBASE="dc=example,dc=com"
|
||||
KEYPASSWD=
|
||||
VERBOSE=0
|
||||
REALLY_VERBOSE=0
|
||||
LDAPDEBUG=""
|
||||
STOP_ON_ERRORS=1
|
||||
SKIP_SHLIB_COPY=0
|
||||
EXTRA_LIB_PATH=""
|
||||
EXTRA_SSL_ARGS=""
|
||||
|
||||
#set - - `getopt vb:d:h:p:P: $*`
|
||||
#if [ $? != 0 ]; then
|
||||
# usage;
|
||||
#fi
|
||||
#for i in $*; do
|
||||
#echo $i
|
||||
# case $i in
|
||||
# -v) VERBOSE=1;;
|
||||
# -b) LDAPBASE=$2; shift 2;;
|
||||
# -d) LDAPDEBUG=$2; shift 2;;
|
||||
# -h) LDAPHOST=$2; shift 2;;
|
||||
# -p) LDAPPORT=$2; shift 2;;
|
||||
# -P) LDAPSPORT=$2; shift 2;;
|
||||
# esac
|
||||
#done
|
||||
|
||||
while getopts vcS3b:d:h:L:p:P:W: c; do
|
||||
case $c in
|
||||
v) if [ $VERBOSE -eq 1 ]; then
|
||||
REALLY_VERBOSE=1;
|
||||
else
|
||||
VERBOSE=1
|
||||
fi
|
||||
;;
|
||||
c) STOP_ON_ERRORS=0;;
|
||||
S) SKIP_SHLIB_COPY=1;;
|
||||
3) EXTRA_SSL_ARGS="$EXTRA_SSL_ARGS -3";;
|
||||
b) LDAPBASE=$OPTARG;;
|
||||
d) LDAPDEBUG=$OPTARG;;
|
||||
h) LDAPHOST=$OPTARG;;
|
||||
L) EXTRA_LIB_PATH=$OPTARG;;
|
||||
p) LDAPPORT=$OPTARG;;
|
||||
P) LDAPSPORT=$OPTARG;;
|
||||
W) KEYPASSWD=$OPTARG;;
|
||||
|
||||
\?) usage;;
|
||||
esac
|
||||
done
|
||||
shift `expr $OPTIND - 1`
|
||||
|
||||
if [ -z "$KEYPASSWD" ]; then
|
||||
echo "Please provide the keyfile password (-W password)"
|
||||
usage;
|
||||
fi
|
||||
|
||||
if [ $# -gt 0 -o -z "$KEYPASSWD" ]; then
|
||||
usage;
|
||||
fi
|
||||
|
||||
if [ $REALLY_VERBOSE -ne 0 ]; then
|
||||
TOOLS_OUTFILE=/dev/tty
|
||||
fi
|
||||
|
||||
DEV_NULL=/dev/null
|
||||
BUILD_VARIANTS="DBG.OBJ OPT.OBJ"
|
||||
|
||||
ICONV_SRC_CHARSET=ISO8859-1
|
||||
ICONV_UTF8_CHARSET=UTF-8
|
||||
OS=`$UNAME`
|
||||
case $OS in
|
||||
SunOS)
|
||||
if [ `$UNAME -r` = "5.6" ]; then
|
||||
ICONV_SRC_CHARSET=8859-1
|
||||
fi
|
||||
OS_VARIANTS="SunOS5.6 SunOS5.8 SunOS5.8_64"
|
||||
LDAPTOOL_LC_CTYPE=en_US.ISO8859-1
|
||||
;;
|
||||
HP-UX)
|
||||
OS_VARIANTS="HP-UXB.11.00 HP-UXB.11.00_64"
|
||||
LDAPTOOL_LC_CTYPE=en_US.iso88591
|
||||
ICONV_SRC_CHARSET=iso8859_1
|
||||
ICONV_UTF8_CHARSET=utf8
|
||||
;;
|
||||
AIX)
|
||||
OS_VARIANTS="AIX4.3"
|
||||
LDAPTOOL_LC_CTYPE=en_US.ISO8859-1
|
||||
;;
|
||||
Linux)
|
||||
OS_VARIANTS="Linux2.2_x86_glibc_PTH Linux2.4_x86_glibc_PTH"
|
||||
LDAPTOOL_LC_CTYPE=en_US.ISO8859-1
|
||||
ICONV_SRC_CHARSET=ISO-8859-1
|
||||
;;
|
||||
WINNT)
|
||||
OS_VARIANTS="WINNT5.0"
|
||||
BUILD_VARIANTS="$BUILD_VARIANTS DBG.OBJD"
|
||||
CERTDB=c:/Dev/test/ldapcsdk/client-kvaughan-db-10-2003
|
||||
DEV_NULL="nul:"
|
||||
;;
|
||||
*)
|
||||
echo "unknown operating system $OS" 2>&1
|
||||
exit 1
|
||||
esac
|
||||
|
||||
# set up locale environment (charset)
|
||||
if [ $OS != WINNT ]; then
|
||||
LC_ALL=$LDAPTOOL_LC_CTYPE; export LC_ALL
|
||||
if [ $VERBOSE -ne 0 ]; then
|
||||
echo "$0: LC_ALL=$LDAPTOOL_LC_CTYPE"
|
||||
locale
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$OS" = "WINNT" ]; then
|
||||
CMD_TO_UTF8=cat
|
||||
else
|
||||
CMD_TO_UTF8="iconv -f $ICONV_SRC_CHARSET -t $ICONV_UTF8_CHARSET"
|
||||
fi
|
||||
|
||||
|
||||
TEST_SSL=yes
|
||||
TEST_SSL_CLIENT_AUTH=yes
|
||||
TEST_SEARCHES=yes
|
||||
TEST_MODIFIES=yes
|
||||
# moddn, etc.
|
||||
TEST_MODDNNEWSUP=no
|
||||
|
||||
if [ ! -z "$LDAPDEBUG" ]; then
|
||||
DEBUG_ARG="-d $LDAPDEBUG"
|
||||
fi
|
||||
|
||||
if [ $VERBOSE -ne 0 ]; then
|
||||
VERBOSE_ARG="-v"
|
||||
fi
|
||||
|
||||
SEP="++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
||||
|
||||
|
||||
# OS, OBJDIR, NSS_RELEASE, and NSPR_RELEASE must be set
|
||||
setup_shlib_access()
|
||||
{
|
||||
NSS_LIB_PATH="$NSS_RELEASE_ROOT/$NSS_RELEASE/$OBJDIR/lib"
|
||||
NSPR_LIB_PATH="$NSPR_RELEASE_ROOT/$NSPR_RELEASE/$OBJDIR/lib"
|
||||
if [ -z "$EXTRA_LIB_PATH" ]; then
|
||||
SHARED_LIB_PATH=$NSS_LIB_PATH:$NSPR_LIB_PATH
|
||||
else
|
||||
SHARED_LIB_PATH=$NSS_LIB_PATH:$NSPR_LIB_PATH:$EXTRA_LIB_PATH
|
||||
fi
|
||||
|
||||
case $OS in
|
||||
SunOS|IRIX)
|
||||
LD_LIBRARY_PATH=$SHARED_LIB_PATH;
|
||||
export LD_LIBRARY_PATH;
|
||||
ROOT_CERT_SO=libnssckbi.so
|
||||
;;
|
||||
HP-UX)
|
||||
SHLIB_PATH=$SHARED_LIB_PATH;
|
||||
export SHLIB_PATH;
|
||||
ROOT_CERT_SO=libnssckbi.sl
|
||||
;;
|
||||
AIX)
|
||||
LIBPATH=$SHARED_LIB_PATH;
|
||||
export LIBPATH;
|
||||
ROOT_CERT_SO=libnssckbi.so
|
||||
;;
|
||||
Linux)
|
||||
LD_LIBRARY_PATH=$SHARED_LIB_PATH;
|
||||
export LD_LIBRARY_PATH;
|
||||
ROOT_CERT_SO=libnssckbi.so
|
||||
;;
|
||||
WINNT)
|
||||
PATH="`pwd`/$OBJDIR/lib;:$PATH;"
|
||||
export PATH;
|
||||
ROOT_CERT_SO=nssckbi.dll
|
||||
;;
|
||||
*)
|
||||
echo "setup_shlib_access: unknown operating system $OS" 2>&1
|
||||
exit 1
|
||||
esac
|
||||
|
||||
if [ z$TEST_SSL = z"yes" ]; then
|
||||
# Copy root cert shared library to cert DB location
|
||||
ROOT_CERT_SO_DST_PATH=$CERTDB/$ROOT_CERT_SO
|
||||
if [ "$SKIP_SHLIB_COPY" -eq 0 ]; then
|
||||
echo setup_shlib_access: cp -p $NSS_LIB_PATH/$ROOT_CERT_SO $ROOT_CERT_SO_DST_PATH
|
||||
cp -p $NSS_LIB_PATH/$ROOT_CERT_SO $ROOT_CERT_SO_DST_PATH
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# ROOT_CERT_SO_DST_PATH must be set
|
||||
cleanup_shlib_access()
|
||||
{
|
||||
if [ "$SKIP_SHLIB_COPY" -eq 0 ]; then
|
||||
echo cleanup_shlib_access: rm $ROOT_CERT_SO_DST_PATH
|
||||
rm $ROOT_CERT_SO_DST_PATH
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# OBJDIR and OS must be set
|
||||
test_one()
|
||||
{
|
||||
TEST_ONE_RC=0
|
||||
|
||||
if [ "$OS" = "WINNT" ]; then
|
||||
# echo "cd $OBJDIR/lib"
|
||||
# cd $OBJDIR/lib
|
||||
# LDAPTOOLSDIR=../tools
|
||||
LDAPTOOLSDIR=$OBJDIR/tools
|
||||
else
|
||||
echo "cd $OBJDIR/tools"
|
||||
cd $OBJDIR/tools
|
||||
LDAPTOOLSDIR=.
|
||||
fi
|
||||
|
||||
if [ z$TEST_SEARCHES = z"yes" ]; then
|
||||
# test searches
|
||||
|
||||
echo search1 $SEP
|
||||
$LDAPTOOLSDIR/ldapsearch $VERBOSE_ARG $DEBUG_ARG \
|
||||
-h $LDAPHOST -p $LDAPPORT \
|
||||
-b "$LDAPBASE" 'objectClass=*' > $TOOLS_OUTFILE < $DEV_NULL
|
||||
TOOLS_RC=$?
|
||||
if [ $TOOLS_RC -ne 0 ]; then
|
||||
echo "** FAILURE search1 ($TOOLS_RC)";
|
||||
if [ $STOP_ON_ERRORS -ne 0 ]; then return $TOOLS_RC; fi
|
||||
TEST_ONE_RC=$TOOLS_RC;
|
||||
fi
|
||||
|
||||
if [ z$TEST_SSL = z"yes" ]; then
|
||||
echo sslsearch1 $SEP
|
||||
$LDAPTOOLSDIR/ldapsearch $VERBOSE_ARG $DEBUG_ARG \
|
||||
-h $LDAPHOST -p $LDAPSPORT \
|
||||
-b "$LDAPBASE" $EXTRA_SSL_ARGS -Z -P $CERTDB \
|
||||
'objectClass=*' > $TOOLS_OUTFILE < $DEV_NULL
|
||||
TOOLS_RC=$?
|
||||
if [ $TOOLS_RC -ne 0 ]; then
|
||||
echo "** FAILURE sslsearch1 ($TOOLS_RC)";
|
||||
if [ $STOP_ON_ERRORS -ne 0 ]; then return $TOOLS_RC; fi
|
||||
TEST_ONE_RC=$TOOLS_RC;
|
||||
fi
|
||||
|
||||
if [ z$TEST_SSL_CLIENT_AUTH = z"yes" ]; then
|
||||
echo sslsearch2-clientauth $SEP
|
||||
$LDAPTOOLSDIR/ldapsearch $VERBOSE_ARG $DEBUG_ARG \
|
||||
-h $LDAPHOST -p $LDAPSPORT \
|
||||
-b "" -s base $EXTRA_SSL_ARGS -Z -P $CERTDB -N "$CERTNAME" \
|
||||
-W "$KEYPASSWD" 'objectClass=*' > $TOOLS_OUTFILE < $DEV_NULL
|
||||
TOOLS_RC=$?
|
||||
if [ $TOOLS_RC -ne 0 ]; then
|
||||
echo "** FAILURE sslsearch2 ($TOOLS_RC)";
|
||||
if [ $STOP_ON_ERRORS -ne 0 ]; then return $TOOLS_RC; fi
|
||||
TEST_ONE_RC=$TOOLS_RC;
|
||||
fi
|
||||
fi
|
||||
# end of SSL client auth search tests
|
||||
|
||||
fi
|
||||
# end of SSL search tests
|
||||
|
||||
fi
|
||||
# end of search tests
|
||||
|
||||
if [ z$TEST_MODIFIES = z"yes" ]; then
|
||||
# modify
|
||||
|
||||
echo modify1 $SEP
|
||||
$LDAPTOOLSDIR/ldapmodify $VERBOSE_ARG $DEBUG_ARG -a \
|
||||
-h $LDAPHOST -p $LDAPPORT \
|
||||
-D "$BINDDN" -w "$BINDPW" <<MOD1 > $TOOLS_OUTFILE
|
||||
dn: cn=Test Entry, $LDAPBASE
|
||||
cn: Test Entry
|
||||
sn: Entry
|
||||
objectClass: person
|
||||
MOD1
|
||||
TOOLS_RC=$?
|
||||
if [ $TOOLS_RC -ne 0 ]; then
|
||||
echo "** FAILURE modify1 ($TOOLS_RC)";
|
||||
if [ $STOP_ON_ERRORS -ne 0 ]; then return $TOOLS_RC; fi
|
||||
TEST_ONE_RC=$TOOLS_RC;
|
||||
fi
|
||||
|
||||
echo modverifysearch1 $SEP
|
||||
$LDAPTOOLSDIR/ldapsearch $VERBOSE_ARG $DEBUG_ARG \
|
||||
-h $LDAPHOST -p $LDAPPORT \
|
||||
-b "$LDAPBASE" 'sn=Entry' > $TOOLS_OUTFILE < $DEV_NULL
|
||||
TOOLS_RC=$?
|
||||
if [ $TOOLS_RC -ne 0 ]; then
|
||||
echo "** FAILURE modverifysearch1 ($TOOLS_RC)";
|
||||
if [ $STOP_ON_ERRORS -ne 0 ]; then return $TOOLS_RC; fi
|
||||
TEST_ONE_RC=$TOOLS_RC;
|
||||
fi
|
||||
|
||||
# I18n modify and search
|
||||
echo i18nmodify1 $SEP
|
||||
LAST_ENTRY_DN_88591="cn=á with accent Entry,$LDAPBASE"
|
||||
LAST_ENTRY_DN_UTF8="cn=\C3\A1 with accent Entry,$LDAPBASE"
|
||||
|
||||
if [ $OS != WINNT ]; then
|
||||
$CMD_TO_UTF8 <<I18NMOD1 > $TOOLS_TMPFILE
|
||||
dn: $LAST_ENTRY_DN_88591
|
||||
cn: á with accent Entry
|
||||
sn: A Entry
|
||||
objectClass: person
|
||||
I18NMOD1
|
||||
else
|
||||
cat <<I18NMOD1b > $TOOLS_TMPFILE
|
||||
dn: $LAST_ENTRY_DN_UTF8
|
||||
sn: A Entry
|
||||
objectClass: person
|
||||
I18NMOD1b
|
||||
fi
|
||||
TOOLS_RC=$?
|
||||
if [ $TOOLS_RC -ne 0 ]; then
|
||||
rm $TOOLS_TMPFILE
|
||||
echo "** FAILURE $CMD_TO_UTF8 ($TOOLS_RC)";
|
||||
if [ $STOP_ON_ERRORS -ne 0 ]; then return $TOOLS_RC; fi
|
||||
TEST_ONE_RC=$TOOLS_RC;
|
||||
fi
|
||||
|
||||
$LDAPTOOLSDIR/ldapmodify $VERBOSE_ARG $DEBUG_ARG -a \
|
||||
-h $LDAPHOST -p $LDAPPORT \
|
||||
-D "$BINDDN" -w "$BINDPW" < $TOOLS_TMPFILE > $TOOLS_OUTFILE
|
||||
TOOLS_RC=$?
|
||||
rm $TOOLS_TMPFILE
|
||||
if [ $TOOLS_RC -ne 0 ]; then
|
||||
echo "** FAILURE i18nmodify1 ($TOOLS_RC)";
|
||||
if [ $STOP_ON_ERRORS -ne 0 ]; then return $TOOLS_RC; fi
|
||||
TEST_ONE_RC=$TOOLS_RC;
|
||||
fi
|
||||
|
||||
echo i18nmodverifysearch1 $SEP
|
||||
$LDAPTOOLSDIR/ldapsearch $VERBOSE_ARG $DEBUG_ARG \
|
||||
-h $LDAPHOST -p $LDAPPORT -s base \
|
||||
-b "$LAST_ENTRY_DN_88591" 'objectClass=*' > $TOOLS_OUTFILE < $DEV_NULL
|
||||
TOOLS_RC=$?
|
||||
if [ $TOOLS_RC -ne 0 ]; then
|
||||
echo "** FAILURE i18nmodverifysearch1 ($TOOLS_RC)";
|
||||
if [ $STOP_ON_ERRORS -ne 0 ]; then return $TOOLS_RC; fi
|
||||
TEST_ONE_RC=$TOOLS_RC;
|
||||
fi
|
||||
|
||||
echo i18ndelete1 $SEP
|
||||
$LDAPTOOLSDIR/ldapdelete $VERBOSE_ARG $DEBUG_ARG \
|
||||
-h $LDAPHOST -p $LDAPPORT \
|
||||
-D "$BINDDN" -w "$BINDPW" \
|
||||
-i $ICONV_UTF8_CHARSET "$LAST_ENTRY_DN_UTF8" > $TOOLS_OUTFILE
|
||||
TOOLS_RC=$?
|
||||
if [ $TOOLS_RC -ne 0 ]; then
|
||||
echo "** FAILURE i18ndelete1 ($TOOLS_RC)";
|
||||
if [ $STOP_ON_ERRORS -ne 0 ]; then return $TOOLS_RC; fi
|
||||
TEST_ONE_RC=$TOOLS_RC;
|
||||
fi
|
||||
|
||||
# modrdn
|
||||
echo modrdn1 $SEP
|
||||
$LDAPTOOLSDIR/ldapmodify $VERBOSE_ARG $DEBUG_ARG \
|
||||
-h $LDAPHOST -p $LDAPPORT \
|
||||
-D "$BINDDN" -w "$BINDPW" <<MOD2 > $TOOLS_OUTFILE
|
||||
dn: cn=Test Entry, $LDAPBASE
|
||||
changetype: modrdn
|
||||
newrdn: cn=Testy Entry
|
||||
deleteoldrdn: 0
|
||||
MOD2
|
||||
TOOLS_RC=$?
|
||||
if [ $TOOLS_RC -ne 0 ]; then
|
||||
echo "** FAILURE modrdn1 ($TOOLS_RC)";
|
||||
if [ $STOP_ON_ERRORS -ne 0 ]; then return $TOOLS_RC; fi
|
||||
TEST_ONE_RC=$TOOLS_RC;
|
||||
fi
|
||||
|
||||
LAST_ENTRY_DN="cn=Testy Entry, $LDAPBASE"
|
||||
|
||||
echo modverifysearch2 $SEP
|
||||
$LDAPTOOLSDIR/ldapsearch $VERBOSE_ARG $DEBUG_ARG \
|
||||
-h $LDAPHOST -p $LDAPPORT \
|
||||
-b "$LDAPBASE" 'sn=Entry' > $TOOLS_OUTFILE < $DEV_NULL
|
||||
TOOLS_RC=$?
|
||||
if [ $TOOLS_RC -ne 0 ]; then
|
||||
echo "** FAILURE modverifysearch2 ($TOOLS_RC)";
|
||||
if [ $STOP_ON_ERRORS -ne 0 ]; then return $TOOLS_RC; fi
|
||||
TEST_ONE_RC=$TOOLS_RC;
|
||||
fi
|
||||
|
||||
if [ z$TEST_MODDNNEWSUP = z"yes" ]; then
|
||||
# moddn with new superior
|
||||
echo moddn1 $SEP
|
||||
$LDAPTOOLSDIR/ldapmodify -V 3 $VERBOSE_ARG $DEBUG_ARG \
|
||||
-h $LDAPHOST -p $LDAPPORT \
|
||||
-D "$BINDDN" -w "$BINDPW" <<MOD3 > $TOOLS_OUTFILE
|
||||
dn: cn=Test Entry, $LDAPBASE
|
||||
changetype: moddn
|
||||
newrdn: cn=Testier Entry
|
||||
deleteoldrdn: 0
|
||||
newparent: ou=People, $LDAPBASE
|
||||
MOD3
|
||||
TOOLS_RC=$?
|
||||
if [ $TOOLS_RC -ne 0 ]; then
|
||||
echo "** FAILURE moddn1 ($TOOLS_RC)";
|
||||
if [ $STOP_ON_ERRORS -ne 0 ]; then return $TOOLS_RC; fi
|
||||
TEST_ONE_RC=$TOOLS_RC;
|
||||
fi
|
||||
|
||||
LAST_ENTRY_DN="cn=Testier Entry, ou=People, $LDAPBASE"
|
||||
|
||||
echo modverifysearch3 $SEP
|
||||
$LDAPTOOLSDIR/ldapsearch $VERBOSE_ARG $DEBUG_ARG \
|
||||
-h $LDAPHOST -p $LDAPPORT \
|
||||
-b "$LDAPBASE" 'sn=Entry' > $TOOLS_OUTFILE < $DEV_NULL
|
||||
TOOLS_RC=$?
|
||||
if [ $TOOLS_RC -ne 0 ]; then
|
||||
echo "** FAILURE modverifysearch3 ($TOOLS_RC)";
|
||||
if [ $STOP_ON_ERRORS -ne 0 ]; then return $TOOLS_RC; fi
|
||||
TEST_ONE_RC=$TOOLS_RC;
|
||||
fi
|
||||
|
||||
# end of moddn with new superior tests
|
||||
fi
|
||||
|
||||
if [ z$TEST_SSL = z"yes" ]; then
|
||||
echo delete1 $SEP
|
||||
$LDAPTOOLSDIR/ldapdelete $VERBOSE_ARG $DEBUG_ARG \
|
||||
-h $LDAPHOST -p $LDAPSPORT \
|
||||
-D "$BINDDN" -w "$BINDPW" $EXTRA_SSL_ARGS -Z -P $CERTDB \
|
||||
"$LAST_ENTRY_DN" > $TOOLS_OUTFILE
|
||||
TOOLS_RC=$?
|
||||
if [ $TOOLS_RC -ne 0 ]; then
|
||||
echo "** FAILURE ssldelete1 ($TOOLS_RC)";
|
||||
if [ $STOP_ON_ERRORS -ne 0 ]; then return $TOOLS_RC; fi
|
||||
TEST_ONE_RC=$TOOLS_RC;
|
||||
fi
|
||||
|
||||
else
|
||||
echo delete 1 $SEP
|
||||
$LDAPTOOLSDIR/ldapdelete $VERBOSE_ARG $DEBUG_ARG \
|
||||
-h $LDAPHOST -p $LDAPPORT \
|
||||
-D "$BINDDN" -w "$BINDPW" \
|
||||
"$LAST_ENTRY_DN" > $TOOLS_OUTFILE
|
||||
TOOLS_RC=$?
|
||||
if [ $TOOLS_RC -ne 0 ]; then
|
||||
echo "** FAILURE delete1 ($TOOLS_RC)";
|
||||
if [ $STOP_ON_ERRORS -ne 0 ]; then return $TOOLS_RC; fi
|
||||
TEST_ONE_RC=$TOOLS_RC;
|
||||
fi
|
||||
fi
|
||||
# end of SSL or non-SSL delete test
|
||||
|
||||
fi
|
||||
# end of modify tests
|
||||
|
||||
return $TEST_ONE_RC;
|
||||
}
|
||||
|
||||
echo $0 started
|
||||
echo server: $LDAPHOST:$LDAPPORT
|
||||
echo ssl: $TEST_SSL "(port $LDAPSPORT)"
|
||||
echo clientath: $TEST_SSL_CLIENT_AUTH
|
||||
echo moddn: $TEST_MODDNNEWSUP
|
||||
echo search: $TEST_SEARCHES
|
||||
echo modify: $TEST_MODIFIES
|
||||
echo nss: $NSS_RELEASE
|
||||
echo nspr: $NSPR_RELEASE
|
||||
|
||||
RC=0
|
||||
TESTED_STR=""
|
||||
TESTED_COUNT=0
|
||||
TESTED_FAIL_COUNT=0
|
||||
TESTED_SKIP_COUNT=0
|
||||
HOMEBASE_DIR=`pwd`;
|
||||
for os in $OS_VARIANTS; do
|
||||
for build in $BUILD_VARIANTS; do
|
||||
OBJDIR="${os}_${build}"
|
||||
echo ""
|
||||
if [ ! -d "$OBJDIR" ]; then
|
||||
echo "Skipping $OBJDIR (no such directory)..."
|
||||
TESTED_SKIP_COUNT=`expr $TESTED_SKIP_COUNT + 1`;
|
||||
continue;
|
||||
fi
|
||||
echo Testing $OBJDIR...
|
||||
setup_shlib_access;
|
||||
test_one;
|
||||
ONE_RC=$?
|
||||
cleanup_shlib_access;
|
||||
TESTED_COUNT=`expr $TESTED_COUNT + 1`;
|
||||
TESTED_STR="$TESTED_STR $OBJDIR";
|
||||
if [ $ONE_RC -ne 0 ]; then
|
||||
echo "** FAILURE $OBJDIR";
|
||||
TESTED_FAIL_COUNT=`expr $TESTED_FAIL_COUNT + 1`;
|
||||
if [ $STOP_ON_ERRORS -ne 0 ]; then
|
||||
exit $ONE_RC;
|
||||
else
|
||||
RC=$ONE_RC;
|
||||
fi
|
||||
fi
|
||||
cd $HOMEBASE_DIR
|
||||
done
|
||||
done
|
||||
|
||||
echo ""
|
||||
if [ "$TESTED_SKIP_COUNT" -gt 0 ]; then
|
||||
SKIP_STR=" (skipped $TESTED_SKIP_COUNT tests)";
|
||||
else
|
||||
SKIP_STR="";
|
||||
fi
|
||||
if [ -z "$TESTED_STR" ]; then
|
||||
echo "No tests executed$SKIP_STR."
|
||||
RC=2;
|
||||
else
|
||||
echo "Tested $TESTED_STR."
|
||||
if [ "$ONE_RC" -eq 0 ]; then
|
||||
echo "All $TESTED_COUNT tests completed OK$SKIP_STR."
|
||||
else
|
||||
echo "$TESTED_FAIL_COUNT tests of $TESTED_COUNT failed $SKIP_STR."
|
||||
fi
|
||||
fi
|
||||
|
||||
echo $0 done.
|
||||
exit $RC
|
|
@ -0,0 +1,61 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mark Smith <MarkCSmithWork@aol.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
# Makefile for unfoldldif
|
||||
TARGETS = unfoldldif
|
||||
SRC = unfoldldif.c
|
||||
OBJ = unfoldldif.o
|
||||
CFLAGS = -O
|
||||
# uncomment the next line to use gcc for the build:
|
||||
#CC=gcc
|
||||
# uncomment the next line to build under Solaris 2.x:
|
||||
LIBS=-lnsl -lsocket -lresolv
|
||||
# uncomment the next line if not on Solaris 2.x and your libc doesn't
|
||||
# have resolver routines:
|
||||
#LIBS = -lresolv
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
getdate: $(OBJ)
|
||||
$(CC) -o $@ $(OBJ) $(LIBS)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(TARGETS)
|
|
@ -0,0 +1,69 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mark Smith <MarkCSmithWork@aol.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* simple filter (stdin -> stdout) that joins continued LDIF lines
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
char buf[ 4096 ];
|
||||
int first, len;
|
||||
|
||||
first = 1;
|
||||
while ( fgets( buf, sizeof( buf), stdin ) != NULL ) {
|
||||
len = strlen( buf );
|
||||
if ( buf[ len - 1 ] == '\n' ) {
|
||||
buf[ len - 1 ] = '\0'; /* strip trailing newline */
|
||||
}
|
||||
|
||||
if ( buf[0] == ' ' ) { /* continued line */
|
||||
fputs( buf + 1, stdout );
|
||||
} else {
|
||||
if ( !first ) {
|
||||
putchar( '\n' );
|
||||
}
|
||||
fputs( buf, stdout );
|
||||
}
|
||||
|
||||
first = 0;
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
|
@ -0,0 +1,279 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mark Smith <MarkCSmithWork@aol.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
#
|
||||
# utc -- Perl 5 script that reads someone's directory entry and tries
|
||||
# to go Up The Chain to get their manager's entry (based on the
|
||||
# "manager" attribute).
|
||||
#
|
||||
# Requires: LDAPP (PerlLDAP)
|
||||
#
|
||||
# Usage: utc <searchstring>
|
||||
#
|
||||
|
||||
use lib '/usr/local/packages/nsperl553/lib/nsPerl5.005_03/lib/site';
|
||||
|
||||
use Mozilla::LDAP::Conn;
|
||||
|
||||
|
||||
# LDAP server information
|
||||
$ldapbase = "dc=example,dc=com";
|
||||
$ldaphost = "ldap.example.com";
|
||||
$ldapport = "389";
|
||||
|
||||
# constants
|
||||
$unknown = "???";
|
||||
$separator = "\n";
|
||||
$doRecurse = 1;
|
||||
$noRecurse = 0;
|
||||
$fillString = " ";
|
||||
$attrManager = "manager";
|
||||
@attrlist = ( "cn", "uid", "mail", "departmentnumber", "telephonenumber",
|
||||
"roomnumber", "postaladdress", "ou", "title", "displayname",
|
||||
"description", "labeleduri", $attrManager );
|
||||
|
||||
# Start of main:
|
||||
|
||||
# extract base part of this script's name and report usage errors
|
||||
($progname) = $0 =~ /([^\/]+)$/;
|
||||
usage( $progname ) if ($#ARGV == -1);
|
||||
|
||||
# open an anonymous connection to the LDAP server
|
||||
$ldap = new Mozilla::LDAP::Conn( $ldaphost, $ldapport );
|
||||
die "Unable to connect to server at ldap://$ldaphost:$ldapport\n" unless $ldap;
|
||||
|
||||
while ($#ARGV >= 0) {
|
||||
$query = shift @ARGV;
|
||||
utc( $ldap, $query );
|
||||
}
|
||||
|
||||
# clean up
|
||||
$ldap->close;
|
||||
|
||||
# End of main.
|
||||
|
||||
|
||||
# Start of usage.
|
||||
# Display program usage instructions.
|
||||
sub
|
||||
usage()
|
||||
{
|
||||
local( $prog )= @_;
|
||||
print " usage: $prog querystring...\n";
|
||||
print "example: $prog jimb\n";
|
||||
exit 1;
|
||||
}
|
||||
# End of usage.
|
||||
|
||||
|
||||
# Start of utc:
|
||||
# given an LDAP connection and a query string, find a user and
|
||||
# then traverse "up the chain"
|
||||
sub
|
||||
utc {
|
||||
local( $ldap, $query ) = @_;
|
||||
|
||||
local( $entry, $i, @entrydns );
|
||||
|
||||
# form filter using query string
|
||||
if ( $query =~ /^.*=.*/ ) {
|
||||
$filter = $query;
|
||||
} else {
|
||||
$filter = "(&(objectClass=person)(|(sn=$query)(cn=$query)(uid=$query)))";
|
||||
}
|
||||
|
||||
# search it
|
||||
$entry = $ldap->search( $ldapbase, "subtree", $filter, 0, @attrlist );
|
||||
|
||||
# display results
|
||||
if ( $entry ) {
|
||||
$count = 0;
|
||||
while ( $entry ) {
|
||||
@entrydns[count] = $entry->{"dn"};
|
||||
++$count;
|
||||
$entry = $ldap->nextEntry;
|
||||
|
||||
}
|
||||
|
||||
if ( $count > 1 ) {
|
||||
print $count, " entries matched '$query'\n";
|
||||
} else {
|
||||
print "One entry matched '$query'\n";
|
||||
}
|
||||
|
||||
for ( $i = 0; $i < $count; ++$i ) {
|
||||
readEntry( $ldap, @entrydns[i], $doRecurse, 1 );
|
||||
}
|
||||
} else {
|
||||
print "No entries matched '$query'\n";
|
||||
}
|
||||
}
|
||||
# End of utc.
|
||||
|
||||
|
||||
# Start of readEntry:
|
||||
# given a DN, read and display one LDAP entry
|
||||
sub
|
||||
readEntry {
|
||||
local( $ldap, $dn, $recurse, $depth ) = @_;
|
||||
|
||||
local( $entry, $managerDN );
|
||||
|
||||
$entry = $ldap->search( $dn, "base", "objectclass=*", 0, @attrlist );
|
||||
|
||||
if ( $entry ) {
|
||||
displayEntry( $entry, $depth );
|
||||
if ( $recurse eq $doRecurse && $entry->{$attrManager} ) {
|
||||
$managerDN = $entry->{$attrManager}[0];
|
||||
# stop if a person is their own manager (!)
|
||||
if ( $managerDN ne $dn ) {
|
||||
readEntry( $ldap, $entry->{$attrManager}[0],
|
||||
$recurse, $depth + 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# End of readEntry.
|
||||
|
||||
|
||||
# Start of displayEntry:
|
||||
sub
|
||||
displayEntry {
|
||||
local( $entry, $depth ) = @_;
|
||||
local( $value );
|
||||
local( @attrs );
|
||||
|
||||
@attrs = ( "displayName", "cn" );
|
||||
printf( "%*sLogin name: %-8s In real life: %s\n",
|
||||
$depth, $fillString,
|
||||
getSimpleValue( $entry, "uid" ),
|
||||
getFirstValue( $entry, *attrs ));
|
||||
|
||||
printf( "%*sE-Mail: %-32s Phone: %s\n",
|
||||
$depth, $fillString,
|
||||
getSimpleValue( $entry, "mail" ),
|
||||
getSimpleValue( $entry, "telephonenumber" ));
|
||||
|
||||
@attrs = ( "ou", "departmentnumber" );
|
||||
printf( "%*sDepartment: %-32s Room: %s\n",
|
||||
$depth, $fillString,
|
||||
getFirstValue( $entry, *attrs ),
|
||||
getSimpleValue( $entry, "roomnumber" ));
|
||||
|
||||
$value = getSimpleValue( $entry, "postaladdress" );
|
||||
if ( $value ne $unknown ) {
|
||||
printf( "%*sAddress: %s\n",
|
||||
$depth, $fillString,
|
||||
$value );
|
||||
}
|
||||
|
||||
$value = getSimpleValue( $entry, "title" );
|
||||
if ( $value ne $unknown ) {
|
||||
printf( "%*sTitle: %s\n",
|
||||
$depth, $fillString,
|
||||
$value );
|
||||
}
|
||||
|
||||
$value = getSimpleValue( $entry, "description" );
|
||||
if ( $value ne $unknown ) {
|
||||
printf( "%*sDescription: %s\n",
|
||||
$depth, $fillString,
|
||||
$value );
|
||||
}
|
||||
|
||||
displayAllValues( $entry, "labeleduri", "URL: ", $depth );
|
||||
|
||||
printf( "%*sManager: %s\n",
|
||||
$depth, $fillString,
|
||||
getSimpleValue( $entry, "manager" ));
|
||||
|
||||
print $separator;
|
||||
}
|
||||
# End of displayEntry.
|
||||
|
||||
|
||||
# Start of displayAllValues:
|
||||
sub
|
||||
displayAllValues {
|
||||
local( $entry, $attr, $prefix, $indent ) = @_;
|
||||
local( $value );
|
||||
|
||||
if ( $entry->{$attr} ) {
|
||||
foreach $value (@{$entry->{$attr}}) {
|
||||
printf( "%*s%s%s\n", $indent, $fillString,
|
||||
$prefix, $value );
|
||||
}
|
||||
}
|
||||
}
|
||||
# End of displayAllValues.
|
||||
|
||||
# Start of getSimpleValue:
|
||||
sub
|
||||
getSimpleValue {
|
||||
local( $entry, $attr ) = @_;
|
||||
local( $value );
|
||||
|
||||
if ( $entry->{$attr} ) {
|
||||
$value = $entry->{$attr}[0];
|
||||
} else {
|
||||
$value = $unknown;
|
||||
}
|
||||
|
||||
$value;
|
||||
}
|
||||
# End of getSimpleValue.
|
||||
|
||||
# Start of getFirstValue:
|
||||
sub
|
||||
getFirstValue {
|
||||
local( $entry, *attrs ) = @_;
|
||||
local( $a );
|
||||
local( $value );
|
||||
|
||||
$value = $unknown;
|
||||
|
||||
foreach $a (@attrs) {
|
||||
$value = getSimpleValue( $entry, $a );
|
||||
last if ( $value ne $unknown );
|
||||
}
|
||||
|
||||
$value;
|
||||
}
|
||||
# End of getFirstValue.
|
|
@ -0,0 +1,70 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mark Smith <MarkCSmithWork@aol.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
# Makefile for getdate
|
||||
TARGETS = getdate numberlines physmem stat
|
||||
SRC = getdate.c numberlines.c physmem.c stat.c
|
||||
OBJ = getdate.o numberlines.o physmem.o stat.o
|
||||
CFLAGS = -O
|
||||
# uncomment the next line to use gcc for the build:
|
||||
#CC=gcc
|
||||
# uncomment the next line to build under Solaris 2.x:
|
||||
LIBS=-lnsl -lsocket -lresolv
|
||||
# uncomment the next line if not on Solaris 2.x and your libc doesn't
|
||||
# have resolver routines:
|
||||
#LIBS = -lresolv
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
getdate: getdate.o
|
||||
$(CC) -o $@ $< $(LIBS)
|
||||
|
||||
numberlines: numberlines.o
|
||||
$(CC) -o $@ $< $(LIBS)
|
||||
|
||||
physmem: physmem.o
|
||||
$(CC) -o $@ $< $(LIBS)
|
||||
|
||||
stat: stat.o
|
||||
$(CC) -o $@ $< $(LIBS)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(TARGETS)
|
|
@ -0,0 +1,160 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mark Smith <MarkCSmithWork@aol.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
# alarm: a simple script to ring a bell after a specified time period elapses.
|
||||
#
|
||||
# usage: alarm +relativetime [msg]
|
||||
# alarm absolutetime [msg]
|
||||
#
|
||||
# where:
|
||||
# relativetime is a number in seconds or a number followed by
|
||||
# a unit character (s for seconds, m for minutes, h for hours), e.g., +2h
|
||||
# absolutetime is a precise time for the alarm, e.g., 3pm
|
||||
# msg is an optional text message to be displayed when the alarm fires.
|
||||
#
|
||||
|
||||
ECHO_MINUS_N="/usr/ucb/echo -n"
|
||||
ECHO=echo
|
||||
GETDATE=$HOME/usr/bin-`uname`/getdate
|
||||
|
||||
ring_bell()
|
||||
{
|
||||
for i in a b c d e; do
|
||||
$ECHO_MINUS_N
|
||||
sleep 1
|
||||
done
|
||||
sleep 2;
|
||||
for i in a b c d e; do
|
||||
$ECHO_MINUS_N
|
||||
sleep 1
|
||||
done
|
||||
$ECHO ""
|
||||
}
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
$ECHO "usage: $0 absolutetime [msg]"
|
||||
$ECHO "usage: $0 +relativetime [msg]"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
RAWTIME=$1
|
||||
if [ -z "$2" ]; then
|
||||
MSG="Alarm!"
|
||||
else
|
||||
shift
|
||||
MSG="Alarm: $*"
|
||||
fi
|
||||
|
||||
FIRSTCHAR=`$ECHO $RAWTIME | sed -e 's/\(.\).*$/\1/'`
|
||||
if [ $FIRSTCHAR = "+" ]; then
|
||||
# relative time
|
||||
ALLBUTFIRST=`$ECHO $RAWTIME | sed -e 's/^.//'`
|
||||
LASTCHAR=`$ECHO $ALLBUTFIRST | sed -e 's/^.*\(.\)$/\1/'`
|
||||
ALLBUTLAST=`$ECHO $ALLBUTFIRST | sed -e 's/.$//'`
|
||||
case $LASTCHAR in
|
||||
s)
|
||||
SLEEPTIME=$ALLBUTLAST
|
||||
break;
|
||||
;;
|
||||
m)
|
||||
SLEEPTIME=`expr $ALLBUTLAST \* 60`
|
||||
break;
|
||||
;;
|
||||
h)
|
||||
SLEEPTIME=`expr $ALLBUTLAST \* 60 \* 60`
|
||||
break;
|
||||
;;
|
||||
[0-9])
|
||||
SLEEPTIME=$ALLBUTFIRST
|
||||
break;
|
||||
;;
|
||||
*)
|
||||
$ECHO "time must be in the form [0-9]*s, [0-9]*m, [0-9]*h"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
else
|
||||
# absolute time
|
||||
if [ -z "$DATEMSK" ]; then
|
||||
DATEMSK=$HOME/.datemsk; export DATEMSK
|
||||
fi
|
||||
CURRENT_TIME=`date`;
|
||||
CURRENT_TIME_SECS=`$GETDATE "$CURRENT_TIME"`
|
||||
if [ $? -ne 0 ]; then
|
||||
$ECHO "$GETDATE failed for current time"
|
||||
exit 1
|
||||
fi
|
||||
ALARM_TIME_SECS=`$GETDATE "$RAWTIME"`
|
||||
if [ $? -ne 0 ]; then
|
||||
ALARM_TIME_SECS="";
|
||||
# try adding an 'm' if the last char. is an 'a' or a 'p' (so 5am and 5pm work)
|
||||
LASTCHAR=`$ECHO $RAWTIME | sed -e 's/^.*\(.\)$/\1/'`
|
||||
if [ "$LASTCHAR" = "p" -o "$LASTCHAR" = "a" ]; then
|
||||
ALARM_TIME_SECS=`$GETDATE "$RAWTIME"m`
|
||||
if [ $? -ne 0 ]; then
|
||||
ALARM_TIME_SECS="";
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$ALARM_TIME_SECS" ]; then
|
||||
$ECHO "$GETDATE failed for $RAWTIME; try one of these formats:"
|
||||
cat $DATEMSK
|
||||
exit 1
|
||||
fi
|
||||
SLEEPTIME=`expr $ALARM_TIME_SECS - $CURRENT_TIME_SECS`
|
||||
if [ $SLEEPTIME -le 0 ]; then
|
||||
SECONDS_AGO=`expr 0 - $SLEEPTIME`;
|
||||
$ECHO "$RAWTIME seems to be in the past ($SECONDS_AGO seconds ago)"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
#$ECHO rt=$RAWTIME fc=$FIRSTCHAR lc=$LASTCHAR sl=$SLEEPTIME
|
||||
|
||||
if [ $SLEEPTIME != "$ALLBUTLAST" ]; then
|
||||
$ECHO "$MSG in $SLEEPTIME seconds ($RAWTIME)..."
|
||||
else
|
||||
$ECHO "$MSG in $SLEEPTIME seconds..."
|
||||
fi
|
||||
sleep $SLEEPTIME
|
||||
$ECHO_MINUS_N "$MSG"
|
||||
ring_bell
|
||||
exit 0
|
|
@ -0,0 +1,75 @@
|
|||
#!/usr/local/bin/perl
|
||||
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mark Smith <MarkCSmithWork@aol.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
|
||||
# Open many connections to a host.
|
||||
#
|
||||
# usage: connect host port [count]
|
||||
#
|
||||
|
||||
require 5.002;
|
||||
use strict;
|
||||
use IO::Socket;
|
||||
|
||||
my ( $host, $port, $count, $msg, $i, @handle );
|
||||
|
||||
unless (@ARGV >= 2 && @ARGV <=4) { die "usage: $0 host port [count] [msg]" };
|
||||
|
||||
$host = shift;
|
||||
$port = shift;
|
||||
$count = shift || 1; # try to make just one connection by default
|
||||
$msg = shift || "";
|
||||
|
||||
for ( $i = 0; $i < $count; $i++ ) {
|
||||
$handle[$i] = IO::Socket::INET->new(
|
||||
PeerAddr => $host,
|
||||
PeerPort => $port,
|
||||
Proto => 'tcp' )
|
||||
or die "can't connect to port $port on $host: $!";
|
||||
print "$handle[$i] (", $i+1, " /$count)\n";
|
||||
if ( $msg ne "" ) {
|
||||
send $handle[$i], $msg, 0;
|
||||
print "wrote msg: $msg\n";
|
||||
}
|
||||
}
|
||||
|
||||
print "Sleeping for 1 hour....\n";
|
||||
sleep 3600;
|
||||
exit;
|
|
@ -0,0 +1,123 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mark Smith <MarkCSmithWork@aol.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
# Aliases to tweak the behavior of some existing commands:
|
||||
alias cd 'cd \!*;echo $cwd'
|
||||
alias df 'df -k'
|
||||
alias du 'du -k'
|
||||
alias ls 'ls -F'
|
||||
alias top 'top -I'
|
||||
alias vi vim
|
||||
|
||||
# Misc. time saving aliases:
|
||||
alias 'stty erase ^?'
|
||||
alias 'stty erase ^H'
|
||||
alias c clear
|
||||
alias pd pushd
|
||||
alias po popd
|
||||
alias j 'jobs -l'
|
||||
alias z suspend
|
||||
alias so 'source ~/.cshrc'
|
||||
alias h history
|
||||
alias dfl '\df -kl'
|
||||
alias psview sdtimage
|
||||
alias proc 'ps -ef | grep'
|
||||
alias myps 'ps -ef | grep "'^ \*$user'" | sort -k 2,2'
|
||||
alias gtar 'tar cvf - \!:1 | gzip -c > \!:2'
|
||||
alias guntar 'gunzip -c \!* | tar xvf -'
|
||||
alias guntart 'gunzip -c \!* | tar tvf -'
|
||||
alias word 'grep -iw \!* /usr/dict/words'
|
||||
alias wordst 'grep -i "^\!*" /usr/dict/words'
|
||||
|
||||
# VI and VIM aliases:
|
||||
alias ovi4 '(setenv EXINIT "$EXINIT4"; \vi \!*)'
|
||||
alias ovi8 '(setenv EXINIT "$EXINIT8"; \vi \!*)'
|
||||
alias vi4 '(setenv EXINIT "$EXINIT4"; vi \!*)'
|
||||
alias vi8 '(setenv VIMINIT "$VIMINIT8"; vi \!*)'
|
||||
|
||||
|
||||
# Printing/lp/lpr aliases:
|
||||
alias ps2up 'psnup -2 -d'
|
||||
alias lpps2up 'lpps -y group'
|
||||
alias lpman 'troff -man -Tpost \!* | /usr/lib/lp/postscript/dpost | lpps'
|
||||
alias pcal 'pcal -m'
|
||||
|
||||
# Network aliases:
|
||||
alias ping 'ping -sndv'
|
||||
alias vncserver '\vncserver -alwaysshared -geometry 1024x768'
|
||||
alias vncviewer '\vncviewer -shared'
|
||||
alias vnc vncviewer
|
||||
|
||||
# Conversion aliases:
|
||||
alias tohex 'echo 16o \!:1p | dc'
|
||||
alias fromhex 'echo 16i \!*p | dc'
|
||||
alias tobin 'echo 2o \!*p | dc'
|
||||
alias frombin 'echo 2i \!*p | dc'
|
||||
|
||||
# CVS aliases:
|
||||
alias cvsst 'cvs -nq status | grep "File:" | grep -v "Up-to-date"'
|
||||
alias cvsnup 'cvs -nq update'
|
||||
alias cvsup 'cvs -q update'
|
||||
alias cvsd 'cvs -nq diff -tU8 -N \!* | expand -4'
|
||||
alias cvsdf 'cvs -nq diff -U8 -N \!* | expand -4 > /tmp/diffs.txt; ls -l /tmp/diffs.txt'
|
||||
alias cvsaddtree 'find . -name CVS -prune -o -type d -exec cvs add {} \; ; find . -name CVS -prune -o -type f -exec cvs add {} \;'
|
||||
alias cvscol 'cvsco >& Log.co & ; sleep 5; tail -f Log.co'
|
||||
alias cvsdm '(setenv CVSROOT $MOZ_CVSROOT; cvsd \!*)'
|
||||
alias cvslbm '(setenv CVSROOT $MOZ_CVSROOT; cvslb \!*)'
|
||||
alias cvsdlm '(setenv CVSROOT $MOZ_CVSROOT; cvsdl \!*)'
|
||||
|
||||
# find aliases:
|
||||
alias find-files-cmd 'find . -type f'
|
||||
alias findf 'find-files-cmd \!* -print'
|
||||
alias rmfindf 'findf \!* -exec rm {} \;'
|
||||
alias grepf 'find-files-cmd -exec grep -l \!* {} \;'
|
||||
alias findd 'find . -type d \!* -print'
|
||||
alias rmfindd 'find . -type d \!* -exec rm -rf {} \;'
|
||||
|
||||
# goto URL aliases for mozilla browswers:
|
||||
alias gurl 'mozilla -remote openurl\(\!*\)'
|
||||
alias gbug 'gurl http://scopus.mcom.com/bugsplat/show_bug.cgi\?id=\!*'
|
||||
alias gfile 'gurl file:\!*'
|
||||
alias gfilecwd 'gurl file:`pwd`/\!*'
|
||||
|
||||
# RFC and Internet Draft retrieval aliases:
|
||||
alias ftpgeturl 'ncftpget -F'
|
||||
alias getrfcn 'gurl ftp://ftp.isi.edu/in-notes/rfc\!*.txt'
|
||||
alias getrfc 'ftpgeturl ftp://ftp.isi.edu/in-notes/rfc\!*.txt'
|
||||
alias getidn 'gurl http://www.ietf.org/internet-drafts/\!*'
|
||||
alias getid 'ftpgeturl ftp://www.ietf.org/internet-drafts/\!*'
|
|
@ -0,0 +1,61 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mark Smith <MarkCSmithWork@aol.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
setenv PURIFYOPTIONS '-thread-stack-change=32768 -in-use-at-exit=no \
|
||||
-chain-length=100 -thread-report-at-exit=no \
|
||||
-leaks-at-exit=yes -free-queue-length=100 \
|
||||
-in-use-at-exit=YES \
|
||||
-free-queue-threshold=8192 \
|
||||
-thread-report-at-exit=yes -max_threads=200 \
|
||||
-cache-dir=/export3/purify-cache-dir \
|
||||
-always-use-cache-dir \
|
||||
-check-debug-timestamps=no'
|
||||
|
||||
setenv CVSLBOPTIONS '-l 7'
|
||||
setenv CVSDLOPTIONS '-U8'
|
||||
|
||||
setenv EXINIT_BASE "set sm sw=4 nows ic report=1 terse"
|
||||
setenv EXINIT4 "$EXINIT_BASE ts=4"
|
||||
setenv EXINIT8 "$EXINIT_BASE ts=8"
|
||||
setenv EXINIT "$EXINIT4"
|
||||
setenv VIMINIT_BASE "$EXINIT_BASE syntax=enable"
|
||||
setenv VIMINIT4 "$VIMINIT_BASE ts=4"
|
||||
setenv VIMINIT8 "$VIMINIT_BASE ts=8"
|
||||
setenv VIMINIT "$VIMINIT4"
|
||||
|
||||
setenv DATEMSK "$HOME/.datemsk"
|
|
@ -0,0 +1,10 @@
|
|||
%I%p
|
||||
%I:%M%p
|
||||
%m
|
||||
%A %B %d %Y, %H:%M:%S
|
||||
%A
|
||||
%B
|
||||
%m/%d/%y %I %p
|
||||
%d,%m,%Y %H:%M
|
||||
at %A the %dst of %B in %Y
|
||||
%a %b %e %T %Z %Y
|
|
@ -0,0 +1,80 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mark Smith <MarkCSmithWork@aol.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* getdate.c - convert a string to the local time in seconds.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
static int convert_and_output_date( const char *datestr );
|
||||
|
||||
int
|
||||
main( int argc, char *argv[] )
|
||||
{
|
||||
int i, rc;
|
||||
|
||||
rc = 0;
|
||||
for ( i = 1; 0 == rc && argv[i] != NULL; ++i ) {
|
||||
rc = convert_and_output_date( argv[i] );
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int
|
||||
convert_and_output_date( const char *datestr )
|
||||
{
|
||||
struct tm *tmp;
|
||||
time_t secs;
|
||||
|
||||
tmp = getdate( datestr );
|
||||
if ( NULL == tmp ) {
|
||||
return getdate_err;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
secs = mktime( tmp );
|
||||
if ( -1 == secs && errno != 0 ) {
|
||||
return 99; /* not a valid getdate() error code */
|
||||
}
|
||||
printf( "%d\n", secs );
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mark Smith <MarkCSmithWork@aol.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* Read a file on stdin and write to stdout including line numbers at the
|
||||
* start of each line. Optimized for files with 999 lines or less.
|
||||
*
|
||||
* Written 6-October-1998 by Mark Smith <MarkCSmithWork@aol.com>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
const char *usage = "%s: [-s keystring] < file\n";
|
||||
|
||||
int
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
int c;
|
||||
char *keystring = NULL; /* only number lines containing string */
|
||||
char line[ 8192 ];
|
||||
int linenum = 0;
|
||||
int errflg = 0;
|
||||
|
||||
while (( c = getopt( argc, argv, "s:" )) != EOF ) {
|
||||
switch ( c ) {
|
||||
case 's':
|
||||
keystring = optarg;
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
++errflg;
|
||||
}
|
||||
}
|
||||
|
||||
if (errflg || argc > optind ) {
|
||||
fprintf( stderr, usage, argv[0] );
|
||||
exit (2);
|
||||
}
|
||||
|
||||
while ( fgets( line, sizeof( line ) - 1, stdin ) != NULL ) {
|
||||
if ( NULL != keystring && NULL == strstr( line, keystring )) {
|
||||
fputs( line, stdout );
|
||||
} else {
|
||||
++linenum;
|
||||
fprintf( stdout, "%3d. %s", linenum, line );
|
||||
}
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mark Smith <MarkCSmithWork@aol.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
long pagesize, phys_pages;
|
||||
|
||||
if (( pagesize = sysconf( _SC_PAGESIZE )) == -1 ) {
|
||||
perror( "sysconf( _SC_PAGESIZE )" );
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
if (( phys_pages = sysconf( _SC_PHYS_PAGES )) == -1 ) {
|
||||
perror( "sysconf( _SC_PHYS_PAGES )" );
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
/* XXX pagesize * phys_pages may not fit in a long! */
|
||||
printf( "pagesize: %ld, pages: %ld, memory: %ldK\n",
|
||||
pagesize, phys_pages, pagesize * phys_pages / 1024L );
|
||||
|
||||
return( 0 );
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1996-2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mark Smith <MarkCSmithWork@aol.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
main( argc, argv )
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
struct stat stbuf;
|
||||
char at[ 255 ];
|
||||
char mt[ 255 ];
|
||||
char ct[ 255 ];
|
||||
int printed = 0, numeric_flg = 0, errflg = 0, c;
|
||||
extern char *optarg;
|
||||
extern int optind, opterr, optopt;
|
||||
|
||||
while ((c = getopt( argc, argv, "n" )) != EOF ) {
|
||||
switch( c ) {
|
||||
case 'n':
|
||||
numeric_flg = 1;
|
||||
break;
|
||||
default:
|
||||
++errflg;
|
||||
}
|
||||
}
|
||||
|
||||
if ( errflg || optind >= argc ) {
|
||||
(void) fprintf( stderr, "usage: %s [-n] files...\n", argv[ 0 ] );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
for ( ; optind < argc; ++optind ) {
|
||||
if ( stat( argv[optind], &stbuf ) != 0 ) {
|
||||
(void) perror( argv[optind] );
|
||||
} else {
|
||||
if ( !printed ) {
|
||||
(void) printf( "%20s %20s %20s %s\n",
|
||||
"access", "modify", "change", "name" );
|
||||
++printed;
|
||||
}
|
||||
if ( numeric_flg ) {
|
||||
(void) printf( "%20d %20d %20d %s\n",
|
||||
stbuf.st_atim.tv_sec, stbuf.st_mtim.tv_sec,
|
||||
stbuf.st_ctim.tv_sec, argv[optind] );
|
||||
} else {
|
||||
strcpy( at, ctime( &stbuf.st_atim.tv_sec ) + 4 );
|
||||
strcpy( mt, ctime( &stbuf.st_mtim.tv_sec ) + 4 );
|
||||
strcpy( ct, ctime( &stbuf.st_ctim.tv_sec ) + 4 );
|
||||
(void) printf( "%.20s %.20s %.20s %s\n", at, mt, ct,
|
||||
argv[optind]);
|
||||
}
|
||||
}
|
||||
}
|
||||
exit( 0 );
|
||||
}
|
Загрузка…
Ссылка в новой задаче