vcs.c revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1989-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Eduardo Krell <ekrell@adexus.cl> *
* *
***********************************************************************/
#pragma prototyped
/*
* Herman Rao
* AT&T Research
* 3d version control system interface
*/
#include "3d.h"
#if VCS
#define MAXVID 256
#define MAGIC_STRING "\026\003\023\006"
#define MAGIC_LEN 4
#define DELTA (1 << 0)
typedef struct /* unique id for a sfile in WAN */
{
unsigned long host;
} Rno_t;
/*
* structure of sfile
*
* attr tags_region delta_region log_region
* __________________________________________________________
* | |T|T|T|T| ......|D |D |..... |T|D |T|D |
* ----------------------------------------------------------
*
*/
typedef struct
{
char magic[4];
int type; /* type of file, i.e., DELTA */
int version; /* RSCS version number */
int tag_reg; /* tags region */
int del_reg; /* delta region */
int log_reg; /* log region */
int basetag; /* base tag */
int base; /* base delta */
int basesize; /* base delta size */
} Attr_t;
#define LOG (1<<0)
typedef struct
{
int length; /* length of tag */
int type; /* type of data */
int del; /* addr of data */
int dsize; /* size of data */
int domain; /* domain of the creator */
} Tag_t;
#define CHRLINK '>'
#define CHRMARKER '<'
#define MAXLINKS 10
/*
* used by lookup_tag()
*/
#define L_LOG (1<<0)
typedef struct Rdirent
{
int oldaddr; /* for reconf used */
char* link; /* used by the link */
} Rdirent_t;
/*
* list of error codes
*/
#define ERRARG 1
#define NOVFILE 2
#define NOTRSCS 3
#define NOVERSION 4
#define NOBASE 5
#define ERRSTRUCT 6
#define ERRBASE 7
#define ERRDELTA 8
#define NOMEM 9
#define ERRUPDATE 10
#define ERRACCESS 11
#define ERRWRITE 12
#define NOENTIES 13
#define DEFAULT "default"
#define LATEST "latest"
#define VCS_RDIR "VCS"
#define VCS_MDIR "..."
int
{
char* b;
char* e;
int fd;
int n;
int synfd;
{
return(-1);
}
bprintf(&b, e, "out %s %s %s\n", state.path.vcs.rfile, state.path.vcs.version, state.path.vcs.rfile);
n = b - buf;
{
return(-1);
}
return(-1);
{
buf[n - 1] = 0;
return(0);
}
return(-1);
}
/*
* path: prefix/.../file_name/version_name
* version: version_name
*/
static int
{
register const char* s;
const char* p[3];
int i;
for (s = path; *s; s++);
for (i = 0; s != path && i < 3; s--)
if (*s == '/')
p[i++] = s + 1;
s++;
return(-1);
return(0);
}
static Rdirent_t*
{
int result;
char* link = 0;
int marker;
*link++ = 0;
while (dp)
{
/*
* no marker as this point
*/
#if 0
{
{
continue;
}
}
#endif
{
/*
* check if the minor key (domain) is the same
*/
{
return(head);
return(head);
}
}
else if (result > 0)
{
return(head);
}
}
return(head);
}
static Tag_t*
{
register char* s;
int len;
s = (char *)tp + sizeof(int);
if (!READ(f, (char *)&(tp->length), sizeof(int)) || (len = tp->length - sizeof(int)) && READ(f, (char *)s, len) != len)
return(0);
{
}
return(tp);
}
static Rdirent_t*
{
head = 0;
/*
* remove expired marker
*/
while (dp)
{
{
}
else
{
}
}
return(head);
}
static Tag_t*
{
register Rdirent_t* p;
return(0);
{
{
{
p = rd;
}
}
if (mtime)
return(p->tag);
}
{
{
}
}
return(0);
}
static void
{
while(rdir)
{
}
return;
}
/*
* return 0 if found it;
* -1 if error
* 1 if not found.
*/
static int
{
{
return(-1);
if (!rdir)
return(1);
}
{
return(0);
}
return(1);
}
int
{
int n;
int fd;
return(-1);
message((-2, "vcs: real path=%s rfile=%s version=%s", path, state.path.vcs.rfile, state.path.vcs.version));
return(-1);
{
return(-1);
}
{
}
return(0);
}
int
{
return(0);
}
#else
#endif