3 # MAKESHAR.sh: Make a shar file for the sources
5 # $Id: MAKESHAR,v 3.1 1992/05/09 04:03:53 christos Exp $
7 AWK
=/usr
/bin
/nawk
# Must be nawk or gawk cause of 2D arrays
41 echo "$0: File `$i' not found." 1>&2
47 if [ \
( -z "$files" \
) -a \
( -z "$dirs" \
) ]
49 echo "Usage: $0 [-n name] [-s size] [-vd] <files>." 1>&2
53 $WC $files |
$GREP -v total |
$SORT +2 |
$AWK '
72 for (maxi = i--; i >= 0; i--) {
74 if (a[i, used] == 0) {
75 if (verbose && a[i, size] > maxsize)
76 printf("Warning: File %s is %d > %d\n",
77 a[i, name], a[i, size], maxsize) > tty;
83 # Find the greatest file we can add
85 for (k = 0; k < maxi; k++)
86 if (a[k, used] == 0 && a[k, size] + s < maxsize)
98 for (i = 1; i < seq; i++) {
99 printf("shar -n%d -e%d %s ", i, seq - 1, dirs);
101 printf("%3d of %3d: ", i, seq - 1) > tty;
104 for (j = 0; kit[i, j] != -1; j++) {
105 s = a[kit[i, j], name];
107 clen = length(s) + 1;
113 printf("%s ", s) > tty;
117 printf("> '"$name"'-%d.shar;", i);
119 printf("= %5d\n", sizes[i]) > tty;