[net.sources] Orphaned Response

jack@hp-dcd.UUCP (06/29/83)

#R:bpa:0:hp-dcd:21900001:37777777600:112
hp-dcd!jack    Jun 22 17:03:00 1983

Why the fork and wait at the end?  Why not just execl /bin/ps?

					-Jack Applin IV
					 (hplabs!hp-dcd!jack)

jad@hpfclo.UUCP (07/14/84)

/* ---------- */

>>>		    Si quenuvalye i lamber Eldareva!

		    Now you will speak the tongue of the Elves

	That seems to be a self-fulfilling prophecy.  Nice touch ...

ajs@hpfcla.UUCP (08/14/84)

> This is the line:
> 
> cat >foo.h<<'Funky!Stuff'
> 
> What the heck does this mean ?

UN*X is a usable  system.  Therefore  it is  complicated  (perhaps  more
visibly than need be...).  Therefore there are and always will be things
that seem new and arcane.  If everyone who wondered  about  something of
this  nature  asked  about it in public -- can you imagine the glut that
would ensue?  (Maybe it partly already has, but anyway...)

Moral:  Please  apply a bit of common sense and  research.  In this case
you might say to  yourself,  "Looks like  something  the shell  handles.
Hmmm...  Let's grep /usr/man/cat1/sh.1 for '<<'."  Do that, and you will
find out all about "here" documents.

Please don't take this as a personal insult.  I'm using your question as
an example.  Please, people, read the manuals, when they exist!

Alan Silverstein, hpfcla!ajs

barrett@hpcnoe.UUCP (barrett) (08/18/84)

#
# Well, the ANSI termcap entry originally posted is close to being correct. 
# I think though that some of the lines need to be changed.  Here is a 
# list of the changes that can be made.  
#
# 1) The : before each \ is redundant.  It should be removed.
# 2) ae and as should be specified as ASCII SI and SO since these sequences
#    are independent of the alternate character set selected.
# 3) The cl sequence can be shortened by eliminating the ';'  (?)
# 4) The cs sequence has a typo of \e instead of \E.
# 5) The kh sequence is a weird case. This is because the VT100 has no
#    home key.  My terminal will not transmit this key unless keypad
#    transmit is enabled and then it will send \E[>0s  
# 6) sf and sr are wrong in the given termcap. I have corrected them here.
# 7) Numerous capabilities need to be included for the possibility of
#    the multi-page mode being in effect. These include da, db.
# 8) Other features need to be added as well such as ml and mu, bt, labels.
# 9) I like so to be halfbright inverse video rather then full inverse.
#10) Automatic margins should not be specified because of strange behavior
#    in Column 80 on the VT100.  Try it and see.
#
# the lines which change are included as follows:
# (delete the old lines in the original, cat with this file and sort)
#
# Let me know if I have made any mistakes here.
# I can post an updated version of the ANSI termcap if requested.
#
# Dave Barrett 		    8/06/84 Hewlett-Packard, Ft Collins Co. 
# hplabs!hp-dcd!barrett
#
:ae=^O\
:am@\
:as=^N\
:bt=\E[Z\
:ch=\E[%i%dG\
:cl=\E[H\E[J\
:cs=\E[%i%d;%dr\
:da\
:db\
:kh=\E[>0s\
:l1=PF1\
:l2=PF2\
:l3=PF3\
:l4=PF4\
:ml=\E[>2h\
:mu=\E[>2l\
:sf=\E[S\
:so=\E[1;7m\
:sr=\E[T\

notes@uiucuxc.UUCP (10/16/84)

Btw, the include file mentioned in the hayes driver for tip is found
in the tip source directory on 4.2 (/usr/src/usr.bin/tip/tip.h).

Paul Pomes
University of Illinois, CSO

preece@ccvaxa.UUCP (11/07/84)

the problem with using cbreak mode is that it makes the shell
escape capability go away.  this probably won't bother most users,
but we got a couple of complaints here when we changed write to
put itself into cbreak mode.  it would be neater to allow a command
inside write to turn cbreak on/off, so that shell commands can be
run by just switching mode.

scott preece
ihnp4!uiucdcs!ccvaxa!preece

haddock@waltz.UUCP (01/10/85)

	/**** waltz:net.sources / ucbvax!medin /  6:30 pm  Mar 29, 1984 ****/
	Has anyone written an ouput filter for plot, graph, and/or
	ditroff (troff in disguise)?
	I'd like to use one as a cheap output device for graphics.

					Thanks,
					  Milo

	PS  I know that the resolution is poor for troff, its the
	graphics stuff that I really want to use it for.
/* ---------- */

I finally got around to writing such a plot filter around New Year's.
It was intended for TI's 855 printer attached to our 750 but will
work with the various printers from Epson.   I'm currently polishing
it and plan to distribute it thru net.sources.

One interesting note is that the output from this filter, when saved
to a file, can be downloaded to a micro and sent to an Epson attached
to it.   I've done this and it works just great - no need to have an
Epson attached to your UNIX machine.  It'll take a little work but
it appears that my filter should be runnable on an IBM-PC or similar
machine provided you have sufficient memory for the bitmap.  The only
thing that needs to be done is to have graph(1) or plot(3) implemented
on said type machines.   Any takers???

Has anyone actually USED the -g option on 4.2's LPR ???  All I get
are single blank pages, multiply queued (n = ?).   Oh, we're (ab)using
Ultrix on Waltz.

======================================================================
			   _____
			|\/   o \    o
	-Rusty-		|   (  -<  O o		Where's the fish?
			|/\__V__/

ARPA:	Haddock%Waltz%TI-CSL@CSNet-Relay
	Rusty@Maryland (forwarded to CSNet address)
CSNet:	Haddock@TI-CSL
USENET:	{convex!smu, ut-sally, texsun, rice} ! waltz ! haddock

dat@hpfcla.UUCP (dat) (03/18/85)

	Suprise!  CBREAK is a 'Berkeley-ism' and is NOT available on
either any of the Bell UNIX systems nor any other system that is based
on Bell (like HP-UX).

	Try toggling the 'canonical' input bit of the iotcl structure...


					Dave Taylor
					Colorado Networks


"It doesn't matter: I wrote my own!"

mab@ttidcb.UUCP (Michael A. Bloom) (03/18/85)

In article <43600016@hpfcla.UUCP> dat@hpfcla.UUCP (Dave Taylor) writes:
>
>	Suprise!  CBREAK is a 'Berkeley-ism' and is NOT available on
>either any of the Bell UNIX systems nor any other system that is based
>on Bell (like HP-UX).

Hardly.  CBREAK has been on Bell UNIX systems for many years.  Bell 32V
unix, for example, which Berkeley unix is based upon. It is only the 
bastardized versions of unix (USG x.x, System x.x) that have recently 
come from bell, which were designed to be incompatible with earlier
releases, that lack it.
-- 

--    Michael Bloom 	---  {philabs,trwrb,cadovax,randvax}!ttidca!mab

jim@hpfcla.UUCP (jim) (04/08/85)

I managed to get UNIX to handle end of tape correctly.  See me,

Jim Conrad
ihnp4!hplabs!hpfcla!hpcnoa!j_conrad
(303) 226-3800 x2419

jim@hpfcla.UUCP (jim) (04/08/85)

Don't you guys understand?  He doesn't like the name (Kermit)!
Seriously though, I've transferred millions of bytes with Kermit on
UNIX and was very glad to have it.

Jim Conrad
hplabs!hpfcla!hpcnoa!j_conrad
Don't look in a gift horse's mouth. 

jim@hpfcla.UUCP (jim) (04/08/85)

Yes, but it's only quasi-public domain (was developed on a NASA contract).
Get in contact with me:

Jim Conrad
{ucbvax,ihnp4}!hplabs!hpfcla!hpcnoa!j_conrad
(303) 226-3800 x2419

jhull@spp2.UUCP (04/24/85)

trwrb is downstream of the following sites, based on messages received
since this flap started:

Glacier aeb     allegra amdahl  bellcore        bnb     clewis  cmcl2
conor   cwayne  dcdwest decvax  decwrl  genrad  harpo   harvard homxb
houxm   hpda    hplabs  hrs     ittvax  jrg     lanl    lsuc    mcvax
mhuxr   mhuxt   mit-eddie       mnetor  panda   pesnta  petsd   rich
rtech   sdcc3   sdcrdcf sdcsvax seismo  shawn   shelby  talcott
tektronix       trwrb   trwspp  ulysses unm-cvax        unmvax  utcs
uw-beaver       uw-june vax135  whuxl   whuxlm

OK, now, mail wizards, who is the culprit?  Is it the Butler?  Is it
the estranged wife of the Count?  Or did Pearl Pureheart do the dirty?
Tune in again next week...


-- 
 Blessed Be,

 Jeff Hull            {decvax,hplabs,ihnp4,scdrdcf,ucbvax}
 13817 Yukon Ave.         trwrb!trwspp!spp2!jhull
 Hawthorne, CA 90250		34o3'15" N  by  118o14'28" W

faustus@ucbcad.UUCP (04/26/85)

> Do you have a program that either converts numbers to roman numerals
> or (especially!) converts roman numerals to numbers.

Here is one: actually this prints the date in Roman numerals, but
the routine prom() does the real stuff...

	Wayne

/* RCS Info: $Revision: 1.1 $ on $Date: 85/04/18 17:44:51 $
 *           $Source: /cad1/faustus/src/misc/RCS/rdate.c,v $
 * Copyright (c) 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
 *
 * Print the date in roman numerals.
 */

main()
{
	char buf[64], s[3][16], nn[5][16], *prom();
	int q, p[2], n[5];

	pipe(p);
	if(fork() == 0) {
		dup2(p[1], 1);
		execl("/bin/date", "date", 0);
	}
	q = read(p[0], buf, 64);
	buf[q] = '\0';

	sscanf(buf, " %s %s %d %d:%d:%d %s %d ", s[0], s[1], &n[0], &n[1],
		&n[2], &n[3], s[2], &n[4]);
	for(q = 0; q < 5; q++)
		strcpy(nn[q], prom(n[q]));
	printf("%s %s %s %s:%s:%s %s %s\n", s[0], s[1], nn[0], nn[1],
		nn[2], nn[3], s[2], nn[4]);
	exit(0);
}

/* Render number in Roman Numerals. Should be unsigned...  Returns
 * pointer to the rendering. Problems with static data, etc.
 */

char *
prom(num)
	register unsigned int num;
{
	register int pos = 0;
	register int *i, k;
	register char *j;
	static char rbuf[64];	/* Bad assumption? */
	static int ndigits[] = { 1000, 500, 100, 50,  10,   5,   1,  0 } ;
	static char ddigits[] = { 'M', 'D', 'C', 'L', 'X', 'V', 'I', 'Z' } ; 

	if(num == 0)
		return("Z");	/* Well, what do we do? */
	while(num > 0) {
		for((i = ndigits, j = ddigits); *i; (i++, j++)) {
			if(num >= *i) {
				rbuf[pos++] = *j;
				num -= *i;
				break;
			}
			/* If you are on an even index in the array, the
			 * digit to use for filling in (e.g. IX = 9) is
			 * *i / 10, otherwise use *i / 5 (to make sure
			 * that it is a power of 10).
			 */
			k = (!((ndigits - i) % 2) ? (*i / 10) : (*i / 5));
			if(num >= (*i - k)) {
				rbuf[pos++] = *(j + 
					(((ndigits - i) % 2) ? 1 : 2));
				rbuf[pos++] = *j;
				num -= (*i - k);
				break;
			}
		}
	}
	rbuf[pos] = '\0';
	return(rbuf);
}

jp@lanl.UUCP (04/29/85)

> 
> Does anyone have a TRUE Fortran 77 source for RATFOR ?  We have a copy of



I tried to mail this but our mailer couldn't figure out what to do with
my reply so I am posting it to the net.
  
I am interested in RATFOR sources for FORTRAN 77 also.  I want something
that I can use with Digital Research's Fortran 77 on my Compupro System
running CPM-86 or PC-PRO.   My problems with the versions I have been
able to find are similar to yours.  My Fortran 66 version is full of
byte wide logical expressions and DR only allows Logical variables to
be T or F.  If you come up with something drop me a note.

Thanks,

Jim Potter  jp@lanl.arpa

ajs@hpfcla.UUCP (ajs) (05/11/85)

Re: big calendar printer

Just for grins, here's something similar, but it's a shell script which
uses cal(1) and awk(1) to do the job.  I call it "calbig".

# Script to produce big (page sized) calendars from cal(1) output.


# Input data looks like this (for example):
#
#    November 1983
#  S  M Tu  W Th  F  S
#        1  2  3  4  5
#  6  7  8  9 10 11 12
# 13 14 15 16 17 18 19
# 20 21 22 23 24 25 26
# 27 28 29 30			note: this line may be short.


# Check arguments:

	case $# in

	0)	months=`date +%m`			# default to current.
		year=19`date +%y`
		;;
	1)	months="1 2 3 4 5 6 7 8 9 10 11 12"	# whole year.
		year="$1"
		;;
	2)	months="$1"				# one month.
		year="$2"
		;;
	*)	echo "usage: $0 [[month(s)] year]" >&2	# error.
		exit 1
	esac


# Print calendars:

	for month in $months
	do
		cal $month $year |
		awk '

		BEGIN { days = \
"  Sunday    Monday    Tuesday  Wednesday Thursday   Friday   Saturday  "
			top  = \
" _________ _________ _________ _________ _________ _________ _________ "
			bar  = \
"|_________|_________|_________|_________|_________|_________|_________|"
			cols = \
"|         |         |         |         |         |         |         |"
		}

		/S  M Tu  W Th  F  S/ {		# start of month header.
			printf ("%s\n%s\n", days, top);
			next;
		}

		/[a-z]/ {			# a month title.
			printf ("\n\n\n\t\t\t%s %s\n\n\n", $1, $2);
			next;
		}

		/[0-9]/ {			# a number line.
			line = $0 "                    ";	# pad it.
			for (col = 1; col < 20; col += 3)
				printf ("| %2s      ", substr (line, col, 2));
			printf ("|\n");
			for (row = 2; row < 8; row++)
				print cols;
			print bar;
		}
		' |
		sed "s/^/	/"		# indent one tab.
		echo "\f\c"			# end page.
	done

rs@mirror.UUCP (05/28/85)

I'm also missing part2 of the kafka/insult source.
"please sir, I'd like some more."

--------
Rich $alz	{ mit-eddie, ihnp4!inmet, wjh12, cca, datacube } ! mirror!rs
Mirror Systems
2067 Massachusetts Ave.			"I've seen this happen
Cambridge, MA, 02140			 in other people's lives
617-661-0777				 and now it's happening in mine."

ajs@hpfcla.UUCP (ajs) (08/08/85)

> How about creating a new newsgroup net.sources.repost?

Better yet, don't repost anything, MAIL it.

jad@hpfcla.UUCP (jad) (08/14/85)

> /***** hpfclo:net.sources / uiucuxc!grayson /  7:21 pm  Aug  1, 1985*/
> 
> 	Here is the fastest way ever, and it is not a series.  It is called
> the Gauss-Legendre method, and was discovered independently by Salamin and
> Brent.  It is based on the arithmetic-geometric mean, which is:

	So, now that we have a nice fast way to find pi, how about
	something fun?  This one estimates the value of pi by placing
	points on in square area, and seeing how many fall in a circle.
	This is probably about the slowest (and least accurate) way to
	find pi, but it's far more amusing.  

			      --      jad      --
			      John A. Dilley, FSD
			      Fort Collins,    CO

ARPA:			      terrapin@Purdue.EDU
UUCP:			      {ihnp4}! hpfcla!jad
PHONE:			      (303)226-3800 x4166



/*
**	<rand_pi.c> --	Estimate pi by randomly throwing things at a circle
**
**	programmer:	John Dilley	(hpfclo:jad)
**
**	creation date:	Tue Jul 30 10:02
**
**		Randomly tosses points into an arena with a circle
**		defined ... determining how many fell into the circular
**		area allows you to estimate the value of pi.  Not real
**		accurate, of course!
**
**	CopyWrong (c) 198?
**		Permission granted for selling this thing for as much
**		as you can get for it, and you don't even have to claim
**		you got it from me.  In fact, I'd rather you didn't ...
*/

main()
{
	register int i=0, n=0, j;
	double	x, y;

printf("\014Set random number\n");
while (1)  {
	for (j=0; j<100; j++)	{
		x=RandReal();
		y=RandReal();
		if (x*x+y*y < 1.0)	i++;
		}
	n += 100;
	printf("%d\t%d\t%f\n", i,n,4.0*i/n);
	}
}

/*
**	<rand.c> --	Random number generator and clock based randomizer
**
**	programmer:	John Dilley	(mordred:jad)
**
**	creation date:	Thu Feb  7 14:19
*/

# include	<sys/time.h>

struct	timeval		time;
struct	timezone	zone;

static	double	seed=0.0;



/*
**	Randomize()	--	seed the random number generator
*/
Randomize()
{
    gettimeofday( &time, &zone );
    seed = (double) ((time.tv_usec&017777700)>>6) / (double)(01777);
}



/*
**	RandReal()	--	return a random real number in [0,1)
*/
RandReal() 
{

if (seed == 0.0)	Randomize();

seed = seed*9821 + 0.211327;
seed -= (int)seed;

return seed;
}

phil@ISM780B.UUCP (09/11/85)

:q

bees@infoswx.UUCP (09/30/85)

>In article <11100001@infoswx> bees@infoswx.UUCP writes:
>>Not to mention:
>>			tail -r file
>>assuming 4bsd...
>
>Yes, except that it will only list the last 4 k (or so) of the
>file - so 
>	revfile != tail -r
>Of course, the right approach would be to replace the -r code in
>tail with the revfile code.
>
>------------------
>Kim F. Storm, Inst of Datalogy(=CS), U of Copenhagen, Sigurdsgade 41, DK-2200 N
>UUCP: mcvax!diku!storm, <storm@diku.UUCP>           tel: +45 1 83 64 66, ext 14

Quite right!  I knew that there was a 4k limit to the size of any tail(1)
operation.  I recently wrote a program to "prune" (truncate the top) log
files that grow to infinity, because "tail -100b" never works.

Another approach would be to fix tail such that it dynamically allocates
memory, instead of limiting things to a 4k internal buffer.

Ray Davis
Teknekron Infoswitch, Richardson, TX
infoswx!bees, (214)644-0570

dat@hpcnof.UUCP (10/01/85)

/***** hpcnof:net.sources / birtch!oleg /  6:19 pm  Sep 25, 1985*/
> I have found that vt52 terminals on our Pyramid 90x ( 4.2 & V5, in 
> 4.2 BSD univerce) work just fine. vt100 on the other hand did not.
> I traced the problem to TERMCAP : vt100 entry contains the length of
> character sequence in front of  "cm", "cl" and some other sequences.
> That I fixed by setting environment var TERMCAP to be the modifyed
> vt100 entry from /etc/termcap ( without sequence length :  "cm=\E[..." 
> instead of "cm=5\E[...")

	Umm...it turns out that the number in front of the termcap
entry is defined to be the delay in milliseconds to send an appropriate
number of padding characters (usually a NULL - the exact number being a
function, logically, of how fast your terminal is receiving data) after
the desired operation.  So, for example, if your termcap entry is
		cm=5\EC
then the sequence that would be sent to the screen (assume that the
receive speed is one character per millisecond (?))

	<escape> C <null> <null> <null> <null> <null>

The fact that someone modified your termcap entries to reflect the number 
of characters in the entry is weird.  It means that since that modification
your terminals have been running just a tad slower than they could have
(maybe - this assumes that you aren't misreading it).

	Furthermore, some delays can be proportional to the number of lines
affected by the operation.  For example, the Clear to End of Screen could
be set to  "cd=3*\ED" which would mean that it would take a three millisecond
delay PER LINE AFFECTED by the operation, the exact number to be figured out
by the terminal driver.

	Termcap is a strange puppy...

						--- Dave Taylor
						Hewlett Packard Corp.

						ihnp4!hpfcla!d_taylor

pedz@ctvax (11/26/85)

I will probably regret this but here goes.

The sequence of

i = 1;
j = ++i + (++i + ++i);

can not leave j with a value of 12.  In fact, the value can not be
greater than 9 and or less than 6.  My line of reasoning is this:

Suppose we have the statement:

j = (i = 2) + (i = 3);

This will clearly leave j with the value of 5 but i's value may be 2
or 3.  The statement ++i is the same as i += 1 which is the same as i
= i + 1.  (I realize that if i were some expression with side effects,
the first two expressions are suppose to cause the side effect only
once but thats not important with a simple variable like i.)  Thus if
we convert the above statement we have

j = (i = i + 1) + (i = i + 1) + (i = i + 1)

Since we go in with i = 1, at least one of the factors will return a
value of 2.  All of them could return a value of 2.  One or two of
them could return a value of 3, and not more than one of them may
return a value of 4.  Thus the highest value is 9, not 12.

I realize also that this is a stupid point, the example was only done
in fun, and there are many other obvious reasons to flame me but I
just had to say this.

Perry Smith
pedz@ctvax

george@sysvis (01/07/86)

> The recent flood of {INSERT GROUP NAME HERE} with meta-discussion, flames,
> insults, and other inappropriate garble (anything but sources), partially
> caused by the lacking feature of the posting-software to prevent follow-ups
> to net.sources {??????}, leads me to request this.  Having to wade through
> several hundred articles is a good enough argument for me.
 
> Note that this is NOT censorship as such, as I don't mind all the bozo
> back-and-forth discussion/insult-fest in group net.news.group, which I
> have long since unsubscribed.  If someone cares to start a moderated
> group for that topic, I might consider finding time for it - not that ...

For all those who vehemently killed several groups on the network because 
{INSERT REASON} ... This then is the result:  1).  Excess baggage in improper 
forums which are the only reasonable place left to communicate a thought;
2).  Lack of a PROPER forum to state/discuss one's ideas/thoughts;  and 3).
The GROSS amount of communications (net.verbage) is NOT reduced by killing
groups.  Those who wish to express things merely look for the MOST APPROPRIATE 
PLACE to do so.  Hence, they are not stayed by the absence of a proper forum.
Any ideas, oh great network gurus, and mee-too's?  ihnp4!sys1!sysvis!george

rs@mirror.UUCP (01/11/86)

The formatted date capability of SystemV seemed kind of useful.
The original program seemed kind of clunky, so I re-wrote it.
I also fixed up some typo's and style errors in the manpage.
Enjoy...
	/rich $alz

# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by mirror!rs on Fri Jan 10 19:57:16 EST 1986
# Contents:  mtime.1 mtime.c
 
echo x - mtime.1
sed 's/^XX//' > "mtime.1" <<'@//E*O*F mtime.1//'

XX.TH MTIME 1 "HFVR"
XX.SH NAME
XXmtime \- to display modification time of files
XX.SH SYNOPSIS
XXmtime { [+format] file}+
XX.SH DESCRIPTION
XX\fIMtime\fR displays the last modification time of all files
XXmentioned as argument. An argument starting with a ``+'' will be
XXtreated to set the display format. The display format is then used for
XXall files following the display format. The display format is similar 
XXto that of the first argument of \fIprintf\fR(3S). All output fields
XXare of fixed size (zero padded if necessary). Each field descriptor
XXis preceded by ``%'' and will be replaced in the output by its
XXcorresponding value. A single ``%'' is encoded by ``%%''. All other characters
XXare copied to the output without change. The string is always terminated
XXwith a newline.
XX.sp
XXField descriptors:
XX.nf
XX       \fBn\fR     insert a new-line character
XX       \fBt\fR     insert a tab character
XX       \fBm\fR     month of year \- 01 to 12
XX       \fBd\fR     day of month \- 01 to 31
XX       \fBy\fR     last 2 digits of year \- 00 to 99
XX       \fBD\fR     date as in mm/dd/yy
XX       \fBH\fR     hour \- 00 to 23
XX       \fBM\fR     minute \- 00 to 59
XX       \fBS\fR     second \- 00 to 59
XX       \fBT\fR     time as HH:MM:SS
XX       \fBj\fR     day of year \- 001 to 366
XX       \fBw\fR     day of week \- Sunday = 0
XX       \fBa\fR     abbreviated weekday \- Sun to Sat
XX       \fBh\fR     abbreviated month \- Jan to Dec
XX.fi
XX.sp
XXThe default field descriptor is:
XX.nf
XX       +%a %h %d %H:%M:%S 19%y
XX.fi
XX.SH EXAMPLES
XX.nf
XX       mtime '+DATE:%m/%d/%y%nTIME: %H:%M:%S' file
XXwould have generated as output:
XX       DATE: 08/01/76
XX       TIME: 14:45:05
XX.fi
XX.SH USEFUL FOR
XX\fBmtime\fR is usefule for adding the last modification date to
XXprintouts of databases etc.
XX.SH SEE ALSO
XX\fIstat\fP(3), \fIdate\fP(1), \fIprintf\fP(3S)
XX.SH DIAGNOSTICS
XXAn error message is displayed if a file cannot be \fIstat\fP(2)'ed.
@//E*O*F mtime.1//
chmod u=rw,g=rw,o=rw mtime.1
 
echo x - mtime.c
sed 's/^XX//' > "mtime.c" <<'@//E*O*F mtime.c//'
XX/*
XX**  Originally written by jchvr@ihlpg, "HFVR VERSION=Thu Mar 21 13:29:02 1985".
XX**  Rewritten by Rich $alz (rs@mirror), 10-Jan-86.
XX**  "Do with me what you will."
XX*/

XX#include <stdio.h>
XX#include <sys/types.h>
XX#include <sys/stat.h>
XX#include <time.h>


XXprformat(p, T)
XX    register char	*p;
XX    register struct tm	*T;
XX{
XX    static char		 DAY[] = "SunMonTueWedThuFriSat";
XX    static char		 MON[] = "JanFebMarAprMayJunJulAugSepOctNovDec";

XX    for (p++; *p; p++)
XX	if (*p != '%')
XX	    printf("%c", *p);
XX	else
XX	    switch (*++p) {
XX		default:
XX		    printf("%c", *p);
XX		case '\0':
XX		    break;
XX		case 'n':
XX		    printf("\n");
XX		    break;
XX		case 't':
XX		    printf("\t");
XX		    break;
XX		case 'm':
XX		    printf("%.2d", T->tm_mon + 1);
XX		    break;
XX		case 'd':
XX		    printf("%.2d", T->tm_mday);
XX		    break;
XX		case 'y':
XX		    printf("%.2d", T->tm_year);
XX		    break;
XX		case 'D':
XX		    printf("%.2d/%.2d/%.2d",
XX			   T->tm_mon + 1, T->tm_mday, T->tm_year);
XX		    break;
XX		case 'H':
XX		    printf("%.2d", T->tm_hour);
XX		    break;
XX		case 'M':
XX		    printf("%.2d", T->tm_min);
XX		    break;
XX		case 'S':
XX		    printf("%.2d", T->tm_sec);
XX		    break;
XX		case 'T':
XX		    printf("%.2d:%.2d:%.2d", T->tm_hour, T->tm_min, T->tm_sec);
XX		    break;
XX		case 'j':
XX		    printf("%.3d", T->tm_yday + 1);
XX		    break;
XX		case 'w':
XX		    printf("%.2d", T->tm_wday);
XX		    break;
XX		case 'a':
XX		    printf("%3.3s", &DAY[T->tm_wday * 3]);
XX		    break;
XX		case 'h':
XX		    printf("%3.3s", &MON[T->tm_mon * 3]);
XX	    }
XX    printf("\n");
XX}


XX#ifdef	MAIN
XX/* ARGSUSED */
XXmain(argc, argv)
XX    int			 argc;
XX    register char	*argv[];
XX{
XX    extern struct tm	*localtime();
XX    extern int		 errno;
XX    char		*format = "+%a %h %d %H:%M:%S 19%y";
XX    char		*progname;
XX    struct stat		 filbuf;

XX    for (progname = *argv; *++argv; ) {
XX	if (**argv == '-') {
XX	    fprintf(stderr, "Usage: %s { [+output-format] filename }*\n",
XX		    progname);
XX	    fprintf(stderr, "To display last modification date of file(s)\n");
XX	    exit(1);
XX	}
XX	if (**argv == '+')
XX	    format = *argv;
XX	else if (stat(*argv, &filbuf) < 0)
XX	    fprintf(stderr, "\007%s: error %d. Cannot work on: %s,\n",
XX		    progname, errno, *argv);
XX	else {
XX	    printf("%s:  ", *argv);
XX	    prformat(format, localtime(&filbuf.st_mtime));
XX	}
XX    }

XX    exit(0);
XX}
XX#endif	TEST
@//E*O*F mtime.c//
chmod u=rw,g=rw,o=rw mtime.c
 
exit 0

--
Rich $alz	{mit-eddie, ihnp4!inmet, wjh12, cca, datacube}!mirror!rs
Mirror Systems	2067 Massachusetts Avenue  Cambridge, MA, 02140
Telephone:	6,176,610,777

Anonymous@inmet.UUCP (01/16/86)

This message is empty.

seev@techsup (02/07/86)

Me too, if it is a multi-player game... we already have vtrek, but 
I'm looking for something that lets players interact.

thanks,

Valerie See
...ihnp4!sys1!techsup!seev

rab@smu (09/22/86)

tried to send this by mail, but couldn't go through:
----------------------------------------------------------------------
saw your article in net.unix and got very interested.  i have had my
home full of the critters for years, and got the controller for the
radio shack color computer...  which i have regretted ever since.

rs just doesn't think before they do stuff.  the controller hooks to the
cassette port -- which you cannot use if you run the os9 (little unix)
operating system.  how can i get the DAK unit?  can you give me a name/
address/phone to contact?  do you know of any modifications to make to the
r.s. model so that the interface can be adapted for rs232 use?

sorry for all the questions.  i have wanted something like your program
x10 for a while for home automation.

rick barrett
(smu!rab)