methods for putting labels into your software?

Paul Biron pbiron at keynes.ucsd.edu
Fri Jun 28 00:45:10 AEST 1991


In article <1991Jun26.165609.9692 at athena.mit.edu> mlevin at jade.tufts.edu writes:
>
>   I'd like to hear suggestions, or any tricks that the pros out there
>know about, for putting some kind of text label or code into your
>executable (compiled and linked from C code) so that if anyone were to
>copy a part of the code, you could know it was a copy by somehow
>seeking out that label. For example, I guess you could probably define
>a static string in your C program which contained a code word, and
>then you could know if a given program was copied from yours by
>doing "strings a.out | grep keyword" or something.  I am looking for
>ideas that are less obvious to detect - a method such that someone
>copying the code wasn't likely to notice and edit out (with a patch or
>something). Any ideas would be appreciated.
>
>Mike Levin

How about just using rcs(1L) and ident(1L).  rcs allows you put
"labels" into to code which are initialized to a character string
and are accessable in the binary with the ident command.

Basically you put something like:

static char *id = "$Source$" ;

into your source file, and then when you check something out
with rcs, it substitutes for $Source$ something like:

static char *id = "$Source: /u3/ssdb/pbiron/src/Nssdb/RCS/main.c,v $" ;

Then, when you run ident on the binary, it outputs:

	$Source: /u3/ssdb/pbiron/src/Nssdb/RCS/main.c,v $

You can get the rcs suite from uunet.



More information about the Comp.unix.programmer mailing list