[comp.unix.questions] SCCS/cftime clash

koerberm@nixsin.UUCP (Mathias Koerber) (06/13/90)

I got a problem involving SCCS. In my program (stored as an SCCS-file)
I use cftime(buf,"%d%m%y%H%M%S",&now) to generate a date/timestring
	ddmmyyHHMMSS.

The problem is, that SCCS already converts the %H% that is caused by the
combination of %H and %M to look like 06/13/90, ie. it replaces the date
when I get the file for compilation.

Is there a way to tell SCCS:
	- not to change a specific keyletter,
	- not to change at all ( there is -k)
	- not to change keyletters in a specifig range. I think of something
	like:

		%>%	stop changing keyletters until you find
		%>%. This would take care of the problem.

Anyone have a solution for me?

Ragards, Mathias
-- 
Mathias Koerber           |Tel:   +65 / 7473828 ext 1852|Fax: +65 / 7474331
Nixdorf Computer Singapore|EUnet: koerber.sin@nixpbe    |nerv:  koerber.sin
2 Kallang Sector          |uunet: uunet!linus!nixbur!koerber.sin
Singapore 1334            |[Standard-disclaimer:All views personal...     ]

cpcahil@virtech.uucp (Conor P. Cahill) (06/14/90)

In article <1056@nixsin.UUCP> koerberm@nixsin.UUCP (Mathias Koerber) writes:
>I got a problem involving SCCS. In my program (stored as an SCCS-file)
>I use cftime(buf,"%d%m%y%H%M%S",&now) to generate a date/timestring
>	ddmmyyHHMMSS.
>
>The problem is, that SCCS already converts the %H% that is caused by the
>combination of %H and %M to look like 06/13/90, ie. it replaces the date
>when I get the file for compilation.

The easy way to fix this is to change your call to cftime as follows:

	cftime(buf,"%d\%m\%y\%H\%M\%S",&now) 

Which will do what you want and won't match any current or future SCCS 
id keywords.

>Is there a way to tell SCCS:
>	- not to change a specific keyletter,
>	- not to change at all ( there is -k)
>	- not to change keyletters in a specifig range. I think of something

There is no way not to change a range, and you probably don't want to turn
off changing of the key letters since you should have them in real sccsid
strings.

If you really want to get the sccs version without having the keys translated,
you could do the following:

	get -e s.junk.c
	rm p.junk.c
	chmod -w junk.c

in your makefile, but I would recommend the backslash solution I listed above.


-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.,
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170 

gwyn@smoke.BRL.MIL (Doug Gwyn) (06/15/90)

In article <1056@nixsin.UUCP> koerberm@nixsin.UUCP (Mathias Koerber) writes:
>I got a problem involving SCCS. In my program (stored as an SCCS-file)
>I use cftime(buf,"%d%m%y%H%M%S",&now) to generate a date/timestring

There is no really elegant solution to this.  One portable solution
is to use instead
	{
	static char format[] = "%d%m%y%H?M%S";
	format[8] = '%';	/* darn that SCCS */
	cftime(buf,format,&now);
	}

merlyn@iwarp.intel.com (Randal Schwartz) (06/15/90)

In article <13120@smoke.BRL.MIL>, gwyn@smoke (Doug Gwyn) writes:
| In article <1056@nixsin.UUCP> koerberm@nixsin.UUCP (Mathias Koerber) writes:
| >I got a problem involving SCCS. In my program (stored as an SCCS-file)
| >I use cftime(buf,"%d%m%y%H%M%S",&now) to generate a date/timestring
| 
| There is no really elegant solution to this.  One portable solution
| is to use instead
| 	{
| 	static char format[] = "%d%m%y%H?M%S";
| 	format[8] = '%';	/* darn that SCCS */
| 	cftime(buf,format,&now);
| 	}

(didn't we do this already?)

	static char format[] = "\045d\045m\045y\045H\045M\045S";

No runtime hacks needed.  I dare SCCS to find %M% in *that*!

Just another C hacker,
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/

rob@mtdiablo.Concord.CA.US (Rob Bernardo) (06/15/90)

In article <1990Jun14.123736.18443@virtech.uucp> cpcahil@virtech.UUCP (Conor P. Cahill) writes:
>If you really want to get the sccs version without having the keys translated,
>you could do the following:
>
>	get -e s.junk.c
>	rm p.junk.c
>	chmod -w junk.c

"get -k s.junk.c" should be sufficient.
-- 
Rob Bernardo, Mt. Diablo Software Solutions
email: rob@mtdiablo.Concord.CA.US
phone: (415) 827-4301

gwyn@smoke.BRL.MIL (Doug Gwyn) (06/16/90)

In article <1990Jun14.211132.20855@iwarp.intel.com> merlyn@iwarp.intel.com (Randal Schwartz) writes:
-In article <13120@smoke.BRL.MIL>, gwyn@smoke (Doug Gwyn) writes:
-| There is no really elegant solution to this.  One portable solution
-| is to use instead
-| 	{
-| 	static char format[] = "%d%m%y%H?M%S";
-| 	format[8] = '%';	/* darn that SCCS */
-| 	cftime(buf,format,&now);
-| 	}
-	static char format[] = "\045d\045m\045y\045H\045M\045S";

Note that I said *portable* solution.