Re: [Circle] Helpful Tip

From: cronos (cronos@blue.bluewave.co.kr)
Date: 08/26/96


On Sun, 25 Aug 1996, jeremy elson wrote:

<--- erased --->
> 
> It has lots of other neat features that are explained in the docs: for 
> example, by making a small modification to the header files of Circle, it 
> will imprint the binary itself with a revision number for each source 
> file.  That way, if you're having bugs with a binary file, you can use 
> "strings" and it will tell you exactly which revision numbers of source 
> created the binary (i.e. act.informative.c v1.23, act.wizard.c. v1.44, 
> act.other.c v.1.12, etc.).  Then you simply tell RCS to retrieve those 
> revision numbers of the source code, and -- voila!  You have a snapshot 
> of the source code that created the binary in question.
> 
<--- erased --->


RCS, a fascinate tool for programming i think.

I put it Makefile and go into RCS automatically, 'cause RCS(or SCCS)
does good stuff with Makefile.
here's an example, a part of my Makefile.

< ... contents of original Makefile ...>
#
# version control section
#

# source files you have
SOURCES=act.comm.c act.informative.c act.movement.c act.obj.c act.offensive.c \
act.other.c act.social.c act.wizard.c alias.c b_comm.c ban.c boards.c \
castle.c clan.c class.c comm.c config.c constants.c corpse.c db.c fight.c \
graph.c han.handle.c handler.c house.c interpreter.c limits.c magic.c \
mail.c mobact.c modify.c objsave.c olc.c \
random.c shop.c spec_assign.c spec_procs.c \
spell_parser.c spells.c utils.c weather.c

# also headers
HEADERS=boards.h comm.h db.h handler.h house.h interpreter.h \
mail.h olc.h screen.h shop.h spells.h structs.h utils.h

# other misc files
UTILS=TASK act.ref TODO FEATURE SKILLS version.c

# archive file name to save
ARCHIVE=source.tar

# 'make v_archive' does makes tar file
v_archive:
	tar cvf ${ARCHIVE} ${SOURCES} ${HEADERS} ${UTILS}

# extract files
v_unarchive:
	tar xvf ${ARCHIVE}

# make RCS infor initialize (IT MAY NOT WORK or YOU HAVE TO INITIALIZE
#			     BY YOUR OWN)
v_initialize:
	rcs -U -t-'The tower of the elves - second history' ${ARCHIVE}

# to save archive, 'make v_save'
v_save:
	tar cvf ${ARCHIVE} ${SOURCES} ${HEADERS} ${UTILS}
	ci ${ARCHIVE}
	rm -f ${ARCHIVE} ${SOURCES} ${HEADERS} ${UTILS}
# and save Makefile, too
	ci Makefile

# to load archive, 'make v_load'
# RCS will load Makefile automatically even if Makefile does not exist!
v_load:
	co -kkv ${ARCHIVE}
	tar xvf ${ARCHIVE}
	rm -f ${ARCHIVE}

# show all versions' information
v_info:
	rlog ${ARCHIVE} | more
------

Yes, I make several versions with tar archives, you can make you
revisions about every source codes utils.c, comm.c, etc.

The section 'v_initialize' may not work. it's too ago to imagine
if that works, so you may init. RCS by yourself.
'man RCS' will show the way.
Section 'v_save' makes archive and save with new revision number,
all *.c, *.h and Makefile will be erased.
Section 'v_load' does load archive file and extract sources.
Although the Makefile does not appear in src directory, 'make v_load'
will work. The make(1) will does like 'co Makefile' if she cannot
find Makefile. I think it's cool, isn't it?
in v-load section the switch -kkv works RCS to substitute revision number.

look at this,
here's my version.c

---------------
/*
 *	version.c	this file includes RCS revision number
 *			given when it's saved.
 *
 */

char	*version_number = \
"It's time to MUD. based on CirclMud 3.0.\r\n\
$Id: 0626.html,v 1.1 2000/12/19 13:53:02 furry Exp $\r\n\
";










/* end */
----------------

When you use 'co' and -kkv is given, RCS can updates sources' revision
number. The '$Id: 0626.html,v 1.1 2000/12/19 13:53:02 furry Exp $ will be changed into that number
when it is loaded. the keywords like $Id: 0626.html,v 1.1 2000/12/19 13:53:02 furry Exp $ are $Archive$ $Author: furry $.. etc.
when I put the $Id: 0626.html,v 1.1 2000/12/19 13:53:02 furry Exp $ only in version.c, the file crashes when it was loaded.
Because RCS expands keyword $Id: 0626.html,v 1.1 2000/12/19 13:53:02 furry Exp $ to $Id: 0626.html,v 1.1 2000/12/19 13:53:02 furry Exp $ long one, I put the
version.c end of tar file and put MANY MANY newlines in version.c, then
it works.
After first this expands, It will work fine.

If you wanna make revisions with every source files rather than tar
archive, this will be no problem.

'v_info' shows you every revision informations.


give me more ideas? or tell me the right code of 'v_initialize'.

----------------------------------------------------------------------------
% id                                  | E-Mail: cronos@blue.bluewave.co.kr
uid=0(cronos) gid=1(cronos)           |         cronos@cronos.bluewave.co.kr
% whoami                              |
who are you?                          | Phone:  051-610-0941, 051-610-0942
% shit!                               |         Bluewave Communications.
Connection closed by foreign host.    |
----------------------------------------------------------------------------



+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/07/00 PST