summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
76886f3)
SCCS-vsn: old/make/defs 4.3
SCCS-vsn: old/make/dosys.c 4.3
SCCS-vsn: old/make/files.c 4.4
SCCS-vsn: old/make/main.c 4.2
#include <stdio.h>
#include <ctype.h>
#include <stdio.h>
#include <ctype.h>
+#include <sys/param.h>
+#include <ndir.h>
#define SHELLCOM "/bin/sh"
#define SHELLCOM "/bin/sh"
};
extern struct pattern *firstpat;
};
extern struct pattern *firstpat;
- struct opendir *nxtopendir;
- FILE * dirfc;
+ struct dirhdr *nxtopendir;
+ DIR *dirfc;
-extern struct opendir *firstod;
+extern struct dirhdr *firstod;
-static char *sccsid = "@(#)dosys.c 4.2 (Berkeley) 82/03/14";
+static char *sccsid = "@(#)dosys.c 4.3 (Berkeley) 82/04/20";
#include "defs"
#include <signal.h>
#include "defs"
#include <signal.h>
doclose() /* Close open directory files before exec'ing */
{
doclose() /* Close open directory files before exec'ing */
{
-register struct opendir *od;
+register struct dirhdr *od;
for (od = firstod; od; od = od->nxtopendir)
for (od = firstod; od; od = od->nxtopendir)
- if (od->dirfc != NULL)
- /* fclose(od->dirfc); */
- close(od->dirfc->_file);
+ if (od->dirfc != NULL) {
+ closedir(od->dirfc);
+ od->dirfc = NULL;
+ }
-static char *sccsid = "@(#)files.c 4.3 (Berkeley) 82/03/14";
+static char *sccsid = "@(#)files.c 4.4 (Berkeley) 82/04/20";
/* UNIX DEPENDENT PROCEDURES */
/* UNIX DEPENDENT PROCEDURES */
TIMETYPE exists(filename)
TIMETYPE exists(filename)
-#include <sys/dir.h>
-FSTATIC char n15[15];
-FSTATIC char *n15end = &n15[14];
+FSTATIC char nbuf[MAXNAMLEN + 1];
+FSTATIC char *nbufend = &nbuf[MAXNAMLEN];
int mkchain; /* nonzero if results to be remembered */
struct depblock *nextdbl; /* final value for chain */
{
int mkchain; /* nonzero if results to be remembered */
struct depblock *nextdbl; /* final value for chain */
{
register int i;
int nread, cldir;
char *dirname, *dirpref, *endir, *filepat, *p, temp[100];
char fullname[100], *p1, *p2;
struct nameblock *q;
struct depblock *thisdbl;
register int i;
int nread, cldir;
char *dirname, *dirpref, *endir, *filepat, *p, temp[100];
char fullname[100], *p1, *p2;
struct nameblock *q;
struct depblock *thisdbl;
-struct direct entry[32];
if(! unequal(dirname, od->dirn) )
{
dirf = od->dirfc;
if(! unequal(dirname, od->dirn) )
{
dirf = od->dirfc;
- fseek(dirf, 0L, 0); /* start over at the beginning */
+ if (dirf != NULL)
+ rewinddir(dirf); /* start over at the beginning */
break;
}
if(dirf == NULL)
{
break;
}
if(dirf == NULL)
{
- dirf = fopen(dirname, "r");
+ dirf = opendir(dirname);
if(nopdir >= MAXDIR)
cldir = YES;
else {
++nopdir;
if(nopdir >= MAXDIR)
cldir = YES;
else {
++nopdir;
od->nxtopendir = firstod;
firstod = od;
od->dirfc = dirf;
od->nxtopendir = firstod;
firstod = od;
od->dirfc = dirf;
+else for (dptr = readdir(dirf); dptr != NULL; dptr = readdir(dirf))
- nread = fread( (char *) &entry[0], sizeof(struct direct), 32, dirf) ;
- for(i=0; i<nread; ++i)
- if(entry[i].d_ino!= 0)
+ p1 = dptr->d_name;
+ p2 = nbuf;
+ while( (p2<nbufend) && (*p2++ = *p1++)!='\0' )
+ /* void */;
+ if( amatch(nbuf,filepat) )
+ {
+ concat(dirpref,nbuf,fullname);
+ if( (q=srchname(fullname)) ==0)
+ q = makename(copys(fullname));
+ if(mkchain)
- p1 = entry[i].d_name;
- p2 = n15;
- while( (p2<n15end) &&
- (*p2++ = *p1++)!='\0' );
- if( amatch(n15,filepat) )
- {
- concat(dirpref,n15,fullname);
- if( (q=srchname(fullname)) ==0)
- q = makename(copys(fullname));
- if(mkchain)
- {
- thisdbl = ALLOC(depblock);
- thisdbl->nxtdepblock = nextdbl;
- thisdbl->depname = q;
- nextdbl = thisdbl;
- }
- }
+ thisdbl = ALLOC(depblock);
+ thisdbl->nxtdepblock = nextdbl;
+ thisdbl->depname = q;
+ nextdbl = thisdbl;
if(endir != 0) *endir = '/';
if(endir != 0) *endir = '/';
-if(cldir)
- fclose(dirf);
+if(cldir) {
+ closedir(dirf);
+ dirf = NULL;
+}
TIMETYPE lookarch(filename)
char *filename;
{
TIMETYPE lookarch(filename)
char *filename;
{
-char *p, *q, *send, s[15];
+char *p, *q, *send, s[MAXNAMLEN + 1];
int i, nc, nsym, objarch;
for(p = filename; *p!= '(' ; ++p)
int i, nc, nsym, objarch;
for(p = filename; *p!= '(' ; ++p)
-static char *sccsid = "@(#)main.c 4.1 (Berkeley) 81/02/28";
+static char *sccsid = "@(#)main.c 4.2 (Berkeley) 82/04/20";
# include "defs"
/*
command make to update programs.
# include "defs"
/*
command make to update programs.
struct lineblock *sufflist = NULL;
struct varblock *firstvar = NULL;
struct pattern *firstpat = NULL;
struct lineblock *sufflist = NULL;
struct varblock *firstvar = NULL;
struct pattern *firstpat = NULL;
-struct opendir *firstod = NULL;
+struct dirhdr *firstod = NULL;
#include <signal.h>
int sigivalue = 0;
#include <signal.h>
int sigivalue = 0;
struct nameblock *p;
struct depblock *dp;
struct varblock *vp;
struct nameblock *p;
struct depblock *dp;
struct varblock *vp;
struct shblock *sp;
struct lineblock *lp;
struct shblock *sp;
struct lineblock *lp;
{
printf("Open directories:\n");
for (od = firstod; od; od = od->nxtopendir)
{
printf("Open directories:\n");
for (od = firstod; od; od = od->nxtopendir)
- printf("\t%d: %s\n", fileno(od->dirfc), od->dirn);
+ printf("\t%d: %s\n", od->dirfc->dd_fd, od->dirn);