static void make_editor_path(char *path /* must be at least NFILEN chars long */ ) { char temp[NFILEN], name[128], *s; UINT which = FL_PATH | FL_EXECABLE; if (strcmp(exec_pathname, ".")) which |= FL_EXECDIR; sprintf(name, "%s.exe", prognam); if ((s = cfg_locate(name, which)) != 0) { if (!(s[0] == '.' && s[1] == '\\')) { strcpy(path, sl_to_bsl(s)); return; } } /* lookup failed or path prefix was ".\", fall back on cwd */ if (_getcwd(temp, sizeof(temp)) == NULL) { /* getcwd failed, user must live with '.' . */ temp[0] = '.'; temp[1] = '\0'; } sprintf(path, "%s\\%s", sl_to_bsl(temp), name); }
static BUFFER * gettagsfile(int n, int *endofpathflagp, int *did_read) { #ifdef MDCHK_MODTIME time_t current; #endif char *tagsfile; BUFFER *tagbp; char tagbufname[NBUFN]; char tagfilename[NFILEN]; *endofpathflagp = FALSE; *did_read = FALSE; (void) lsprintf(tagbufname, TAGFILE_BufName, n + 1); /* is the buffer around? */ if ((tagbp = find_b_name(tagbufname)) == NULL) { char *tagf = global_b_val_ptr(VAL_TAGS); nth_name(tagfilename, tagf, n); if (!doglob(tagfilename) || tagfilename[0] == EOS) { *endofpathflagp = TRUE; return NULL; } /* look up the tags file */ tagsfile = cfg_locate(tagfilename, LOCATE_TAGS); /* if it isn't around, don't sweat it */ if (tagsfile == NULL) { return NULL; } /* find the pointer to that buffer */ if ((tagbp = bfind(tagbufname, BFINVS)) == NULL) { mlforce("[Can't create tags buffer]"); return NULL; } if (readin(tagsfile, FALSE, tagbp, FALSE) != TRUE) { zotbuf(tagbp); return NULL; } *did_read = TRUE; } #ifdef MDCHK_MODTIME /* * Re-read the tags buffer if we are checking modification-times and * find that the tags file's been changed. We check the global mode * value because it's too awkward to set the local mode value for a * scratch buffer. */ if (global_b_val(MDCHK_MODTIME) && get_modtime(tagbp, ¤t) && tagbp->b_modtime != current) { if (!*did_read && readin(tagbp->b_fname, FALSE, tagbp, FALSE) != TRUE) { zotbuf(tagbp); return NULL; } set_modtime(tagbp, tagbp->b_fname); *did_read = TRUE; } #endif b_set_invisible(tagbp); return tagbp; }
const char * getversion(void) { if (*version_string) return version_string; #if SYS_UNIX || SYS_VMS /* * We really would like to have the date at which this program was * linked, but a.out doesn't have that in general. COFF files do. * Getting the executable's modification-time is a reasonable * compromise. */ (void) lsprintf(version_string, "%s %s%s for %s", prognam, version, VILE_PATCHLEVEL, opersys); { char *s; if ((s = cfg_locate(prog_arg, (FL_EXECDIR | FL_PATH) | FL_EXECABLE)) != NULL) { time_t mtime = file_modified(s); if (mtime != 0) { (void) vl_strncat(version_string, ", installed ", NSTRING); (void) vl_strncat(version_string, ctime(&mtime), NSTRING); /* trim the newline */ version_string[strlen(version_string) - 1] = EOS; } } } #else # if SYS_MSDOS || SYS_OS2 || SYS_WINNT # if defined(__DATE__) && !SMALLER (void) lsprintf(version_string, "%s %s%s for %s, built %s %s with %s", prognam, version, VILE_PATCHLEVEL, opersys, __DATE__, __TIME__, # if CC_WATCOM "Watcom C/386" # endif # if CC_DJGPP # if __DJGPP__ >= 2 "DJGPP v2" # else "DJGPP" # endif # endif # if CC_TURBO # ifdef __BORLANDC__ "Borland C++" # else "Turbo C" # endif # endif # if CC_CSETPP # if __IBMC__ >= 300 "VisualAge C++" # else "IBM C Set ++" # endif # endif # if CC_LCC_WIN32 "Lcc-win32" # endif # if CC_MSVC "Visual C++" # endif # if __GNUC__ # if defined(__CYGWIN32__) "Cygwin gcc" # elif SYS_MINGW "MinGW gcc" # else "gcc" # endif # endif ); # endif # endif /* SYS_MSDOS || SYS_OS2 || SYS_WINNT */ #endif /* not SYS_UNIX or SYS_VMS */ return version_string; }