--- adv_cmds-147/md/md.c.orig 2017-12-29 19:30:19.505596072 +0100 +++ adv_cmds-147/md/md.c 2017-12-29 19:34:52.111156834 +0100 @@ -78,6 +78,8 @@ #include #include #include +#include +#include #define LINESIZE 65536 // NeXT_MOD @@ -100,6 +102,7 @@ } dep_files[1000]; int dep_file_index; +static int qsort_strcmp(a, b) struct dep *a, *b; { @@ -137,7 +140,14 @@ static void scan_mak(FILE *, FILE *, char *); static void finish_mak(FILE *, FILE *); +static int read_dep(register char *); +static void expunge_mak(register FILE *, register FILE *); +static void skip_mak(register FILE *, register FILE *); +static void output_dep(FILE *); +static void parse_dep(); +static void save_dot_o(); +int main(argc,argv) register char **argv; { @@ -152,7 +162,7 @@ if (*token++ != '-' || !*token) break; else { register int flag; - for ( ; flag = *token++ ; ) { + for ( ; (flag = *token++) ; ) { switch (flag) { case 'd': delete++; @@ -177,7 +187,7 @@ expunge++; break; case 'D': - for ( ; flag = *token++ ; ) + for ( ; (flag = *token++) ; ) switch (flag) { case 'c': D_contents++; @@ -227,7 +237,7 @@ exit(1); } else if (D_open) printf("%s: opened outfile \"%s\"\n", name, outfile); - } else if (mak = find_mak(makefile)) { + } else if ((mak = find_mak(makefile))) { makout = temp_mak(); out = makout; if (expunge) @@ -246,7 +256,7 @@ for (; argc--; argv++) { dep_file_index = 0; - if (size = read_dep(*argv)) { + if ((size = read_dep(*argv))) { save_dot_o(); if (D_depend) printf("%s: dot_o = \"%s\"\n", name, dot_o); @@ -269,6 +279,7 @@ } +int read_dep(file) register char *file; { @@ -294,7 +305,7 @@ switch(statbuf.st_mode & S_IFMT) { case S_IFREG: if (D_time) - printf("%s: file time = %d\n", name, statbuf.st_mtime); + printf("%s: file time = %ld\n", name, statbuf.st_mtime); if (statbuf.st_size > IObuffer) { fprintf(stderr, "%s: file \"%s\" tooo big for IObuffer\n", @@ -304,7 +315,7 @@ break; else if ((int) mak && statbuf.st_mtime < makstat.st_mtime) { if (verbose || D_time) - fprintf(stderr, "%s: skipping \"%s\" %d < %d \"%s\"\n", + fprintf(stderr, "%s: skipping \"%s\" %ld < %ld \"%s\"\n", name, file, statbuf.st_mtime, makstat.st_mtime, real_mak_name); goto out; @@ -345,6 +356,7 @@ return 0; } +static void save_dot_o() { register char *cp = file_array; @@ -355,6 +367,7 @@ *svp = 0; } +static void parse_dep() { register char *lp = file_array; @@ -381,7 +394,8 @@ cp = dep_line; lp[-1] = 0; /* skip .o file name */ - while ((c = *cp++) && c != ':'); if (!c) continue; + while ((c = *cp++) && c != ':'); + if (!c) continue; next_filename: i = 0; abspath = 0; @@ -415,7 +429,7 @@ if (abspath) *cp++ = '/'; for (c=0; c