From owner-taylor-uucp@gnu.ai.mit.edu Tue Apr 14 21:31:01 1992
Status: RO
X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil]
	[nil nil nil nil nil nil nil nil nil nil nil nil "^From:" nil nil nil])
Received: from fuug.fi by dolphin.funet.fi with SMTP id AA06531
  (5.65c/IDA-1.4.3 for ojala); Tue, 14 Apr 1992 21:30:37 +0300
Received: from churchy.gnu.ai.mit.edu by fuug.fi with SMTP id AA10038
  (5.65c/IDA-1.4.4 for <taylor-uucp-list@fuug.fi>); Tue, 14 Apr 1992 21:27:57 +0300
Received: by churchy.gnu.ai.mit.edu (5.65/4.0)
	id <AA06108@churchy.gnu.ai.mit.edu>; Tue, 14 Apr 92 13:50:25 -0400
Received: from relay2.UU.NET by churchy.gnu.ai.mit.edu (5.65/4.0) with SMTP
	id <AA06102@churchy.gnu.ai.mit.edu>; Tue, 14 Apr 92 13:50:21 -0400
Received: from uunet.uu.net (via LOCALHOST.UU.NET) by relay2.UU.NET with SMTP 
	(5.61/UUNET-internet-primary) id AA17368; Tue, 14 Apr 92 13:50:24 -0400
Received: from airs.UUCP by uunet.uu.net with UUCP/RMAIL
	(queueing-rmail) id 134932.27613; Tue, 14 Apr 1992 13:49:32 EDT
Received: by comton.airs.com (5.57/AIRS1.0)
	id AA10993; Tue, 14 Apr 92 12:45:13 -0400
Message-Id: <9204141645.AA10993@comton.airs.com>
X-Mailer: ELM [version 2.3 PL11]
From: ian@airs.com (Ian Lance Taylor)
To: taylor-uucp@gnu.ai.mit.edu
Subject: Contributed simple uusched script
Date: Tue, 14 Apr 92 12:45:11 -0400

Here is a simple uusched shell script, which some people may find
useful.  It was written by Robert Kroes and sent to me by Paul Colley.

It occurs to me that it would be simple enough to have uucico simply
randomize the order in which it handled systems.  If this were
combined with some mechanism to control the number of uucico processes
(to duplicte the BNU Maxuuscheds) and some way to exclude particular
systems, would there be any advantage to a separate uusched program?

#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 04/14/1992 16:40 UTC by ian@comton.airs.com
# Source directory /disk4/ian/code/uucp/contrib
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   1070 -rw------- uusched
#    939 -rw-rw-r-- rndarg.c
#
# ============= uusched ==============
if test -f 'uusched' -a X"$1" != X"-c"; then
	echo 'x - skipping uusched (File already exists)'
else
echo 'x - extracting uusched (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'uusched' &&
:
#---------------------------------------------------------------------
# Replacement 'uusched' script.
#
# Copied from usenet Mon Apr  6 21:14:19 EDT 1992.
# .signature of poster/author:
#+-------------------------------------------------------------------------+
#| << Nexus Private System >>     Inet: robert@nexus.pub.uu.oz.au          |
#| A Founding Member of APANA     Uucp: ...!uunet!yarra!eyrie!nexus!robert |
#+-------------------------------------------------------------------------+
X
RNDARG=/usr/bin/rndarg
UUNAME=/usr/bin/uuname
UUSTAT=/usr/bin/uustat
UUCICO=/usr/lib/uucp/uucico
X
# Paul Colley Mon Apr  6 21:18:47 EDT 1992
# - My uuname output contains duplicates, so remove them.
LIST=`$UUNAME | sort | uniq`
X
# If you prefer to prioritise the polling order of sites with work queued,
# just use the following line instead, and order the machine names in the
# "Systems" file.
# ----------------
# for SYS in $LIST
# ----------------
X
for SYS in `$RNDARG $LIST`
do
X	if [ `$UUSTAT -s$SYS | wc -l` -gt 0 ]
X	then
X		$UUCICO -s$SYS > /dev/null 2>&1
X	fi
done
SHAR_EOF
chmod 0600 uusched ||
echo 'restore of uusched failed'
Wc_c="`wc -c < 'uusched'`"
test 1070 -eq "$Wc_c" ||
	echo 'uusched: original size 1070, current size' "$Wc_c"
fi
# ============= rndarg.c ==============
if test -f 'rndarg.c' -a X"$1" != X"-c"; then
	echo 'x - skipping rndarg.c (File already exists)'
else
echo 'x - extracting rndarg.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'rndarg.c' &&
/*
X * Randomize the arguments on the command line.
X *
X * To compile use: "cc -O -o rndarg rndarg.c"
X *
X * Copied from Usenet Mon Apr  6 21:13:29 EDT 1992.
X * .signature file of poster/author:
+-------------------------------------------------------------------------+
| << Nexus Private System >>     Inet: robert@nexus.pub.uu.oz.au          |
| A Founding Member of APANA     Uucp: ...!uunet!yarra!eyrie!nexus!robert |
+-------------------------------------------------------------------------+
X *
X */
X
#include <stdio.h>
X
int main (int argc, char **argv)
{
X	int rnd, i;
X
X	/* Seed the generator */
X	srand (time (0) % 32768);
X
X	/* Randomize the arguments */
X	for (i = argc - 1; i; i--)
X	{
X		/* Pick one of the un-picked arguments */
X		rnd = rand () % i + 1;
X
X		/* Display the new argument */
X		printf ("%s ", argv [rnd]);
X
X		/* Move the one at the end in to the vacant slot */
X		argv [rnd] = argv [i];
X	}
X	printf ("\n");
X
X	return (0);
}
X
X
SHAR_EOF
chmod 0664 rndarg.c ||
echo 'restore of rndarg.c failed'
Wc_c="`wc -c < 'rndarg.c'`"
test 939 -eq "$Wc_c" ||
	echo 'rndarg.c: original size 939, current size' "$Wc_c"
fi
exit 0
-- 
Ian Taylor                     ian@airs.com                    uunet!airs!ian
First person to identify this quote wins a free e-mail message:
``Do you make a grievance of weighing so many pounds only, instead of three
  hundred?  Then why fret about living so many years only, instead of more?''

