Esempio n. 1
0
/* One argument is expected: path to the launcher (to locate the manifest file) */
int main(int argc, char *argv[], char *envp[])
{
	FILE *f;
	const char *manifestDir, *outFile;

	Exe = argv[1];
	outFile = argv[2];

	manifestDir = GetManifestDir();
	ReadManifest(manifestDir);
	LinkFiles(manifestDir);
	LinkFilesTree(manifestDir);
	LinkHostFxr(manifestDir);
	return 0;
}
Esempio n. 2
0
File: link.c Progetto: kbarber/cfng
int
AbsoluteLink(char *from, char *to,
    struct Item *inclusions, struct Item *exclusions, struct Item *copy,
    short nofile, struct Link *ptr)
{
    char absto[CF_BUFSIZE];
    char expand[CF_BUFSIZE];

    Debug2("AbsoluteLink(%s,%s)\n",from,to);

    if (*to == '.') {
        strcpy(g_linkto,from);
        ChopLastNode(g_linkto);
        AddSlash(g_linkto);
        strcat(g_linkto,to);
    } else {
        strcpy(g_linkto,to);
    }

    CompressPath(absto,g_linkto);

    expand[0] = '\0';

    if (!nofile) {

        /* begin at level 1 and beam out at 15 */
        if (!ExpandLinks(expand,absto,0))  {
            CfLog(cferror,"Failed to make absolute link in\n","");
            snprintf(g_output,CF_BUFSIZE*2,"%s -> %s\n",from,to);
            CfLog(cferror,g_output,"");
            return false;
        } else {
            Debug2("ExpandLinks returned %s\n",expand);
        }
    } else {
        strcpy(expand,absto);
    }

    CompressPath(g_linkto,expand);

    return LinkFiles(from,g_linkto,inclusions,exclusions,copy,nofile,ptr);
}
Esempio n. 3
0
File: link.c Progetto: kbarber/cfng
int
RelativeLink(char *from, char *to,
    struct Item *inclusions, struct Item *exclusions, struct Item *copy,
    short nofile, struct Link *ptr)
{
    char *sp, *commonto, *commonfrom;
    char buff[CF_BUFSIZE],linkto[CF_BUFSIZE];
    int levels=0;

    Debug2("RelativeLink(%s,%s)\n",from,to);

    if (*to == '.') {
        return LinkFiles(from,to,inclusions,exclusions,copy,nofile,ptr);
    }

    if (!CompressPath(linkto,to)) {
        snprintf(g_output,CF_BUFSIZE*2,"Failed to link %s to %s\n",from,to);
        CfLog(cferror,g_output,"");
        return false;
    }

    commonto = linkto;
    commonfrom = from;

    if (strcmp(commonto,commonfrom) == 0) {
        CfLog(cferror,"Can't link file to itself!\n","");
        snprintf(g_output,CF_BUFSIZE*2,"(%s -> %s)\n",from,to);
        CfLog(cferror,g_output,"");
        return false;
    }

    while (*commonto == *commonfrom) {
        commonto++;
        commonfrom++;
    }

    while (!((*commonto == '/') && (*commonfrom == '/'))) {
        commonto--;
        commonfrom--;
    }

    commonto++;

    Debug("Commonto = %s, common from = %s\n",commonto,commonfrom);

    for (sp = commonfrom; *sp != '\0'; sp++) {
        if (*sp == '/') {
            levels++;
        }
    }

    Debug("LEVELS = %d\n",levels);

    memset(buff,0,CF_BUFSIZE);

    strcat(buff,"./");

    while(--levels > 0) {
        if (BufferOverflow(buff,"../")) {
            return false;
        }

        strcat(buff,"../");
    }

    if (BufferOverflow(buff,commonto)) {
        return false;
    }

    strcat(buff,commonto);

    return LinkFiles(from,buff,inclusions,exclusions,copy,nofile,ptr);
}