*** dld.c.~1~ Mon Apr 15 17:56:07 1991 --- dld.c Mon Apr 15 18:12:35 1991 *************** *** 184,189 **** --- 184,192 ---- /* Count the number of global symbols referenced and not defined. */ int dld_undefined_sym_count = 0; + /* Where to look for files to link */ + char *dld_search_path = ":/usr/lib:/usr/local/lib"; + /* internal format of relocation info entry. */ struct dld_reloc_info { /* corresponding symbol table entry. */ *************** *** 1436,1441 **** --- 1439,1445 ---- } } /* perform_relocation */ + /* given a file name, create an appropriate file_entry for it */ static struct file_entry * make_entry (filename) *************** *** 1449,1458 **** (char *) _dld_malloc (strlen (filename) + 1); strcpy (entry->local_sym_name, filename); - if (filename[0] != '/') { - char name[MAXPATHLEN]; - entry->filename = concat (getwd(name), "/", filename); - } entry->chain = _dld_latest_entry; entry->ref_count = 1; return entry; --- 1453,1458 ---- *************** *** 1900,1906 **** return dld_errno; } ! _dld_latest_entry = make_entry (object_file); desc = file_open (_dld_latest_entry); --- 1900,1947 ---- return dld_errno; } ! if (object_file[0] != '/') { ! char name[MAXPATHLEN]; ! char *tname; ! ! if(dld_search_path && *dld_search_path) { ! char *path,*path_end; ! int len; ! int d; ! ! path=path_end=dld_search_path; ! for(;;) { ! path_end=index(path,':'); ! if(!path_end) ! len=strlen(path); ! else ! len=path_end-path; ! if(len) { ! strncpy(name,path,len); ! name[len]='\0'; ! } else ! getwd(name); ! ! tname=concat(name,"/",object_file); ! d=open(tname,0); ! if(d>=0) { ! close(d); ! break; ! } else ! free(tname); ! if(!path_end) { ! tname = concat (getwd(name), "/", object_file); ! break; ! } ! path=path_end+1; ! } ! } else ! tname = concat (getwd(name), "/", object_file); ! ! _dld_latest_entry = make_entry (tname); ! free(tname); ! } else ! _dld_latest_entry = make_entry (object_file); desc = file_open (_dld_latest_entry); *** error.c.~1~ Fri Jan 18 01:44:24 1991 --- error.c Fri Jan 18 02:20:12 1991 *************** *** 20,26 **** #include "defs.h" ! static char *errlst[] = { "Error 0", "cannot open file", /* 1 DLD_ENOFILE */ "bad magic number", /* 2 DLD_EBADMAGIC */ --- 20,27 ---- #include "defs.h" ! /* JF: Modified to be more like the standard system perror() */ ! const char *dld_errlst[] = { "Error 0", "cannot open file", /* 1 DLD_ENOFILE */ "bad magic number", /* 2 DLD_EBADMAGIC */ *************** *** 40,45 **** --- 41,47 ---- "undefined symbol" /* 16 DLD_EUNDEFSYM */ }; + const int dld_nerr = sizeof(dld_errlst)/sizeof(char *); /* Prints out the given string and the error message corresponding to dld_errno to the stderr. */ *************** *** 50,56 **** if (str) fprintf (stderr, "%s: ", str); ! if (dld_errno < 1 || dld_errno > sizeof (errlst)/sizeof (char *)) ! fprintf (stderr, "Unknown error.\n"); ! else fprintf (stderr, "%s.\n", errlst[dld_errno]); } /* dld_perror */ --- 52,58 ---- if (str) fprintf (stderr, "%s: ", str); ! if (dld_errno < 1 || dld_errno > dld_nerr) ! fprintf (stderr, "Unknown error(%d).\n",dld_errno); ! else fprintf (stderr, "%s.\n", dld_errlst[dld_errno]); } /* dld_perror */