Lines Matching +defs:arch +defs:name

1 /*	$NetBSD: arch.c,v 1.222 2024/08/06 17:46:01 rillig Exp $	*/
18 * 3. Neither the name of the University nor the names of its contributors
54 * 4. Neither the name of the University nor the names of its contributors
110 * library name in the GNode should be in
111 * -l<name> format.
128 /* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */
129 MAKE_RCSID("$NetBSD: arch.c,v 1.222 2024/08/06 17:46:01 rillig Exp $");
137 char *name;
139 * by <name, struct ar_hdr *> key/value pairs */
140 char *fnametab; /* Extended name table strings */
162 free(a->name);
195 char saveChar; /* Ending delimiter of member-name */
232 * First skip to the start of the member's name, mark that
371 FILE *arch;
378 /* Current member name while hashing. */
384 if (strcmp(a->name, archive) == 0)
397 /* Try truncated name */
416 arch = ArchFindMember(archive, member, &sarh, "r");
417 if (arch == NULL)
420 fclose(arch);
424 arch = fopen(archive, "r");
425 if (arch == NULL)
428 if (fread(magic, SARMAG, 1, arch) != 1 ||
430 (void)fclose(arch);
435 ar->name = bmake_strdup(archive);
441 while (fread(&arh, sizeof arh, 1, arch) == 1) {
463 switch (ArchSVR4Entry(ar, memName, size, arch)) {
479 * BSD 4.4 extended AR format: #1/<namelen>, with name as the
490 if (fread(memName, elen, 1, arch) != 1)
493 if (fseek(arch, -(long)elen, SEEK_CUR) != 0)
511 if (fseek(arch, ((long)size + 1) & ~1, SEEK_CUR) != 0)
515 fclose(arch);
522 fclose(arch);
533 * If it is "/<offset>", then try to substitute the long file name
544 ArchSVR4Entry(Arch *ar, char *inout_name, size_t size, FILE *arch)
556 "Attempted to redefine an SVR4 name table\n");
567 if (fread(ar->fnametab, size, 1, arch) != 1) {
568 DEBUG0(ARCH, "Reading an SVR4 name table failed\n");
578 "Found svr4 archive name table with %lu entries\n",
588 DEBUG1(ARCH, "Could not parse SVR4 name %s\n", inout_name);
607 const char *name, size_t namelen)
612 if (strncmp(ar_name, name, namelen) != 0)
646 FILE *arch;
651 arch = fopen(archive, mode);
652 if (arch == NULL)
655 if (fread(magic, SARMAG, 1, arch) != 1 ||
657 fclose(arch);
665 while (fread(out_arh, sizeof *out_arh, 1, arch) == 1) {
669 fclose(arch);
679 if (fseek(arch, -(long)sizeof *out_arh, SEEK_CUR) !=
681 fclose(arch);
684 return arch;
689 * BSD 4.4 extended AR format: #1/<namelen>, with name as the
700 fclose(arch);
703 if (fread(ename, elen, 1, arch) != 1) {
704 fclose(arch);
714 /* Found as extended name */
715 if (fseek(arch,
718 fclose(arch);
721 return arch;
723 if (fseek(arch, -(long)elen, SEEK_CUR) != 0) {
724 fclose(arch);
734 if (fseek(arch, (size + 1) & ~1L, SEEK_CUR) != 0) {
735 fclose(arch);
740 fclose(arch);
824 * being made and its member's name matches the name
830 const char *nameStart = strchr(pgn->name, '(') + 1;
835 strncmp(nameStart, gn->name, nameLen) == 0) {
854 * actual file name, not -l...). If the system can handle the -L
858 * TARGET variable for this node to be the node's name. Otherwise,
865 char *libName = str_concat3("lib", gn->name + 2, ".a");
869 Var_Set(gn, TARGET, gn->name);
974 && memcmp(buf, "!<arch>\n", sizeof buf) == 0;