summaryrefslogtreecommitdiff
path: root/ar.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1996-03-20 14:57:41 +0000
committerRoland McGrath <roland@redhat.com>1996-03-20 14:57:41 +0000
commit9e443adaf679b071fb3319cfc3259e322dcb6e57 (patch)
treea84a507d09be97fb0932bb661139921a59db71bd /ar.c
parentdfefc77263fe835ae12b3ee27cc3ed9b084311c1 (diff)
downloadgunmake-9e443adaf679b071fb3319cfc3259e322dcb6e57.tar.gz
Tue Mar 19 20:21:34 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
Merged VMS port from Klaus Kaempf <kkaempf@didymus.rmi.de>. * make.h (PARAMS): New macro. * config.h-vms: New file. * makefile.com: New file. * makefile.vms: New file. * readme.vms: New file. * vmsdir.h: New file. * vmsfunctions.c: New file. * vmsify.c: New file. * file.h: Renamed to filedef.h to avoid conflict with VMS system hdr. * ar.c: Added prototypes and changes for VMS. * commands.c: Likewise. * commands.h: Likewise. * default.c: Likewise. * dep.h: Likewise. * dir.c: Likewise. * expand.c: Likewise. * file.c: Likewise. * function.c: Likewise. * implicit.c: Likewise. * job.c: Likewise. * job.h: Likewise. * main.c: Likewise. * make.h: Likewise. * misc.c: Likewise. * read.c: Likewise. * remake.c: Likewise. * remote-stub.c: Likewise. * rule.c: Likewise. * rule.h: Likewise. * variable.c: Likewise. * variable.h: Likewise. * vpath.c: Likewise. * compatMakefile (srcs): Rename file.h to filedef.h.
Diffstat (limited to 'ar.c')
-rw-r--r--ar.c126
1 files changed, 121 insertions, 5 deletions
diff --git a/ar.c b/ar.c
index 63fcd34..117e11b 100644
--- a/ar.c
+++ b/ar.c
@@ -20,14 +20,14 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef NO_ARCHIVES
-#include "file.h"
+#include "filedef.h"
#include "dep.h"
#include <fnmatch.h>
/* Defined in arscan.c. */
-extern long int ar_scan ();
-extern int ar_member_touch ();
-extern int ar_name_equal ();
+extern long int ar_scan PARAMS ((char *archive, long int (*function) (), long int arg));
+extern int ar_member_touch PARAMS ((char *arname, char *memname));
+extern int ar_name_equal PARAMS ((char *name, char *mem, int truncated));
/* Return nonzero if NAME is an archive-member reference, zero if not.
@@ -67,8 +67,113 @@ ar_parse_name (name, arname_p, memname_p)
if (memname_p != 0)
*memname_p = savestring (p + 1, end - (p + 1));
}
+
+#ifdef VMS
+#include <lbrdef.h>
+#include <mhddef.h>
+#include <credef.h>
+#include <descrip.h>
+#include <ctype.h>
+#if __DECC
+#include <lbr$routines.h>
+#endif
+
+#define uppercasify(str) {char *str1; for (str1 = str; *str1; str1++) *str1 = _toupper(*str1);}
+
+#define LBR$_KEYNOTFND 2527330 /* This isn't in any .h file anywhere so I got it from a MACRO library */
+
+time_t
+ar_member_date (name)
+ char *name;
+{
+ static char *arname;
+ static char *memname;
+ char *p,*q;
+ long int val;
+ static struct {
+ struct mhddef mhd;
+ struct credef cre;
+ char garbage[256];
+ } buf;
+ int func=LBR$C_READ,
+ type=LBR$C_TYP_OBJ,
+ rfa[2],
+ lidx,
+ status;
+ $DESCRIPTOR(bufdesc,(char *)&buf);
+ $DESCRIPTOR(libdesc,arname);
+ $DESCRIPTOR(moddesc,memname);
+
+ /* This "file" is an archive member. */
+ p = index (name, '(');
+ arname = savestring (name, p - name);
+ val = strlen (p) - 2;
+/*
+ if (val > 15)
+ val = 15;
+*/
+ memname = savestring (p + 1, val);
+#ifdef OLDWAY
+ p = rindex (memname, ')');
+ if (p != 0) {
+ q = rindex(p,'.');
+ if (q)
+ *q = '\0'; /* to get rid of extension */
+ }
+#endif
+
+ q = rindex(memname,'.');
+ if (q)
+ *q = '\0'; /* to get rid of extension */
+
+ uppercasify(memname);
+
+ /* Make sure we know the modtime of the archive itself because
+ we are likely to be called just before commands to remake a
+ member are run, and they will change the archive itself. */
+ (void) f_mtime (enter_file (arname));
+
+ libdesc.dsc$a_pointer = arname;
+ libdesc.dsc$w_length = strlen(arname);
+ moddesc.dsc$a_pointer = memname;
+ moddesc.dsc$w_length = strlen(memname);
+
+ if (!((status = lbr$ini_control(&lidx,&func,&type,0)) & 1)) {
+ printf("Error in lbr$ini_control, %d\n",status);
+ return(-1);
+ }
+
+ if (!((status = lbr$open(&lidx,&libdesc,0,0,0,0,0)) & 1)) {
+ printf("Error opening library %s to lookup member %s, %d\n",arname, memname ,status);
+ return(-1);
+ }
+
+ if (!((status = lbr$lookup_key(&lidx,&moddesc,rfa)) & 1)) {
+ if (status != LBR$_KEYNOTFND)
+ printf("Error looking up module %s in library %s, %d\n",memname, arname ,status);
+ lbr$close(&lidx);
+ return(-1);
+ }
+
+ if (!((status = lbr$set_module(&lidx,rfa,&bufdesc,&bufdesc,0)) & 1)) {
+ printf("Error getting module info, %d\n",status);
+ lbr$close(&lidx);
+ return(-1);
+ }
+
+ lbr$close(&lidx);
+
+ val = SHELL$FIX_TIME(&buf.mhd.mhd$l_datim);
+
+ free (arname);
+ free (memname);
+ return (val <= 0 ? (time_t) -1 : (time_t) val);
+}
+
+#else
-static long int ar_member_date_1 ();
+static long int ar_member_date_1 PARAMS ((int desc, char *mem, int truncated, long int hdrpos,
+ long int datapos, long int size, long int date, int uid, int gid, int mode, char *name));
/* Return the modtime of NAME. */
@@ -127,9 +232,19 @@ ar_member_date_1 (desc, mem, truncated,
{
return ar_name_equal (name, mem, truncated) ? date : 0;
}
+#endif /* !VMS */
/* Set the archive-member NAME's modtime to now. */
+#ifdef VMS
+int
+ar_touch (name)
+ char *name;
+{
+ error ("touch archive member is not available on VMS");
+ return -1;
+}
+#else
int
ar_touch (name)
char *name;
@@ -182,6 +297,7 @@ ar_touch (name)
return val;
}
+#endif /* !VMS */
/* State of an `ar_glob' run, passed to `ar_glob_match'. */