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 c

⟦ac567d8b2⟧ TextFile

    Length: 2012 (0x7dc)
    Types: TextFile
    Names: »cktock.c«

Derivation

└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit
    └─⟦3da672b63⟧ »EurOpenD3/misc/kermit.tar.Z« 
        └─⟦126dd3ca0⟧ 
            └─⟦this⟧ »cktock.c« 

TextFile

/*  xktock.c - Copy experimental C-Kermit files xk*.* to ck*.*  */
/*  F. da Cruz, CUCCA, Aug 87  */

#include <stdio.h>

char name[500], cmd[500], msg[100];	/* Name, command, & message buffers */

main(argc,argv) int argc; char **argv; {
    int i;

    if (argc < 2) usage();		/* Need files on command line. */

/* For each file, if name starts with "xk" change first letter to "c". */
/* If file of that name already exists, exit with a warning message.   */

    for (i = 1; i < argc; i++) {	/* Loop for each file. */
	strcpy(name,argv[i]);
	if ((name[0] == 'x') && (name[1] == 'k')) {
	    *name = 'c';
	    if (!access(name,0)) {
		fprintf(stderr,"Error: %s already exists\n",name);
		printf(stderr,
		  "Please dispose of your ck*.* files and run this again.\n");
		usage();
	    }
	    movefile(argv[i],name);	/* All OK, rename the file. */
	}
    }
    if (!access("ckuker.mak",0)) {	/* Handle the Makefile specially. */
	movefile("ckuker.mak","Makefile");
    }  else {
	fprintf(stderr,"\nError: Makefile (ckuker.mak) missing!\n");
	exit(1);
    }
    printf("\nDone.  Now you can make C-Kermit for your system.\n");
    printf("See the Makefile for instructions.\n");
    exit(0);
}
  
movefile(n1,n2) char *n1, *n2; {	/* Function to rename a file.  */
    int a;
    sprintf(cmd,"mv %s %s",n1,n2);	/* Construct command */
    printf(cmd);			/* Echo it. */
    a = system(cmd);			/* Run it.  */
    if ((a == 127) || (a < 0)) {	/* Handle errors. */
	sprintf(msg,"\n%s failed (%d)",a,cmd);
	perror(msg);
	exit(1);
    } else printf(" (ok)\n");
}

usage() {				/* Usage message & exit */
    fprintf(stderr,"\nUsage: xktock xk*\n\n");
    fprintf(stderr,"This programs renames the experimental C-Kermit files\n");
    fprintf(stderr,"from xk*.* to ck*.* so that you can build them using\n");
    fprintf(stderr,"the Makefile.  Before running this program, put all\n");
    fprintf(stderr,"xk*.* files in a directory by themselves and cd to\n");
    fprintf(stderr,"that directory.\n\n");
    exit(1);
}