[net.sources] UNaXcess 0.4.4 - Part 3 of 4

allbery@ncoast.UUCP (Brandon S. Allbery) (07/29/86)

# This is a shell archive.  Save this into a file, edit it
# and delete all lines above this comment.  Then give this
# file to sh by executing the command "sh file".  The files
# will be extracted into the current directory owned by
# you with default permissions.
#
# The files contained herein are:
#           udl.c       Makefile
#
echo 'x - udl.c'
sed 's/^X//' <<'________This_Is_The_END________' >>udl.c
X/*
X * @(#)udl.c	1.1 86/05/05 01:44:00 tdi2!brandon @(#)
X * @(#) Copyright (C) 1986 by Brandon S. Allbery, All Rights Reserved @(#)
X *
X * Permission is hereby granted to copy and freely distribute this code,
X * UNaXcess Version 0.04.04 and derivatives ONLY.  Version 1.00.00 and later
X * may NOT be copied or distributed without the author's written permission.
X * You may charge only a reasonable handling/copying fee for distribution of
X * this code; you may not sell it or include it in a commercial package for
X * resale.
X */
X
X#ifndef lint
Xstatic char _SccsId[] = "@(#)udl.c	1.1 86/05/05 01:44:00 tdi2!brandon @(#)";
Xstatic char _CopyRt[] = "@(#) Copyright (C) 1985 by Brandon S. Allbery @(#)";
X#endif  lint
X
X#include "ua.h"
X#ifdef BSD
X#include <sys/time.h>
X#else  SYS3
X#include <time.h>
X#endif BSD
X#include <varargs.h>
X
X#define A_UPLOAD	parms.ua_auc
X#define A_DOWNLOAD	parms.ua_adc
X
X#define X_UPLOAD	parms.ua_xuc
X#define X_DOWNLOAD	parms.ua_xdc
X
X#define K_UPLOAD	parms.ua_kuc
X#define K_DOWNLOAD	parms.ua_kdc
X
X#define LIBRARY		"library"
X#define DIRECTORY	"directory"
X#define STORAGE		"uploads"
X#define UPLOG		"upload-log"
X
X#define off		0
X#define on		1
X
X#define pager		__col = 0, __line = 0, __Page =
X
X#define DIRFORMAT	"%[^ ] %*1[Ff]%*1[Ii]%*1[Ll]%*1[Ee] %[^;]; %[^ ] %*1[Bb]%*1[Yy] %[^:]: %[^\n]"
X
Xjmp_buf brchloop, fileloop;
Xstatic char thisbrch[80] = "";
X
Xint __Page = on;
Xint __line = 0;
Xint __col = 0;
Xint __paws = off;
X
Xchar *whatis(), *pgetin(), *cpmform(), *upstr(), *today();
X
Xextern struct tm *localtime();
X
Xudl(branch)
Xchar *branch; {
X	int again();
X	int (*oldint)();
X	char *cp;
X
X	if (user.u_access < A_FILES) {
X		puts("\nYou will not be able to upload or download files.\nYou may, however, download File Lists.");
X		log("File Section entered; access restricted");
X	}
X	thisbrch[0] == '\0';
X	for (cp = branch; *cp != '\0'; cp++)
X		if (*cp == ' ') {
X			strcpy(thisbrch, ++cp);
X			break;
X		}
X	oldint = signal(SIGINT, again);
X	setjmp(brchloop);
X	while (libmenu())
X		;
X	msg("\n");
X	signal(SIGINT, oldint);
X}
X
Xagain() {
X	signal(SIGINT, again);
X	pager on;
X	msg("\nInterrupt\n");
X	fflush(stdout);
X	log("Interrupt");
X	if (__paws == on) {
X		talk();
X		__paws = off;
X	}
X	longjmp(brchloop, 1);
X}
X
Xlibmenu() {
X	struct direct *branch;
X	DIR *library;
X	char cmd[512], bname[512];
X	int (*oldsig)();
X	int brch_cmd();
X	char *desc;
X	
X	if ((library = opendir(LIBRARY)) == NULL) {
X		msg("The Library is closed\n");
X		return 0;
X	}
X	if (thisbrch[0] != '\0') {
X		strcpy(cmd, thisbrch);
X		thisbrch[0] == '\0';
X		goto gotbrch;
X	}
X	msg("\nThe UNaXcess File Section.  Please select one of the following\nbranches, or EXIT to leave the Library.\n\n");
X	while ((branch = readdir(library)) != NULL) {
X		if ((desc = whatis(branch->d_name, NULL)) == NULL)
X			continue;
X		msg("    %-8.8s   %s\n", upstr(branch->d_name), desc);
X	}
X	closedir(library);
X	msg("\nBranch: ");
X	if (pgetin(cmd, NULL) == NULL)
X		return 0;
X	log("Branch: %s", cmd);
X	if (s_cmp(cmd, "EXIT") == 0)
X		return 0;
X
Xgotbrch:
X	if (whatis(cmd, NULL) != NULL) {
X		library = opendir(LIBRARY);
X		while ((branch = readdir(library)) != NULL)
X			if (s_cmp(branch->d_name, cmd) == 0) {
X				closedir(library);
X				strcpy(bname, branch->d_name);
X				oldsig = signal(SIGINT, brch_cmd);
X				setjmp(fileloop);
X				while (visit(bname))
X					;
X				signal(SIGINT, oldsig);
X				return 1;
X			}
X	}
X	closedir(library);
X	msg("There is no such branch.  If you wish to open a new branch,\nleave a message to %s.\n", parms.ua_sysop);
X	return 1;
X}
X
Xvisit(branch)
Xchar *branch; {
X	char cmd[512];
X	DIR *directory;
X	
X	sprintf(cmd, "%s/%s", LIBRARY, branch);
X	if ((directory = opendir(cmd)) == NULL) {
X		msg("The %s branch is closed.\n", upstr(branch));
X		return 0;
X	}
X	closedir(directory);
X	msg("\n%s Branch\nUpload, Download, List of Files, Get File List, Exit: ", upstr(branch));
X	if (pgetin(cmd, NULL) == NULL)
X		return 0;
X	log("Branch cmd: %s", cmd);
X	switch (cmd[0]) {
X		case 'e':
X		case 'E':
X			return 0;
X		case 'U':
X		case 'u':
X			upload(branch);
X			break;
X		case 'D':
X		case 'd':
X			download(branch);
X			break;
X		case 'L':
X		case 'l':
X			filelist(branch);
X			break;
X		case 'G':
X		case 'g':
X			getlist(branch);
X			break;
X		default:
X			msg("Unrecognized command.\n");
X	}
X	return 1;
X}
X
Xbrch_cmd() {
X	pager on;
X	msg("\nInterrupt\n");
X	log("Interrupt");
X	fflush(stdout);
X	if (__paws == on) {
X		talk();
X		__paws = off;
X	}
X	signal(SIGINT, brch_cmd);
X	longjmp(fileloop, 1);
X}
X
Xfilelist(branch)
Xchar *branch; {
X	char path[512];
X	DIR *directory;
X	struct direct *file;
X	char *desc;
X
X	sprintf(path, "%s/%s", LIBRARY, branch);
X	directory = opendir(path);
X	msg("\nFile Directory for the %s Branch:\n\n", upstr(branch));
X	while ((file = readdir(directory)) != NULL) {
X		if ((desc = whatis(branch, file->d_name)) == NULL)
X			continue;
X		msg("    %-12.12s   %s\n", cpmform(file->d_name), desc);
X	}
X	msg("\n");
X	closedir(directory);
X}
X
Xgetlist(branch)
Xchar *branch; {
X	char path[512], listfile[30], cmd[512];
X	DIR *directory;
X	struct direct *file;
X	int (*oldsig)();
X	char *desc;
X	FILE *list;
X
X	sprintf(listfile, "/tmp/cli%05d", getpid());
X	if ((list = fopen(listfile, "w")) == NULL) {
X		msg("Can't open temporary list file???\n");
X		exit(5);
X	}
X	msg("\nDownload file listing from the %s branch\n\nSupported transfer protocols are: Ascii, Xmodem, and Kermit.\n\nEnter File Transfer Protocol (XMODEM default): ", upstr(branch));
X	if (pgetin(cmd, NULL) == NULL)
X		return;
X	log("List dnld mode: %s", cmd);
X	switch (cmd[0]) {
X		case 'A':
X		case 'a':
X			if (!validudl(A_DOWNLOAD)) {
X				msg("\nAscii Download is not supported.\n");
X				log("No Ascii");
X				return;
X			}
X			sprintf(cmd, A_DOWNLOAD, listfile);
X			break;
X		case 'K':
X		case 'k':
X			if (!validudl(K_DOWNLOAD)) {
X				msg("\nKermit Download is not supported.\n");
X				log("No Kermit");
X				return;
X			}
X			sprintf(cmd, K_DOWNLOAD, listfile);
X			break;
X		case 'X':
X		case 'x':
X			if (!validudl(X_DOWNLOAD)) {
X				msg("\nXModem Download is not supported.\n");
X				log("No Xmodem");
X				return;
X			}
X			sprintf(cmd, X_DOWNLOAD, listfile);
X			break;
X		case '\0':
X			cmd[0] = 'X';
X			if (!validudl(X_DOWNLOAD)) {
X				msg("\nXModem Download is not supported.\n");
X				log("No Xmodem");
X				return;
X			}
X			sprintf(cmd, X_DOWNLOAD, listfile);
X			break;
X		default:
X			msg("Invalid protocol designation.\n");
X			return;
X	}
X	sprintf(path, "%s/%s", LIBRARY, branch);
X	directory = opendir(path);
X	fprintf(list, "File Directory for the %s Branch:\r\n\r\n", upstr(branch));
X	while ((file = readdir(directory)) != NULL) {
X		if ((desc = whatis(branch, file->d_name)) == NULL)
X			continue;
X		fprintf(list, "    %-12.12s   %s\r\n", cpmform(file->d_name), desc);
X	}
X	fclose(list);
X	closedir(directory);
X	msg("You have 30 seconds to prepare for file transmission.\nPress BREAK to abort transmission.\n\n");
X	fflush(stdout);
X	sleep(30);
X	oldsig = signal(SIGINT, SIG_IGN);
X	system(cmd);
X#ifdef SYS3
X	system("stty echoe");
X#endif SYS3
X	signal(SIGINT, oldsig);
X	unlink(listfile);
X}
X
Xdownload(branch)
Xchar *branch; {
X	char path[512], filename[512], cmd[512];
X	DIR *directory;
X	struct direct *file;
X	int (*oldsig)();
X	
X	if (user.u_access < A_FILES) {
X		log("Attempted download, access denied.");
X		puts("You may not download files.");
X		return;
X	}
X	msg("\nDownload from the %s branch\n\nEnter file to download: ");
X	if (pgetin(filename, NULL) == NULL)
X		return;
X	log("Dnld file: %s", filename);
X	if (filename[0] == '.' || Index(filename, '/') != NULL) {
X		msg("No such file: \"%s\"\n", upstr(filename));
X		return;
X	}
X	if (whatis(branch, filename) != NULL) {
X		sprintf(path, "%s/%s", LIBRARY, branch);
X		directory = opendir(path);
X		while ((file = readdir(directory)) != NULL) {
X			if (s_cmp(file->d_name, filename) == 0) {
X				closedir(directory);
X				sprintf(path, "%s/%s/%s", LIBRARY, branch, file->d_name);
X				msg("Supported transfer protocols are: Ascii, Xmodem, and Kermit.\n\nEnter File Transfer Protocol (XMODEM default): ", upstr(branch));
X				if (pgetin(cmd, NULL) == NULL)
X					return;
X				switch (cmd[0]) {
X					case 'A':
X					case 'a':
X						if (!validudl(A_DOWNLOAD)) {
X							msg("\nAscii Download is not supported.\n");
X							log("No Ascii");
X							return;
X						}
X						sprintf(cmd, A_DOWNLOAD, path);
X						break;
X					case 'K':
X					case 'k':
X						if (!validudl(K_DOWNLOAD)) {
X							msg("\nKermit Download is not supported.\n");
X							log("No Kermit");
X							return;
X						}
X						sprintf(cmd, K_DOWNLOAD, path);
X						break;
X					case 'X':
X					case 'x':
X						if (!validudl(X_DOWNLOAD)) {
X							msg("\nXModem Download is not supported.\n");
X							log("No Xmodem");
X							return;
X						}
X						sprintf(cmd, X_DOWNLOAD, path);
X						break;
X					case '\0':
X						cmd[0] = 'X';
X						if (!validudl(X_DOWNLOAD)) {
X							msg("\nXModem Download is not supported.\n");
X							log("No Xmodem");
X							return;
X						}
X						sprintf(cmd, X_DOWNLOAD, path);
X						break;
X					default:
X						msg("Invalid protocol designation.\n");
X						return;
X				}
X				msg("You have 30 seconds to prepare for file transmission.\nPress BREAK to abort transmission.\n\n");
X				fflush(stdout);
X				sleep(30);
X				oldsig = signal(SIGINT, SIG_IGN);
X				system(cmd);
X#ifdef SYS3
X				system("stty echoe");
X#endif SYS3
X				signal(SIGINT, oldsig);
X				return;
X			}
X		}
X		closedir(directory);
X	}
X	msg("No such file: \"%s\"\n", upstr(filename));
X	log("No such file");
X}
X
Xupload(branch)
Xchar *branch; {
X	char path[512], filename[512], cmd[512], desc[512];
X	DIR *directory;
X	struct direct *file;
X	int (*oldsig)();
X	FILE *logf;
X	
X	if (user.u_access < A_FILES) {
X		log("Attempted upload, access denied.");
X		puts("You may not upload files.");
X		return;
X	}
X	msg("\nUpload to the %s branch\n\nEnter the name to give the new file: ");
X	if (pgetin(filename, NULL) == NULL)
X		return;
X	log("Upld file: %s", filename);
X	if (filename[0] == '.' || Index(filename, '/') != NULL || Index(filename, ';') != NULL) {
X		msg("Invalid filename: \"%s\"\n", upstr(filename));
X		log("Invalid filename");
X		return;
X	}
X	sprintf(path, "%s/%s", STORAGE, branch);
X	if ((directory = opendir(path)) == NULL) {
X		msg("The %s has denied upload ability for this branch.\n", parms.ua_sysop);
X		return;
X	}
X	while ((file = readdir(directory)) != NULL) {
X		if (s_cmp(file->d_name, filename) == 0) {
X			closedir(directory);
X			msg("That file name is used.  Please try again with a different filename.\n");
X			log("File exists");
X			return;
X		}
X	}
X	closedir(directory);
X	msg("Enter a description for the file: ");
X	if (pgetin(desc, NULL) == NULL)
X		return;
X	log("Description: %s", desc);
X	if ((logf = fopen(UPLOG, "a")) == NULL) {
X		log("Error %d opening %s", errno, UPLOG);
X		msg("Can't log the new file.\n");
X		return;
X	}
X	fprintf(logf, "%s file %s; %s by %s: %s\n", branch, filename, today(), upstr(user.u_name), desc);
X	fclose(logf);
X	sprintf(path, "%s/%s/%s", STORAGE, branch, filename);
X	msg("Supported transfer protocols are: Ascii, Xmodem, and Kermit.\nXmodem protocol uses checksums; CCITT CRC is not supported.\n\nEnter File Transfer Protocol (XMODEM default): ", upstr(branch));
X	if (pgetin(cmd, NULL) == NULL)
X		return;
X	log("Upld protocol: %s", cmd);
X	switch (cmd[0]) {
X		case 'A':
X		case 'a':
X			if (!validudl(A_UPLOAD)) {
X				msg("\nAscii Upload is not supported.\n");
X				log("No Ascii");
X				return;
X			}
X			sprintf(cmd, A_UPLOAD, path);
X			break;
X		case 'K':
X		case 'k':
X			if (!validudl(K_UPLOAD)) {
X				msg("\nKermit Upload is not supported.\n");
X				log("No Kermit");
X				return;
X			}
X			sprintf(cmd, K_UPLOAD, path);
X			break;
X		case 'X':
X		case 'x':
X			if (!validudl(X_UPLOAD)) {
X				msg("\nXModem Upload is not supported.\n");
X				log("No Xmodem");
X				return;
X			}
X			sprintf(cmd, X_UPLOAD, path);
X			break;
X		case '\0':
X			cmd[0] = 'X';
X			if (!validudl(X_UPLOAD)) {
X				msg("\nXModem Upload is not supported.\n");
X				log("No Xmodem");
X				return;
X			}
X			sprintf(cmd, X_UPLOAD, path);
X			break;
X		default:
X			msg("Invalid protocol designation.\n");
X			return;
X	}
X	msg("You have 30 seconds to prepare for file transmission.\nPress BREAK to abort transmission.\n\n");
X	fflush(stdout);
X	sleep(30);
X	oldsig = signal(SIGINT, SIG_IGN);
X	system(cmd);
X#ifdef SYS3
X	system("stty echoe");
X#endif SYS3
X	signal(SIGINT, oldsig);
X}
X
X/*VARARGS2*/
Xmsg(fmt, va_alist)
Xchar *fmt;
Xva_dcl {
X	va_list va_ptr;
X	register char *cp;
X	int lzflag, width, ext, longflag, ljflag;
X	
X	va_start(va_ptr);
X	for (cp = fmt; *cp != '\0'; cp++)
X		if (*cp != '%')
X			say(*cp);
X		else {
X			width = 0;
X			ext = 0;
X			lzflag = 0;
X			longflag = 0;
X			ljflag = 0;
X			if (*++cp == '-')
X				ljflag = 1;
X			else
X				cp--;
X			if (isdigit(*++cp)) {
X				if (*cp == '0') {
X					lzflag = 1;
X					cp++;
X				}
X				while (isdigit(*cp))
X					width *= 10 + (*cp++ - '0');
X			}
X			if (*cp == '.') {
X				while (isdigit(*++cp))
X					ext *= 10 + (*cp - '0');
X			}
X_longagain:
X			switch (*cp) {
X				case 's':
X					_fmtstr(va_arg(va_ptr, char *), width, ext, ljflag);
X					break;
X				case 'D':
X					_fmtint(va_arg(va_ptr, long), width, lzflag, 1, ljflag);
X					break;
X				case 'd':
X					_fmtint((long) va_arg(va_ptr, int), width, lzflag, longflag, ljflag);
X					break;
X				case 'c':
X					_fmtchr(va_arg(va_ptr, char), width, lzflag);
X					break;
X				case 'l':
X					longflag = 1;
X					goto _longagain;
X				default:
X					say(*cp);
X			}
X		}
X}
X
X_fmtchr(c, width, ljflag)
Xchar c; {
X	register int w;
X	
X	if (!ljflag)
X		for (w = 0; w < width - 1; w++)
X			say(' ');
X	say(c);
X	if (ljflag)
X		for (w = 0; w < width - 1; w++)
X			say(' ');
X}
X
X_fmtstr(sp, width, ext, ljflag)
Xchar *sp; {
X	register char *cp;
X	register int w;
X	
X	cp = sp;
X	if (ext == 0)
X		ext = strlen(cp);
X	if (!ljflag)
X		for (w = 0; w < width - ext; w++)
X			say(' ');
X	for (w = 0; w < ext; w++)
X		say(*cp++);
X	if (ljflag)
X		for (w = 0; w < width - ext; w++)
X			say(' ');
X}
X
X_fmtint(i, width, lzflag, longflag, ljflag)
Xlong i; {
X	long lnum;
X	register int w;
X	char *cp;
X	char ibuf[20];
X	int nospflag, nwidth;
X	
X	lnum = i;
X	nospflag = (width == 0);
X	if (width > sizeof ibuf - 2)
X		width = sizeof ibuf - 2;
X	cp = ibuf + sizeof ibuf - 1;
X	*cp-- = '\0';
X	if (lnum == 0)
X		*cp-- = '0';
X	else
X		while (lnum != 0) {
X			*cp-- = (lnum % 10) + '0';
X			lnum /= 10;
X		}
X	if (!nospflag || (!lzflag && ljflag))
X		while (cp >= ibuf + (sizeof ibuf - width - 1))
X			*cp-- = (lzflag? '0': ' ');
X	nwidth = ((long) cp) - ((long) ibuf);
X	while (*++cp != '\0')
X		say(*cp);
X	if (ljflag)
X		for (w = 0; w < width - nwidth; w++)
X			say(' ');
X}
X
Xsay(ch)
Xchar ch; {
X	ch &= 0x7f;
X	switch (ch) {
X		case '\t':
X			do {
X				say(' ');
X			} while (__col % 8);
X			break;
X		case '\n':
X			putchar('\n');
X			__col = 0;
X			if (__Page == on && ++__line == 23) {
X				paws();
X				__line = 0;
X			}
X			break;
X		case '\177':
X			msg("^?");
X			break;
X		default:
X			if (ch < ' ') {
X				say('^');
X				say(ch + '@');
X				return;
X			}
X			if (__col == user.u_llen - 1)
X				say('\n');
X			putchar(ch);
X			__col++;
X	}
X}
X
Xpaws() {
X	fputs("Type any key to continue. . .", stdout);
X	__paws = on;
X	silent();
X	getchar();
X	talk();
X	__paws = off;
X	fputs("\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b", stdout);
X}
X
Xs_cmp(s1, s2)
Xchar *s1, *s2; {
X	for (; *s1 != '\0' && ToLower(*s1) == ToLower(*s2); s1++, s2++)
X		;
X	return (!(*s1 == '\0' && *s2 == '\0'));
X}
X
Xchar *whatis(branch, file)
Xchar *branch, *file; {
X	static FILE *directory = NULL;
X	static char dent[512];
X	char tbr[512], tfi[512], date[512], who[512], desc[512];
X	
X	if (directory != NULL || (directory = fopen(DIRECTORY, "r")) != NULL) {
X		fseek(directory, 0L, 0);
X		while (fgets(dent, sizeof dent, directory) != NULL) {
X			if (dent[0] == '%' || dent[0] == '\n')
X				continue;
X			tbr[0] = '\0';
X			tfi[0] = '\0';
X			date[0] = '\0';
X			who[0] = '\0';
X			desc[0] = '\0';
X			if (sscanf(dent, DIRFORMAT, tbr, tfi, date, who, desc) != 5)
X				continue;
X			if (s_cmp(tbr, branch) == 0) {
X				if (s_cmp(tfi, (file == NULL? "branch": file)) != 0)
X					continue;
X				sprintf(dent, "%s [Created %s by %s]", desc, date, who);
X				return dent;
X			}
X		}
X	}
X	if (directory == NULL)
X		log("No download directory");
X	return NULL;
X}
X
X/* this is a stub-ified version of v1.0 COMND input module */
X
Xchar *pgetin(str, tab)
Xchar *str;
Xchar tab[]; {
X	char *ch;
X
X	fflush(stdout);
X	pager off;
X	ch = gets(str);
X	pager on;
X	if (ch == NULL) {
X		msg("^D\n");
X		log("EOF");
X		fflush(stdout);
X	}
X	return ch;
X}
X
Xchar *cpmform(fn)
Xchar *fn; {
X	static char buf[13];
X	register int cnt, scnt;
X	
X	for (scnt = 0, cnt = 0; cnt < 8 && fn[cnt] != '.' && fn[cnt] != '\0'; cnt++, scnt++)
X		buf[scnt] = ToUpper(fn[cnt]);
X	while (scnt < 8)
X		buf[scnt++] = ' ';
X	buf[scnt++] = '.';
X	while (fn[cnt] != '.' && fn[cnt] != '\0')
X		cnt++;
X	if (fn[cnt] == '.')
X		cnt++;
X	while (scnt < 12 && fn[cnt] != '\0') {
X		buf[scnt++] = ToUpper(fn[cnt]);
X		cnt++;
X	}
X	buf[scnt] = '\0';
X	return buf;
X}
X
Xchar *upstr(s)
Xchar *s; {
X	static char sbuf[512];
X	register char *cp, *dp;
X	
X	for (cp = s, dp = sbuf; *cp != '\0'; cp++, dp++)
X		*dp = ToUpper(*cp);
X	*dp = '\0';
X	return sbuf;
X}
X
Xchar *today() {
X	long now;
X	struct tm *date;
X	static char buf[11];
X	
X	time(&now);
X	date = localtime(&now);
X	sprintf(buf, "%d/%d/%d", date->tm_mon + 1, date->tm_mday, date->tm_year);
X	return buf;
X}
X
Xvalidudl(cmd)
Xchar *cmd; {
X	if (cmd[0] == '\0')
X		return 0;
X	if (Index(cmd, '%') != RIndex(cmd, '%'))
X		return 0;
X	if (Index(cmd, '%') == (char *) 0) {
X		strcat(cmd, " %s");
X		return 1;
X	}
X	if (*(Index(cmd, '%') + 1) != 's')
X		return 0;
X	return 1;
X}
________This_Is_The_END________
echo 'x - Makefile'
sed 's/^X//' <<'________This_Is_The_END________' >>Makefile
X#
X# @(#)Makefile	1.1 86/05/05 01:44:38 tdi2!brandon @(#)
X# @(#) Copyright (C) 1986 by Brandon S. Allbery, All Rights Reserved @(#)
X#
X# Permission is hereby granted to copy and freely distribute this code,
X# UNaXcess Version 0.04.04 and derivatives ONLY.  Version 1.00.00 and later
X# may NOT be copied or distributed without the author's written permission.
X# You may charge only a reasonable handling/copying fee for distribution of
X# this code; you may not sell it or include it in a commercial package for
X# resale.
X# 
X
XSHELL = /bin/sh
X# make on sys3 is not very nice when it comes to standard shell interfaces...
X
X# ``make SYSTEM=(SYS3|SYS5|V7|BSD|XENIX|XENIX3|XENIX5) all''
X# Use V7     for V7, XENIX 2.x, and BSD pre-4.2 (+ bastardizations of same)
X#     BSD    for BSD 4.2 and 4.3
X#     SYS3   for real AT&T System III
X#     SYS5   for real AT&T System V revisions 1 and 2
X#     XENIX3 for Xenix v3.x, Unisoft System III, and other bastardized V7's
X#     XENIX5 for Xenix V5.x and other bastardized V7's with System V libraries
X# You're on your own if it's a really odd combo.
X# Pyramid 90x:  use either universe.  SYS5 is best tested; BSD has bigger
X# conference names and many performance pluses (extra-fast conference
X# creation; I don't know if the 4.2 directory stuff is implemented in kernel
X# or not, so I don't know if you gain -- but libndir is SLOW!).
X
XCFLAGS = -D${SYSTEM} -O
X
Xall: ua uwho udate mkconf mvmsg uanews
X
Xuwho: Utilities/uwho
Xudate: Utilities/udate
Xmkconf: Utilities/mkconf
Xmvmsg: Utilities/mvmsg
Xuanews: Utilities/uanews
X
Xua: ua.o msg.o conf.o date.o bull.o sys.o user.o dir.o param.o udl.o
X	${CC} -o ua ua.o msg.o conf.o date.o bull.o sys.o user.o dir.o param.o udl.o
X
Xua.o msg.o conf.o date.o bull.o sys.o user.o dir.o param.o udl.o: ua.h user.h dir.h sys.h
X
XUtilities/mkconf: Utilities/mkconf.o
X	${CC} Utilities/mkconf.o -o Utilities/mkconf
X
XUtilities/mvmsg: Utilities/mvmsg.o
X	${CC} Utilities/mvmsg.o -o Utilities/mvmsg
X
XUtilities/uanews: Utilities/uanews.o
X	${CC} Utilities/uanews.o -o Utilities/uanews
X
XUtilities/udate: Utilities/udate.o date.o
X	${CC} Utilities/udate.o date.o -o Utilities/udate
X
XUtilities/uwho: Utilities/uwho.o
X	${CC} -o Utilities/uwho Utilities/uwho.o
X
XUtilities/mkconf.o: Utilities/mkconf.c
X	${CC} ${CFLAGS} -c Utilities/mkconf.c
X	mv mkconf.o Utilities/mkconf.o
X
XUtilities/udate.o: Utilities/udate.c
X	${CC} ${CFLAGS} -c Utilities/udate.c
X	mv udate.o Utilities/udate.o
X
XUtilities/uwho.o: Utilities/uwho.c
X	${CC} ${CFLAGS} -c Utilities/uwho.c
X	mv uwho.o Utilities/uwho.o
X
XUtilities/mvmsg.o: Utilities/mvmsg.c
X	${CC} ${CFLAGS} -c Utilities/mvmsg.c
X	mv mvmsg.o Utilities/mvmsg.o
X
XUtilities/uanews.o: Utilities/uanews.c
X	${CC} ${CFLAGS} -c Utilities/uanews.c
X	mv uanews.o Utilities/uanews.o
X
Xclean:
X	rm -f ua Utilities/uwho Utilities/udate Utilities/upost \
X		Utilities/mkconf Utilities/umotd *.o Utilities/*.o tags core \
X		shar? Utilities/mvmsg Utilities/uanews
X
Xtags:
X	ctags *.[ch] Utilities/*.c
X
Xshar:
X	shar ua.c date.c bull.c sys.c user.c param.c dir.c; mv shar.out shar1
X	shar msg.c conf.c ua.h user.h dir.h sys.h README; mv shar.out shar2
X	shar udl.c Makefile; mv shar.out shar3
X	shar Utilities/*.c Utilities/*.sh; mv shar.out shar4
X	@echo "Massage shar4 to make and enter the Utilities directory."
X
Xtar:
X	tar cvf unaxcess.tar README *.[ch] Makefile Utilities/*.c \
X		Utilities/*.sh
X
Xedall: %edall
X	for file in *.[ch] Makefile Utilities/*.c Utilities/*.sh; do\
X		sh %edall $$file;\
X	done
X	
________This_Is_The_END________
exit
-- 
  ---------------- /--/	Brandon S. Allbery		UUCP: decvax!cwruecmp!
 /              / /|\/	Tridelta Industries, Inc.        ncoast!tdi2!brandon
----    -------- /-++	7350 Corporate Blvd.		PHONE: +1 216 974 9210
   /   / /---,  ----	Mentor, Ohio 44060		SYSOP: UNaXcess/ncoast
  /   / /    / /  /	     -- HOME --			 (216) 781-6201 24 hrs.
 /   / /    / /  /	6615 Center St. Apt. A1-105	ARPA:  ncoast!allbery%
----  -----~ ----	Mentor, Ohio 44060-4101		 case.CSNET@csnet-relay