* This code is derived from software contributed to Berkeley by
* Adam de Boor.
*
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
*/
#ifndef lint
-static char sccsid[] = "@(#)arch.c 5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)arch.c 5.7 (Berkeley) 12/28/90";
#endif /* not lint */
/*-
* Arch_Init Initialize this module.
*/
-#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <ctype.h>
#include <ar.h>
+#include <ranlib.h>
+#include <stdio.h>
#include "make.h"
#include "hash.h"
* variables and multi-word variable values.... The results
* are just placed at the end of the nodeLst we're returning.
*/
- buf=sacrifice=(char *)malloc(strlen(memName)+strlen(libName)+3);
+ buf = sacrifice = emalloc(strlen(memName)+strlen(libName)+3);
sprintf(buf, "%s(%s)", libName, memName);
if (ln != NILLNODE) {
ar = (Arch *) Lst_Datum (ln);
- he = Hash_FindEntry (&ar->members, (Address) member);
+ he = Hash_FindEntry (&ar->members, member);
if (he != (Hash_Entry *) NULL) {
return ((struct ar_hdr *) Hash_GetValue (he));
return ((struct ar_hdr *) NULL);
}
- ar = (Arch *) malloc (sizeof (Arch));
+ ar = (Arch *)emalloc (sizeof (Arch));
ar->name = strdup (archive);
- Hash_InitTable (&ar->members, -1, HASH_STRING_KEYS);
+ Hash_InitTable (&ar->members, -1);
memName[AR_MAX_NAME_LEN] = '\0';
while (fread ((char *)&arh, sizeof (struct ar_hdr), 1, arch) == 1) {
he = Hash_CreateEntry (&ar->members, strdup (memName),
(Boolean *)NULL);
- Hash_SetValue (he, (ClientData)malloc (sizeof (struct ar_hdr)));
+ Hash_SetValue (he, (ClientData)emalloc (sizeof (struct ar_hdr)));
bcopy ((Address)&arh, (Address)Hash_GetValue (he),
sizeof (struct ar_hdr));
}
* Now that the archive has been read and cached, we can look into
* the hash table to find the desired member's header.
*/
- he = Hash_FindEntry (&ar->members, (Address) member);
+ he = Hash_FindEntry (&ar->members, member);
if (he != (Hash_Entry *) NULL) {
return ((struct ar_hdr *) Hash_GetValue (he));
* None.
*
* Side Effects:
- * Both the modification time of the library and of the LIBTOC
+ * Both the modification time of the library and of the RANLIBMAG
* member are set to 'now'.
*
*-----------------------------------------------------------------------
struct ar_hdr arh; /* Header describing table of contents */
struct timeval times[2]; /* Times for utimes() call */
- arch = ArchFindMember (gn->path, LIBTOC, &arh, "r+");
+ arch = ArchFindMember (gn->path, RANLIBMAG, &arh, "r+");
sprintf(arh.ar_date, "%-12d", now);
if (arch != (FILE *) NULL) {
{
char *libName; /* file name for archive */
- libName = (char *)malloc (strlen (gn->name) + 6 - 2);
+ libName = (char *)emalloc (strlen (gn->name) + 6 - 2);
sprintf(libName, "lib%s.a", &gn->name[2]);
gn->path = Dir_FindFile (libName, path);
* make began (i.e. it's been modified in the course
* of the make, probably by archiving).
* Its modification time doesn't agree with the modification
- * time of its LIBTOC member (i.e. its table of contents
+ * time of its RANLIBMAG member (i.e. its table of contents
* is out-of-date).
*
*
struct ar_hdr *arhPtr; /* Header for __.SYMDEF */
int modTimeTOC; /* The table-of-contents's mod time */
- arhPtr = ArchStatMember (gn->path, LIBTOC, FALSE);
+ arhPtr = ArchStatMember (gn->path, RANLIBMAG, FALSE);
if (arhPtr != (struct ar_hdr *)NULL) {
(void)sscanf (arhPtr->ar_date, "%12d", &modTimeTOC);
if (DEBUG(ARCH) || DEBUG(MAKE)) {
- printf("%s modified %s...", LIBTOC, Targ_FmtTime(modTimeTOC));
+ printf("%s modified %s...", RANLIBMAG, Targ_FmtTime(modTimeTOC));
}
oodate = (gn->mtime > modTimeTOC);
} else {