home *** CD-ROM | disk | FTP | other *** search
- diff +context=2 +new-file diff/analyze.c diff.new/analyze.c
- *** diff/analyze.c Sun Jan 6 10:05:10 1991
- --- diff.new/analyze.c Sat Jan 26 07:08:54 1991
- ***************
- *** 23,26 ****
- --- 23,32 ----
-
- #include "diff.h"
- + #if defined(DEBUG)
- + #undef DEBUG
- + #define DEBUG(x) x
- + #else
- + #define DEBUG(x)
- + #endif
-
- struct change *find_change ();
- ***************
- *** 729,733 ****
- /* See if the two named files are actually the same physical file.
- If so, we know they are identical without actually reading them. */
- !
- if (output_style != OUTPUT_IFDEF
- && filevec[0].stat.st_ino == filevec[1].stat.st_ino
- --- 735,739 ----
- /* See if the two named files are actually the same physical file.
- If so, we know they are identical without actually reading them. */
- ! #if !defined(MSDOS)
- if (output_style != OUTPUT_IFDEF
- && filevec[0].stat.st_ino == filevec[1].stat.st_ino
- ***************
- *** 734,738 ****
- && filevec[0].stat.st_dev == filevec[1].stat.st_dev)
- return 0;
- !
- binary = read_files (filevec);
-
- --- 740,744 ----
- && filevec[0].stat.st_dev == filevec[1].stat.st_dev)
- return 0;
- ! #endif /* MSDOS */
- binary = read_files (filevec);
-
- diff +context=2 +new-file diff/diff.c diff.new/diff.c
- *** diff/diff.c Sun Jan 6 10:53:24 1991
- --- diff.new/diff.c Sat Jan 26 07:08:54 1991
- ***************
- *** 26,30 ****
- --- 26,37 ----
- #include "getopt.h"
-
- + #if defined(DEBUG)
- + #undef DEBUG
- + #define DEBUG(x) x
- + #else
- + #define DEBUG(x)
- + #endif
-
- +
- /* Nonzero for -r: if comparing two directories,
- compare their common subdirectories recursively. */
- ***************
- *** 447,451 ****
- int errorcount = 0;
- int stat_result[2];
- !
- /* If this is directory comparison, perhaps we have a file
- that exists only in one of the directories.
- --- 454,459 ----
- int errorcount = 0;
- int stat_result[2];
- ! DEBUG(fprintf(stderr,"compare_files(%s,%s,%s,%s,%d)\n",
- ! dir0,name0,dir1,name1,depth);fflush(stderr);)
- /* If this is directory comparison, perhaps we have a file
- that exists only in one of the directories.
- ***************
- *** 506,510 ****
- }
- }
- !
- /* See if the two named files are actually the same physical file.
- If so, we know they are identical without actually reading them. */
- --- 514,518 ----
- }
- }
- ! #if !defined(MSDOS)
- /* See if the two named files are actually the same physical file.
- If so, we know they are identical without actually reading them. */
- ***************
- *** 519,523 ****
- goto done;
- }
- !
- if (name0 == 0)
- inf[0].dir_p = inf[1].dir_p;
- --- 527,531 ----
- goto done;
- }
- ! #endif
- if (name0 == 0)
- inf[0].dir_p = inf[1].dir_p;
- diff +context=2 +new-file diff/diff3.c diff.new/diff3.c
- *** diff/diff3.c Sun Jan 6 10:58:12 1991
- --- diff.new/diff3.c Wed Mar 13 04:00:46 1991
- ***************
- *** 48,52 ****
- --- 48,57 ----
-
- #else /* not USG */
- + #ifndef MSDOS
- #include <sys/wait.h>
- + #else
- + #include <fcntl.h>
- + #include <std.h>
- + #endif
- #endif /* not USG */
-
- ***************
- *** 231,235 ****
- --- 236,244 ----
- VOID *xrealloc ();
-
- + #ifndef MSDOS
- char diff_program[] = DIFF_PROGRAM;
- + #else
- + #define diff_program "diff"
- + #endif
-
- /*
- ***************
- *** 1166,1169 ****
- --- 1175,1179 ----
- }
-
- + #ifndef MSDOS
- char *
- read_diff (filea, fileb, output_placement)
- ***************
- *** 1241,1245 ****
- --- 1251,1319 ----
- return diff_result + total;
- }
- + #else
- + char *
- + addstr(char *oldstr,char *newstr) {
- + int oldlen;
- + if(oldstr == NULL) {
- + oldstr = xmalloc(strlen(newstr)+1);
- + strcpy(oldstr,newstr);
- + } else {
- + oldlen = strlen(oldstr);
- + oldstr = xrealloc(oldstr,oldlen+strlen(newstr)+2);
- + strcat(oldstr," ");
- + strcat(oldstr,newstr);
- + }
- + return oldstr;
- + }
- +
- + char *
- + read_diff (filea, fileb, output_placement)
- + char *filea, *fileb;
- + char **output_placement;
- + {
- + char *diff_result;
- + int current_chunk_size;
- + int bytes;
- + int total;
- + char *buf = NULL;
- + char *tmpname,tmpbuf[16];
- + int diff_output;
- + strcpy(tmpbuf,"XXXXXX");
- + tmpname = mktemp(tmpbuf);
- + buf = addstr(buf,diff_program);
- + if (always_text)
- + buf = addstr(buf,"-a");
- + buf = addstr(buf,"--");
- + buf = addstr(buf,filea);
- + buf = addstr(buf,fileb);
- + buf = addstr(buf,">");
- + buf = addstr(buf,tmpname);
- + system(buf);
- + free(buf);
- + if((diff_output = open(tmpname,O_RDONLY)) == -1)
- + fatal ("Subsidiary diff failed");
- +
- + current_chunk_size = DIFF_CHUNK_SIZE;
- + diff_result = (char *) xmalloc (current_chunk_size);
- + total = 0;
- + do {
- + bytes = myread (diff_output,
- + diff_result + total,
- + current_chunk_size - total);
- + total += bytes;
- + if (total == current_chunk_size)
- + diff_result = (char *) xrealloc (diff_result, (current_chunk_size *= 2));
- + } while (bytes);
- +
- + if (total != 0 && diff_result[total-1] != '\n')
- + fatal ("bad diff format; incomplete last line");
- +
- + *output_placement = diff_result;
-
- + close(diff_output);
- + unlink(tmpname);
- + return diff_result + total;
- + }
- + #endif
-
- /*
- diff +context=2 +new-file diff/dir.h diff.new/dir.h
- *** diff/dir.h
- --- diff.new/dir.h Sat Mar 9 09:20:32 1991
- ***************
- *** 0 ****
- --- 1,36 ----
- + /*
- + * @(#)msd_dir.h 1.4 87/11/06 Public Domain.
- + *
- + * A public domain implementation of BSD directory routines for
- + * MS-DOS. Written by Michael Rendell ({uunet,utai}michael@garfield),
- + * August 1897
- + */
- +
- + #define rewinddir(dirp) seekdir(dirp, 0L)
- +
- + #define MAXNAMLEN 12
- +
- + struct direct {
- + int d_ino; /* a bit of a farce */
- + int d_reclen; /* more farce */
- + int d_namlen; /* length of d_name */
- + char d_name[MAXNAMLEN + 1]; /* guarentee null termination */
- + };
- +
- + struct _dircontents {
- + char *_d_entry;
- + struct _dircontents *_d_next;
- + };
- +
- + typedef struct _dirdesc {
- + int dd_id; /* uniquely identify each open directory */
- + long dd_loc; /* where we are in directory entry is this */
- + struct _dircontents *dd_contents; /* pointer to contents of dir */
- + struct _dircontents *dd_cp; /* pointer to current position */
- + } DIR;
- +
- + extern DIR *opendir(const char *name);
- + extern struct direct *readdir(DIR *dirp);
- + extern void seekdir(DIR *dirp,long off);
- + extern long telldir(DIR *dirp);
- + extern void closedir(DIR *dirp);
- diff +context=2 +new-file diff/getopt.c diff.new/getopt.c
- *** diff/getopt.c Thu Nov 29 08:21:40 1990
- --- diff.new/getopt.c Sat Jan 26 07:08:56 1991
- ***************
- *** 70,74 ****
-
- char *getenv ();
- - char *malloc ();
- #endif
-
- --- 70,73 ----
- ***************
- *** 249,253 ****
- getopt (argc, argv, optstring)
- int argc;
- ! char **argv;
- CONST char *optstring;
- {
- --- 248,252 ----
- getopt (argc, argv, optstring)
- int argc;
- ! CONST char **argv;
- CONST char *optstring;
- {
- diff +context=2 +new-file diff/getopt.h diff.new/getopt.h
- *** diff/getopt.h Thu Nov 29 08:21:40 1990
- --- diff.new/getopt.h Sat Jan 26 07:09:06 1991
- ***************
- *** 89,93 ****
-
- #ifdef __STDC__
- ! int getopt (int argc, char **argv, const char *shortopts);
- int getopt_long (int argc, char **argv, const char *shortopts,
- const struct option *longopts, int *longind);
- --- 89,93 ----
-
- #ifdef __STDC__
- ! int getopt (int argc, const char **argv, const char *shortopts);
- int getopt_long (int argc, char **argv, const char *shortopts,
- const struct option *longopts, int *longind);
- diff +context=2 +new-file diff/io.c diff.new/io.c
- *** diff/io.c Thu Nov 29 08:15:42 1990
- --- diff.new/io.c Sun Jan 27 06:13:22 1991
- ***************
- *** 20,23 ****
- --- 20,30 ----
- #include "diff.h"
-
- + #if defined(DEBUG)
- + #undef DEBUG
- + #define DEBUG(x) x
- + #else
- + #define DEBUG(x)
- + #endif
- +
- /* Rotate a value n bits to the left. */
- #define UINT_BIT (sizeof (unsigned) * CHAR_BIT)
- ***************
- *** 89,92 ****
- --- 96,100 ----
- slurp ()
- {
- + DEBUG(fprintf(stderr,"slurp(%s) ",current->name);fflush(stderr);)
- /* If we have a nonexistent file at this stage, treat it as empty. */
- if (current->desc < 0)
- ***************
- *** 105,111 ****
- {
- current->bufsize = current->stat.st_size;
- current->buffer = (char *) xmalloc (current->bufsize + 2);
- current->buffered_chars
- ! = read (current->desc, current->buffer, current->bufsize);
- if (current->buffered_chars < 0)
- pfatal_with_name (current->name);
- --- 113,122 ----
- {
- current->bufsize = current->stat.st_size;
- + DEBUG(fprintf(stderr," Regular file %ld bytes ",
- + current->stat.st_size);)
- current->buffer = (char *) xmalloc (current->bufsize + 2);
- current->buffered_chars
- ! = readcr (current->desc, current->buffer, current->bufsize);
- ! DEBUG(fprintf(stderr," -- %ld bytes read\n",current->buffered_chars);)
- if (current->buffered_chars < 0)
- pfatal_with_name (current->name);
- ***************
- *** 114,118 ****
- {
- int cc;
- !
- current->bufsize = 4096;
- current->buffer = (char *) xmalloc (current->bufsize + 2);
- --- 125,129 ----
- {
- int cc;
- ! DEBUG(fprintf(stderr,"Not a regular file -- reading in chunks ");)
- current->bufsize = 4096;
- current->buffer = (char *) xmalloc (current->bufsize + 2);
- ***************
- *** 121,125 ****
- /* Not a regular file; read it in a little at a time, growing the
- buffer as necessary. */
- ! while ((cc = read (current->desc,
- current->buffer + current->buffered_chars,
- current->bufsize - current->buffered_chars))
- --- 132,136 ----
- /* Not a regular file; read it in a little at a time, growing the
- buffer as necessary. */
- ! while ((cc = readcr (current->desc,
- current->buffer + current->buffered_chars,
- current->bufsize - current->buffered_chars))
- ***************
- *** 134,137 ****
- --- 145,149 ----
- }
- }
- + DEBUG(fprintf(stderr,"read %d bytes\n",current->buffered_chars);)
- if (cc < 0)
- pfatal_with_name (current->name);
- diff +context=2 +new-file diff/makefile.pc diff.new/makefile.pc
- *** diff/makefile.pc
- --- diff.new/makefile.pc Wed Mar 13 03:45:02 1991
- ***************
- *** 0 ****
- --- 1,47 ----
- + CC=gcc
- + CFLAGS = -DMSDOS -v -O -g
- + prefix=
- +
- + .SUFFIXES: .od .o .c
- + .c.o:
- + $(CC) $(CFLAGS) -c $< -o $*.o
- + .c.od:
- + $(CC) $(CFLAGS) -c -g $< -o $*.od
- +
- + # All source files
- + srcs=diff.c analyze.c io.c context.c ed.c normal.c ifdef.c util.c dir.c \
- + version.c diff.h regex.c regex.h limits.h diff3.c \
- + getopt.c getopt1.c getopt.h alloca.c
- + # Object files for diff only.
- + O1=diff.od analyze.o io.o context.o \
- + ed.o normal.o util.o dir.o
- +
- + O2=regex.o ifdef.o version.o \
- + getopt.o getopt1.o
- +
- + MSOBJ = msd_dir.o strlwr.o stat.o
- +
- + objs = $(O1) $(O2) $(MSOBJ)
- +
- + all: diff diff3
- +
- + diff3: diff3.o
- + $(CC) -o diff3 $(CFLAGS) $(LDFLAGS) diff3.o $(LIBS)
- +
- +
- + diff : $(objs) _obj
- + $(CC) $(CFLAGS) -o $@ @_obj
- +
- +
- + _obj : makefile
- + echo $(O1) > $@
- + echo $(O2) >> $@
- + echo $(MSOBJ) >> $@
- +
- + $(objs): diff.h
- +
- + context.o diff.o: regex.h
- +
- + clean:
- + rm -f *.o diff diff3 diff.tar diff.tar.Z
- +
- diff +context=2 +new-file diff/msd_dir.c diff.new/msd_dir.c
- *** diff/msd_dir.c
- --- diff.new/msd_dir.c Sat Mar 9 09:17:14 1991
- ***************
- *** 0 ****
- --- 1,167 ----
- + /*
- + * @(#)msd_dir.c 1.4 87/11/06 Public Domain.
- + *
- + * A public domain implementation of BSD directory routines for
- + * MS-DOS. Written by Michael Rendell ({uunet,utai}michael@garfield),
- + * August 1897
- + *
- + * modified for use with GCC for DOS December 1990
- + * williams@umaxc.weeg.uiowa.edu
- + */
- +
- + #include <stdlib.h>
- + #include <sys/types.h>
- + #include <sys/stat.h>
- + #include <sys/file.h>
- + #include <sys/dir.h>
- + #include <fcntl.h>
- + #include <errno.h>
- + #include <time.h>
- + #include <dir.h>
- + #include <string.h>
- +
- + #ifndef NULL
- + # define NULL 0
- + #endif /* NULL */
- +
- + #ifndef MAXPATHLEN
- + # define MAXPATHLEN 255
- + #endif /* MAXPATHLEN */
- +
- + /* attribute stuff */
- + #define A_RONLY 0x01
- + #define A_HIDDEN 0x02
- + #define A_SYSTEM 0x04
- + #define A_LABEL 0x08
- + #define A_DIR 0x10
- + #define A_ARCHIVE 0x20
- +
- + #define Newisnull(a, t) ((a = (t *) malloc(sizeof(t))) == (t *) NULL)
- + /* #define ATTRIBUTES (A_DIR | A_HIDDEN | A_SYSTEM) */
- + #define ATTRIBUTES (A_RONLY | A_SYSTEM | A_DIR)
- +
- + static char *getdirent();
- + static void free_dircontents();
- +
- + static struct ffblk dtabuf;
- + static struct ffblk *dtapnt = &dtabuf;
- +
- + static int _dos_errno;
- +
- +
- + DIR *
- + opendir(const char *name)
- + {
- + struct stat statb;
- + DIR *dirp;
- + char c;
- + char *s;
- + struct _dircontents *dp;
- + char nbuf[MAXPATHLEN + 1];
- +
- + if (stat(name, &statb) < 0 || (statb.st_mode & S_IFMT) != S_IFDIR)
- + return (DIR *) NULL;
- + if (Newisnull(dirp, DIR))
- + return (DIR *) NULL;
- + if (*name && (c = name[strlen(name) - 1]) != '\\' && c != '/')
- + (void) strcat(strcpy(nbuf, name), "\\*.*");
- + else
- + (void) strcat(strcpy(nbuf, name), "*.*");
- + dirp->dd_loc = 0;
- +
- + dirp->dd_contents = dirp->dd_cp = (struct _dircontents *) NULL;
- + if ((s = getdirent(nbuf)) == (char *) NULL)
- + return dirp;
- + do {
- + if (Newisnull(dp, struct _dircontents) || (dp->_d_entry =
- + malloc((unsigned) (strlen(s) + 1))) == (char *) NULL)
- + {
- + if (dp)
- + free((char *) dp);
- + free_dircontents(dirp->dd_contents);
- + return (DIR *) NULL;
- + }
- + if (dirp->dd_contents)
- + dirp->dd_cp = dirp->dd_cp->_d_next = dp;
- + else
- + dirp->dd_contents = dirp->dd_cp = dp;
- + (void) strcpy(dp->_d_entry, s);
- + dp->_d_next = (struct _dircontents *) NULL;
- + } while ((s = getdirent((char *) NULL)) != (char *) NULL);
- + dirp->dd_cp = dirp->dd_contents;
- +
- + return dirp;
- + }
- +
- + void
- + closedir(DIR *dirp)
- + {
- + free_dircontents(dirp->dd_contents);
- + free((char *) dirp);
- + }
- +
- + struct direct *
- + readdir(DIR *dirp)
- + {
- + static struct direct dp;
- +
- + if (dirp->dd_cp == (struct _dircontents *) NULL)
- + return (struct direct *) NULL;
- + dp.d_namlen = dp.d_reclen =
- + strlen(strcpy(dp.d_name, dirp->dd_cp->_d_entry));
- + strlwr(dp.d_name); /* JF */
- + dp.d_ino = 0;
- + dirp->dd_cp = dirp->dd_cp->_d_next;
- + dirp->dd_loc++;
- +
- + return &dp;
- + }
- +
- + void
- + seekdir(DIR *dirp, long off)
- + {
- + long i = off;
- + struct _dircontents *dp;
- +
- + if (off < 0)
- + return;
- + for (dp = dirp->dd_contents ; --i >= 0 && dp ; dp = dp->_d_next)
- + ;
- + dirp->dd_loc = off - (i + 1);
- + dirp->dd_cp = dp;
- + }
- +
- + long
- + telldir(DIR *dirp)
- + {
- + return dirp->dd_loc;
- + }
- +
- + static void
- + free_dircontents(struct _dircontents *dp)
- + {
- + struct _dircontents *odp;
- +
- + while (dp) {
- + if (dp->_d_entry)
- + free(dp->_d_entry);
- + dp = (odp = dp)->_d_next;
- + free((char *) odp);
- + }
- + }
- +
- + static char *
- + getdirent(char *dir)
- + {
- + int rval;
- + if (dir != (char *) NULL) { /* get first entry */
- + rval = findfirst(dir,dtapnt,ATTRIBUTES);
- + } else { /* get next entry */
- + rval = findnext(dtapnt);
- + }
- + if(rval != 0)
- + return (char *) NULL;
- +
- + return dtabuf.ff_name;
- + }
- +
- diff +context=2 +new-file diff/stat.c diff.new/stat.c
- *** diff/stat.c
- --- diff.new/stat.c Fri Feb 8 06:19:12 1991
- ***************
- *** 0 ****
- --- 1,248 ----
- + #include <sys/types.h>
- + #include <sys/stat.h>
- + #include <sys/file.h>
- + #include <sys/dir.h>
- + #include <stdlib.h>
- + #include <fcntl.h>
- + #include <errno.h>
- + #include <time.h>
- + #include <dir.h>
- +
- + #if defined(DEBUG)
- + #undef DEBUG
- + #define DEBUG(x) x
- + #else
- + #define DEBUG(x)
- + #endif
- +
- + /* attribute stuff */
- + #define A_RONLY 0x01
- + #define A_HIDDEN 0x02
- + #define A_SYSTEM 0x04
- + #define A_LABEL 0x08
- + #define A_DIR 0x10
- + #define A_ARCHIVE 0x20
- + #define A_ALL (A_HIDDEN|A_SYSTEM|A_DIR)
- +
- + int
- + _mjd(int year, int month, int day)
- + {
- + unsigned long int today;
- +
- + if ((month == 1) || (month == 2)) {
- + month += 12;
- + year -= 1;
- + }
- +
- + today = (unsigned) ((36525 * year) / 100)
- + + (unsigned) (year / 400)
- + - (unsigned) (year / 100)
- + + (unsigned) ((3059 * (month - 2)) / 100)
- + + day
- + - 678912;
- +
- + return today;
- + }
- +
- + static time_t
- + _get_ftime(struct ffblk *f) {
- + union {
- + short time;
- + struct _file_time {
- + unsigned int seconds : 5;
- + unsigned int minutes : 6;
- + unsigned int hours : 5;
- + } ftime_parts;
- + } ftime;
- + union {
- + short date;
- + struct _file_date {
- + unsigned int day : 5;
- + unsigned int month : 4;
- + unsigned int year : 7;
- + } fdate_parts;
- + } fdate;
- + unsigned long int today;
- +
- + ftime.time = f->ff_ftime;
- + fdate.date = f->ff_fdate;
- +
- + #define year (fdate.fdate_parts.year + 1980)
- + #define month (fdate.fdate_parts.month)
- + #define day (fdate.fdate_parts.day)
- + #define hour (ftime.ftime_parts.hours)
- + #define minute (ftime.ftime_parts.minutes)
- + #define second (ftime.ftime_parts.seconds * 2)
- +
- + today = _mjd(year, month, day) - _mjd(1970, 1, 1);
- +
- + return ((today * 24 + hour) * 60 + minute) * 60 + second;
- + }
- +
- + static __inline__ int
- + _dos_get_device_information(int handle)
- + {
- + int result;
- +
- + asm volatile("
- + movw %1,%%bx
- + movw %2,%%ax
- + int $0x21
- + jnc 0f
- + movl $-1,%0
- + jmp 1f
- + 0:
- + movl %%edx,%0
- + 1:"
- + : "=r"(result)
- + : "g"((unsigned short) handle), "i"(0x4400)
- + : "ax", "bx", "dx");
- +
- + return result;
- + }
- +
- + static __inline__ int
- + _dos_open(char *path, int attributes)
- + {
- + int result;
- +
- + asm volatile("
- + movl %1,%%edx
- + movb %2,%%al
- + movb %3,%%ah
- + int $0x21
- + jnc 0f
- + movl $-1,%0
- + jmp 1f
- + 0:
- + movzwl %%ax,%0
- + 1:"
- + : "=r"(result)
- + : "g"(path), "g"((unsigned char) attributes), "i"(0x3d)
- + : "ax", "dx");
- +
- + return result;
- + }
- +
- + static __inline__ int
- + _dos_close(int handle)
- + {
- + register int result;
- +
- + asm volatile("
- + movw %1,%%bx
- + movb %2,%%ah
- + int $0x21
- + jnc 0f
- + movl $-1,%0
- + jmp 1f
- + 0:
- + movl $0,%1
- + 1:"
- + : "=r"(result)
- + : "g"((unsigned short) handle), "i"(0x3e)
- + : "ax", "bx");
- +
- + return result;
- + }
- +
- + int
- + stat(const char *name,struct stat *sbuf) {
- + int result;
- + int fd,dos_att;
- + struct ffblk dos_info;
- + DEBUG(fprintf(stderr,"stat(%s)\n",name); fflush(stderr);)
- + /*
- + ** find out file information
- + */
- + result = findfirst(name,&dos_info,A_ALL);
- + DEBUG(fprintf(stderr,"findfirst(%s,%p,%02x) = %d\n",
- + name,&dos_info,A_ALL);)
- + if(result == -1)
- + return -1;
- + DEBUG(fprintf(stderr,"%02x %04x %04x %08ld %s\n",
- + dos_info.ff_attrib,dos_info.ff_ftime,dos_info.ff_fdate,
- + dos_info.ff_fsize,dos_info.ff_name);)
- +
- + /*
- + ** fill in fields that don't mean anything under DOS
- + */
- + sbuf->st_dev = sbuf->st_ino = sbuf->st_uid =
- + sbuf->st_gid = sbuf->st_rdev = 0;
- + sbuf->st_nlink = 1;
- +
- + /*
- + ** fill in size
- + */
- + sbuf->st_size = *((long *)&dos_info.ff_fsize);
- +
- + /*
- + ** fill in mod time
- + */
- + sbuf->st_atime =
- + sbuf->st_mtime =
- + sbuf->st_ctime = _get_ftime(&dos_info);
- +
- + sbuf->st_mode = 0;
- +
- + if((dos_info.ff_attrib & A_DIR) != 0)
- + sbuf->st_mode |= S_IFDIR;
- + else {
- + /*
- + ** if not a directory, then either a device or a real file.
- + */
- + fd = _dos_open(name,0);
- + if(fd == -1)
- + return -1;
- +
- + dos_att = _dos_get_device_information(fd);
- +
- + _dos_close(fd);
- + if((dos_att & 0x80) == 0)
- + sbuf->st_mode |= S_IFREG;
- + else
- + sbuf->st_mode |= S_IFCHR;
- + }
- +
- + /*
- + ** set access rights
- + */
- + if((dos_info.ff_attrib & A_RONLY) != 0)
- + sbuf->st_mode |= 0444;
- + else
- + sbuf->st_mode |= 0666;
- +
- + return 0;
- + }
- +
- + #if defined(TEST)
- + void
- + info(char *name) {
- + struct stat statbuf;
- + if(stat(name,&statbuf) == -1) {
- + perror(name);
- + return;
- + }
- + printf("%s : %ld bytes %s ",name,statbuf.st_size,
- + asctime(localtime(&statbuf.st_mtime)));
- + switch((statbuf.st_mode & S_IFMT)) {
- + case S_IFDIR:
- + printf("S_IFDIR\n"); break;
- + case S_IFCHR:
- + printf("S_IFCHR\n"); break;
- + case S_IFBLK:
- + printf("S_IFBLK\n"); break;
- + case S_IFREG:
- + printf("S_IFREG\n"); break;
- + }
- +
- + }
- +
- +
- + int
- + main(int argc,char **argv) {
- + while(--argc)
- + info(*++argv);
- + return 0;
- + }
- + #endif
- diff +context=2 +new-file diff/strlwr.c diff.new/strlwr.c
- *** diff/strlwr.c
- --- diff.new/strlwr.c Sat Jan 26 07:09:04 1991
- ***************
- *** 0 ****
- --- 1,17 ----
- + /* Library program for GCC on DOS-Extender
- +
- + (c) Copyright by Keisuke Yoshida, 1989, 1990 ver 1.00
- +
- + */
- +
- + #include <ctype.h>
- + #include <string.h>
- +
- + char *
- + strlwr(char *d)
- + {
- + char *s;
- + for (s=d; *s; s++)
- + *s = tolower(*s);
- + return d;
- + }
- diff +context=2 +new-file diff/util.c diff.new/util.c
- *** diff/util.c Sun Jan 6 10:14:14 1991
- --- diff.new/util.c Sat Jan 26 07:09:04 1991
- ***************
- *** 129,133 ****
- strcat (name, " ");
- strcat (name, name1);
- !
- if (paginate_flag)
- {
- --- 129,133 ----
- strcat (name, " ");
- strcat (name, name1);
- ! #if !defined(MSDOS)
- if (paginate_flag)
- {
- ***************
- *** 165,168 ****
- --- 165,169 ----
- }
- else
- + #endif /* MSDOS */
- {
-
- ***************
- *** 189,193 ****
- --- 190,196 ----
- {
- fclose (outfile);
- + #if !defined(MSDOS)
- wait (0);
- + #endif /* MSDOS */
- }
- }
- ***************
- *** 205,209 ****
- register char end_char = line_end_char;
- int savechar;
- -
- /* Check first for exact identity.
- If that is true, return 0 immediately.
- --- 208,211 ----
-