DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T m

⟦458afd189⟧ TextFile

    Length: 1436 (0x59c)
    Types: TextFile
    Names: »mkversion.c«

Derivation

└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit
    └─⟦653021b30⟧ »EurOpenD3/utils/downtime.tar.Z« 
        └─⟦946c717da⟧ 
            └─⟦this⟧ »mkversion.c« 

TextFile

/* 
 * Copyright (c) 1988 Michael A. Cooper, University of Southern California.
 * This program may be used, copied, modified, and redistributed freely
 * for noncommercial purposes, so long as this notice remains intact.
 */

#ifndef lint
static char *RCSid = "$Header: mkversion.c,v 1.2 88/07/05 16:00:33 mcooper Exp $";
#endif

/*
 * mkversion - Make the version information.
 * 
 *             The following is placed into "file":
 *
 *                char version[] = "VERSION.ver of date (machine)";
 */

#include <stdio.h>
#include <sys/time.h>
#include "config.h"           /* This is where VERSION is from */

char file[] = "vers.c";           /* Destination C file */
char verfile[] = "version";       /* File containing version number */

main()
{
  long now;
  struct tm *t;
  FILE *fd, *fdver;
  int ver = 0;
  char host[100];



  if((fd = fopen(file, "w")) == NULL) {
    perror(file);
    exit(1);
  }

  if((fdver = fopen(verfile, "r")) != NULL) {
    fscanf(fdver, "%d", &ver);
  }
  fclose(fdver);

  if((fdver = fopen(verfile, "w")) == NULL) {
    perror(verfile);
    exit(1);
  }

  fprintf(fdver, "%d\n", ++ver);
  fclose(fdver);

  time(&now);
  if((t = localtime(&now)) == NULL) {
    perror("localtime");
    exit(1);
  }

  gethostname(host, sizeof(host));

  fprintf(fd, "char *version = \"%d.%d of %2.2d/%2.2d/%2.2d (%s)\"\;\n",
	  VERSION, ver, t->tm_mon+1, t->tm_mday, t->tm_year, host);

  fclose(fd);
}