コード例 #1
0
static void
tryCVS(const char *path,
       const char **vers_,
       time_t * date_,
       const char **lock_)
{
    char working[MAXPATHLEN];
    char *leaf;
    char *s;
    CVS_WORK *cache;

    if (strlen(path) >= sizeof(working))
	return;

    if ((leaf = fleaf(path)) == 0)
	return;

    strcpy(working, path);
    if ((s = fleaf_delim(working)) != 0)
	*s = EOS;
    /*
     * Look for cached data for this working directory.
     */
    for (cache = my_work; cache != 0; cache = cache->next) {
	if (!strcmp(cache->working, working)) {
	    if (check_timestamp(cache)) {
		break;
	    }
	    if (read_from_cache(cache, leaf, vers_, date_, lock_))
		return;
	}
    }

    /*
     * If we did not find it in the cache list, or our cache is obsolete,
     * look for new information.
     */
    if (cache == 0) {
	cache = typealloc(CVS_WORK);
	cache->next = my_work;
	my_work = cache;

	cache->timestamp = 0;
	cache->working = txtalloc(working);
	cache->num_entries = 0;
	cache->Entries = 0;
	cache->Repository = 0;
	cache->Root = 0;
	read_entries(cache);
	(void) check_timestamp(cache);
    } else {
	read_entries(cache);
    }
    (void) read_from_cache(cache, leaf, vers_, date_, lock_);
}
コード例 #2
0
ファイル: select.c プロジェクト: ricksladkey/vile
static AREGION *
alloc_AREGION(void)
{
    AREGION *arp;

    beginDisplay();
    if ((arp = typealloc(AREGION)) == NULL) {
	(void) no_memory("AREGION");
    }
    endofDisplay();
    return arp;
}