From 3c2fd1c8295928f8804a98dd1310d64920f13e29 Mon Sep 17 00:00:00 2001 From: anon Date: Fri, 11 Aug 2023 20:27:20 +0200 Subject: [PATCH] . --- README.md | 13 ++----------- src/build.c | 41 ++++++++++++++++++----------------------- src/crossref.c | 2 +- src/dir.c | 16 +++++++--------- src/display.c | 14 ++++++++++---- src/global.h | 4 ++-- src/help.c | 8 ++++---- src/invlib.c | 16 ++++++++-------- src/main.c | 48 ++++++++++++++++++++++++------------------------ src/opt.c | 2 +- src/vpinit.c | 2 +- 11 files changed, 78 insertions(+), 88 deletions(-) diff --git a/README.md b/README.md index d32c749..e7ab8e4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Csope -Fork of Cscope, with various improvements, because cscope is good and shall not be forgotten. +Fork of Cscope version 15.9, with various improvements, because cscope is good and shall not be forgotten. While the original's mainentence seems abandoned and as far as I can tell you need a PhD in autoconf to compile the latest version, Csope is alive and well. @@ -77,26 +77,16 @@ fixing it would have been a lost cause, if not for Cscope itself. Well, Csope no | help.c | all functions dealing with help messages | # TODO /*move soon*/ - + recursive macro function to assign KEY_\* default values; look for a new and shiny preprocessor? + sort out constants.h + scrollbar() uses magic int literals? + Ordering function declarations in global.h by alpha order is not smart + lineflagafterfile is stupid + library.h...; "private library", in a program using 90 globals; ffs + sort out the global hell - + changestring() forks sh to execute an ed script... + was there really ever a scrollbar? ## Original -+ Display the current case mode (^C) onscreen -+ emacs like key bindings - ^S for searching (^Y) - Up/dwn Arrow support Next/Prev field. ?? - Inline editing on Input fields ( ??^B/^F ) - ^X^C to quit ( ^Q ??) - Pagdwn/PageUp/+/- + Same capabilities as interactive in non interactive (one shot) mode + Provide some how-do-I-use-this-thing doc. -+ Replace invlib.[ch] by real database. Failing that, at least sanitize it. # BUGS @@ -104,6 +94,7 @@ fixing it would have been a lost cause, if not for Cscope itself. Well, Csope no free(): double free detected in tcache 2 Aborted + Changing text can crash without replacing text and leaving the console ncursed + + The wrong number of lines are bing printed # Future features / contributor wishlist + providing support for other languages by integrating new lexers (e.g. ctag's) diff --git a/src/build.c b/src/build.c index b2f83ad..6cdf98f 100644 --- a/src/build.c +++ b/src/build.c @@ -97,12 +97,10 @@ static bool samelist(FILE *oldrefs, char **names, int count); static void cannotindex(void) { - fprintf(stderr, "\ -cscope: cannot create inverted index; ignoring -q option\n"); + fprintf(stderr, PROGRAM_NAME ": cannot create inverted index; ignoring -q option\n"); invertedindex = false; errorsfound = true; - fprintf(stderr, "\ -cscope: removed files %s and %s\n", + fprintf(stderr, PROGRAM_NAME ": removed files %s and %s\n", newinvname, newinvpost); unlink(newinvname); unlink(newinvpost); @@ -232,7 +230,7 @@ build(void) /* or this is an unconditional build */ if ((oldrefs = vpfopen(reffile, "rb")) != NULL && unconditional == false - && fscanf(oldrefs, "cscope %d %" PATHLEN_STR "s", &fileversion, olddir) == 2 + && fscanf(oldrefs, PROGRAM_NAME " %d %" PATHLEN_STR "s", &fileversion, olddir) == 2 && (strcmp(olddir, currentdir) == 0 /* remain compatible */ || strcmp(olddir, newdir) == 0)) { /* get the cross-reference file's modification time */ @@ -267,15 +265,13 @@ build(void) } /* check the old and new option settings */ if (oldcompress != compress || oldtruncate != trun_syms) { - posterr("\ -cscope: -c or -T option mismatch between command line and old symbol database\n"); + posterr(PROGRAM_NAME ": -c or -T option mismatch between command line and old symbol database\n"); goto force; } if (oldinvertedindex != invertedindex) { - posterr("\ -cscope: -q option mismatch between command line and old symbol database\n"); + posterr(PROGRAM_NAME ": -q option mismatch between command line and old symbol database\n"); if (invertedindex == false) { - posterr("cscope: removed files %s and %s\n", + posterr(PROGRAM_NAME ": removed files %s and %s\n", invname, invpost); unlink(invname); unlink(invpost); @@ -285,7 +281,7 @@ cscope: -q option mismatch between command line and old symbol database\n"); /* seek to the trailer */ if (fscanf(oldrefs, "%ld", &traileroffset) != 1 || fseek(oldrefs, traileroffset, SEEK_SET) == -1) { - posterr("cscope: incorrect symbol database file format\n"); + posterr(PROGRAM_NAME ": incorrect symbol database file format\n"); goto force; } } @@ -324,14 +320,13 @@ cscope: -q option mismatch between command line and old symbol database\n"); outofdate: /* if the database format has changed, rebuild it all */ if (fileversion != FILEVERSION) { - fprintf(stderr, "\ -cscope: converting to new symbol database file format\n"); + fprintf(stderr, PROGRAM_NAME ": converting to new symbol database file format\n"); goto force; } /* reopen the old cross-reference file for fast scanning */ if ((symrefs = vpopen(reffile, O_BINARY | O_RDONLY)) == -1) { - postfatal("cscope: cannot open file %s\n", reffile); - /* falseTREACHED */ + postfatal(PROGRAM_NAME ": cannot open file %s\n", reffile); + /* NOTREACHED */ } /* get the first file name in the old cross-reference */ blocknumber = -1; @@ -345,8 +340,8 @@ cscope: converting to new symbol database file format\n"); } /* open the new cross-reference file */ if ((newrefs = myfopen(newreffile, "wb")) == NULL) { - postfatal("cscope: cannot open file %s\n", reffile); - /* falseTREACHED */ + postfatal(PROGRAM_NAME ": cannot open file %s\n", reffile); + /* NOTREACHED */ } if (invertedindex == true && (postings = myfopen(temp1, "wb")) == NULL) { cannotwrite(temp1); @@ -456,7 +451,7 @@ cscope: converting to new symbol database file format\n"); fclose(postings); snprintf(sortcommand, sizeof(sortcommand), "env LC_ALL=C sort -T %s %s", tmpdir, temp1); if ((postings = mypopen(sortcommand, "r")) == NULL) { - fprintf(stderr, "cscope: cannot open pipe to sort command\n"); + fprintf(stderr, PROGRAM_NAME ": cannot open pipe to sort command\n"); cannotindex(); } else { if ((totalterms = invmake(newinvname, newinvpost, postings)) > 0) { @@ -503,11 +498,11 @@ void seek_to_trailer(FILE *f) { if (fscanf(f, "%ld", &traileroffset) != 1) { - postfatal("cscope: cannot read trailer offset from file %s\n", reffile); + postfatal(PROGRAM_NAME ": cannot read trailer offset from file %s\n", reffile); /* falseTREACHED */ } if (fseek(f, traileroffset, SEEK_SET) == -1) { - postfatal("cscope: cannot seek to trailer in file %s\n", reffile); + postfatal(PROGRAM_NAME ": cannot seek to trailer in file %s\n", reffile); /* falseTREACHED */ } } @@ -549,7 +544,7 @@ void free_newbuildfiles(void) static void putheader(char *dir) { - dboffset = fprintf(newrefs, "cscope %d %s", FILEVERSION, dir); + dboffset = fprintf(newrefs, PROGRAM_NAME " %d %s", FILEVERSION, dir); if (compress == false) { dboffset += fprintf(newrefs, " -c"); } @@ -718,8 +713,8 @@ movefile(char *new, char *old) { unlink(old); if (rename(new, old) == -1) { - myperror("cscope"); - postfatal("cscope: cannot rename file %s to file %s\n", + myperror(PROGRAM_NAME); + postfatal(PROGRAM_NAME ": cannot rename file %s to file %s\n", new, old); /* falseTREACHED */ } diff --git a/src/crossref.c b/src/crossref.c index 255bdaf..0bc0c6c 100644 --- a/src/crossref.c +++ b/src/crossref.c @@ -486,7 +486,7 @@ void warning(char *text) { - (void) fprintf(stderr, "cscope: \"%s\", line %d: warning: %s\n", filename, + (void) fprintf(stderr, PROGRAM_NAME ": \"%s\", line %d: warning: %s\n", filename, myylineno, text); errorsfound = true; } diff --git a/src/dir.c b/src/dir.c index 67bda2b..1c0e981 100644 --- a/src/dir.c +++ b/src/dir.c @@ -93,7 +93,7 @@ makevpsrcdirs(void) } /* get the current directory name */ if (getcwd(currentdir, PATHLEN) == NULL) { - fprintf(stderr, "cscope: warning: cannot get current directory name\n"); + fprintf(stderr, PROGRAM_NAME ": warning: cannot get current directory name\n"); strcpy(currentdir, ""); } /* see if there is a view path and this directory is in it */ @@ -283,7 +283,7 @@ makefilelist(void) if ((s = inviewpath(file)) != NULL) { addsrcfile(s); } else { - fprintf(stderr, "cscope: cannot find file %s\n", + fprintf(stderr, PROGRAM_NAME ": cannot find file %s\n", file); errorsfound = true; } @@ -337,8 +337,7 @@ makefilelist(void) if (unfinished_option) { /* Can't have another option directly after an * -I or -p option with no name after it! */ - fprintf(stderr, "\ -cscope: Syntax error in namelist file %s: unfinished -I or -p option\n", + fprintf(stderr, PROGRAM_NAME ": Syntax error in namelist file %s: unfinished -I or -p option\n", namefile); unfinished_option = 0; } @@ -382,8 +381,7 @@ cscope: Syntax error in namelist file %s: unfinished -I or -p option\n", break; \ case 'p': /* file path components to display */ \ if (*(s) < '0' || *(s) > '9') { \ - fprintf(stderr, \ -"cscope: -p option in file %s: missing or invalid numeric value\n", \ + fprintf(stderr, "csope: -p option in file %s: missing or invalid numeric value\n", \ namefile); \ } \ dispcomponents = atoi(s); \ @@ -398,7 +396,7 @@ cscope: Syntax error in namelist file %s: unfinished -I or -p option\n", HANDLE_OPTION_ARGUMENT(i, s) break; default: - fprintf(stderr, "cscope: only -I, -c, -k, -p, and -T options can be in file %s\n", + fprintf(stderr, PROGRAM_NAME ": only -I, -c, -k, -p, and -T options can be in file %s\n", namefile); } /* switch(i) */ } /* if('-') */ @@ -437,7 +435,7 @@ cscope: Syntax error in namelist file %s: unfinished -I or -p option\n", if ((s = inviewpath(newpath)) != NULL) { addsrcfile(s); } else { - fprintf(stderr, "cscope: cannot find file %s\n", + fprintf(stderr, PROGRAM_NAME, ": cannot find file %s\n", newpath); errorsfound = true; } @@ -454,7 +452,7 @@ cscope: Syntax error in namelist file %s: unfinished -I or -p option\n", if ((s = inviewpath(path)) != NULL) { addsrcfile(s); } else { - fprintf(stderr, "cscope: cannot find file %s\n", + fprintf(stderr, PROGRAM_NAME ": cannot find file %s\n", path); errorsfound = true; } diff --git a/src/display.c b/src/display.c index b46ec7a..ea1ee80 100644 --- a/src/display.c +++ b/src/display.c @@ -170,10 +170,10 @@ dispinit(void) mode_window_height = LINES - input_window_height - 2 - 1; first_col_width = 48; // (((COLS - 2)%2 == 0) ? ((COLS-2)/2) : (((COLS-2)/2)+1)); second_col_width = COLS - 2 - 1 - first_col_width; //((COLS - 2) / 2) - 1; - mdisprefs = result_window_height - WRESULT_TABLE_BODY_START - 1 - 1 - 1; + mdisprefs = result_window_height - (WRESULT_TABLE_BODY_START + 1); if (mdisprefs <= 0) { - postfatal("%s: screen too small\n", argv0); + postfatal(PROGRAM_NAME ": screen too small\n"); /* NOTREACHED */ } if(mdisprefs > sizeof(dispchars)){ @@ -255,12 +255,18 @@ static inline void display_frame(const bool border_only){ const int LEFT_PADDING = 5; wmove(stdscr, 0, LEFT_PADDING); #if CCS - wprintw(stdscr, "cscope %s", ESG_REL); + wprintw(stdscr, PROGRAM_NAME " %s", ESG_REL); #else - wprintw(stdscr, "Cscope version %d%s", FILEVERSION, FIXVERSION); + wprintw(stdscr, PROGRAM_NAME " version %d%s", FILEVERSION, FIXVERSION); #endif wmove(stdscr, 0, COLS - (int)sizeof(helpstring) - 3); waddstr(stdscr, helpstring); + wmove(stdscr, LINES-1, 4); + if(caseless){ + waddstr(stdscr, "Case: ON"); + }else{ + waddstr(stdscr, "Case: OFF"); + } /* --- */ if(!border_only){ /* Vertical line */ diff --git a/src/global.h b/src/global.h index f1f7d7c..234900c 100644 --- a/src/global.h +++ b/src/global.h @@ -40,7 +40,6 @@ #define UNUSED(x) (void)(x) -//#include "config.h" #include #include #include @@ -116,11 +115,12 @@ extern char dicode2[]; /* digraph second character code */ ((0200 - 2) + dicode1[(unsigned char)(inchar1)] \ + dicode2[(unsigned char)(inchar2)]) +#define PROGRAM_NAME "Csope" + /* main.c global data */ extern char *editor, *home, *shell, *lineflag; /* environment variables */ extern char *home; /* Home directory */ extern bool lineflagafterfile; -extern char *argv0; /* command name */ extern bool compress; /* compress the characters in the crossref */ extern bool dbtruncated; /* database symbols truncated to 8 chars */ extern int dispcomponents; /* file path components to display */ diff --git a/src/help.c b/src/help.c index 20c662e..f58afa1 100644 --- a/src/help.c +++ b/src/help.c @@ -74,10 +74,10 @@ static char help_msg[] = "^F\t\tRecall next input field and search pattern.\n" "^C\t\tToggle ignore/use letter case when searching.\n" "^R\t\tRebuild the cross-reference.\n" - "!\t\tStart an interactive shell (type ^D to return to cscope).\n" + "!\t\tStart an interactive shell (type ^D to return).\n" "^L\t\tRedraw the screen.\n" "?\t\tDisplay this list of commands.\n" - "^D\t\tExit cscope.\n" + "^D\t\tExit the program.\n" "\nNote: If the first character of the pattern you want to search for matches\n" "a command, type a \\ character first.\n" "Note: Some ctrl keys may be occupied by your terminal configuration.\n" @@ -93,7 +93,7 @@ static char changeing_help_msg[] = "^A\t\tMark or unmark all lines to be changed.\n" "^D\t\tChange the marked lines and exit.\n" "ESC\t\tExit without changing the marked lines.\n" - "!\t\tStart an interactive shell (type ^D to return to cscope).\n" + "!\t\tStart an interactive shell (type ^D to return).\n" "^L\t\tRedraw the screen.\n" "?\t\tDisplay this list of commands.\n" ; @@ -122,7 +122,7 @@ void usage(void) { fputs( - "Usage: cscope [-bcCdehklLqRTuUvV] [-f file] [-F file] [-i file] [-I dir] [-s dir]\n" + "Usage: " PROGRAM_NAME " [-bcCdehklLqRTuUvV] [-f file] [-F file] [-i file] [-I dir] [-s dir]\n" " [-p number] [-P path] [-[0-8] pattern] [source files]\n", stderr ); diff --git a/src/invlib.c b/src/invlib.c index 32a9eaa..1691981 100644 --- a/src/invlib.c +++ b/src/invlib.c @@ -581,19 +581,19 @@ invopen(INVCONTROL *invcntl, char *invname, char *invpost, int stat) return(-1); } if (fread(&invcntl->param, sizeof(invcntl->param), 1, invcntl->invfile) == 0) { - fprintf(stderr, "%s: empty inverted file\n", argv0); + fprintf(stderr, PROGRAM_NAME ": empty inverted file\n"); fclose(invcntl->invfile); return(-1); } if (invcntl->param.version != FMTVERSION) { - fprintf(stderr, "%s: cannot read old index format; use -U option to force database to rebuild\n", argv0); + fprintf(stderr, PROGRAM_NAME ": cannot read old index format; use -U option to force database to rebuild\n"); fclose(invcntl->invfile); return(-1); } assert(invcntl->param.sizeblk == sizeof(t_logicalblk)); if (stat == 0 && invcntl->param.filestat == INVALONE) { - fprintf(stderr, "%s: inverted file is locked\n", argv0); + fprintf(stderr, PROGRAM_NAME ": inverted file is locked\n"); fclose(invcntl->invfile); return(-1); } @@ -636,7 +636,7 @@ invopen(INVCONTROL *invcntl, char *invname, char *invpost, int stat) if (shm_id != -1) { invcntl->iindex = shmat(shm_id, 0, ((read_index) ? 0 : SHM_RDONLY)); if (invcntl->iindex == (char *)ERR) { - fprintf(stderr, "%s: shared memory link failed\n", argv0); + fprintf(stderr, PROGRAM_NAME ": shared memory link failed\n"); invcntl->iindex = NULL; read_index = 1; } @@ -1187,18 +1187,18 @@ boolsave(int clear) /* flag about whether to clear core */ static void invcannotalloc(unsigned n) { - fprintf(stderr, "%s: cannot allocate %u bytes\n", argv0, n); + fprintf(stderr, PROGRAM_NAME ": cannot allocate %u bytes\n", n); } static void invcannotopen(char *file) { - fprintf(stderr, "%s: cannot open file %s\n", argv0, file); + fprintf(stderr, PROGRAM_NAME "%s: cannot open file %s\n", file); } static void invcannotwrite(char *file) { - perror(argv0); /* must be first to preserve errno */ - fprintf(stderr, "%s: write to file %s failed\n", argv0, file); + perror(PROGRAM_NAME); /* must be first to preserve errno */ + fprintf(stderr, PROGRAM_NAME ": write to file %s failed\n", file); } diff --git a/src/main.c b/src/main.c index 172edc8..b27140f 100644 --- a/src/main.c +++ b/src/main.c @@ -191,12 +191,12 @@ skiplist(FILE *oldrefs) int i; if (fscanf(oldrefs, "%d", &i) != 1) { - postfatal("cscope: cannot read list size from file %s\n", reffile); + postfatal(PROGRAM_NAME ": cannot read list size from file %s\n", reffile); /* falseTREACHED */ } while (--i >= 0) { if (fscanf(oldrefs, "%*s") != 0) { - postfatal("cscope: cannot read list name from file %s\n", reffile); + postfatal(PROGRAM_NAME ": cannot read list name from file %s\n", reffile); /* falseTREACHED */ } } @@ -260,7 +260,7 @@ static inline void linemode_event_loop(void){ /* print the total number of lines in * verbose mode */ if (verbosemode == true) - printf("cscope: %d lines\n", + printf(PROGRAM_NAME ": %d lines\n", totallines); while ((c = getc(refsfound)) != EOF) @@ -349,7 +349,7 @@ static inline void linemode_event_loop(void){ /* NOTREACHED */ break; default: - fprintf(stderr, "cscope: unknown command '%s'\n", buf); + fprintf(stderr, PROGRAM_NAME ": unknown command '%s'\n", buf); break; } } @@ -387,35 +387,34 @@ main(int argc, char **argv) /* XXX remove if/when clearerr() in dir.c does the right thing. */ if (namefile && strcmp(namefile, "-") == 0 && !buildonly) { - postfatal("cscope: Must use -b if file list comes from stdin\n"); + postfatal(PROGRAM_NAME ": Must use -b if file list comes from stdin\n"); /* falseTREACHED */ } /* make sure that tmpdir exists */ if (lstat (tmpdir, &stat_buf)) { - fprintf (stderr, - "cscope: Temporary directory %s does not exist or cannot be accessed\n", + fprintf (stderr, PROGRAM_NAME ": Temporary directory %s does not exist or cannot be accessed\n", tmpdir); fprintf (stderr, - "cscope: Please create the directory or set the environment variable\n" - "cscope: TMPDIR to a valid directory\n"); + PROGRAM_NAME ": Please create the directory or set the environment variable\n" + PROGRAM_NAME ": TMPDIR to a valid directory\n"); myexit(1); } /* create the temporary file names */ orig_umask = umask(S_IRWXG|S_IRWXO); pid = getpid(); - snprintf(tempdirpv, sizeof(tempdirpv), "%s/cscope.%d", tmpdir, pid); + snprintf(tempdirpv, sizeof(tempdirpv), "%s/"PROGRAM_NAME".%d", tmpdir, pid); if(mkdir(tempdirpv,S_IRWXU)) { fprintf(stderr, - "cscope: Could not create private temp dir %s\n", + PROGRAM_NAME ": Could not create private temp dir %s\n", tempdirpv); myexit(1); } umask(orig_umask); - snprintf(temp1, sizeof(temp1), "%s/cscope.1", tempdirpv); - snprintf(temp2, sizeof(temp2), "%s/cscope.2", tempdirpv); + snprintf(temp1, sizeof(temp1), "%s/"PROGRAM_NAME".1", tempdirpv); + snprintf(temp2, sizeof(temp2), "%s/"PROGRAM_NAME".2", tempdirpv); /* if the database path is relative and it can't be created */ if (reffile[0] != '/' && access(".", WRITE) != 0) { @@ -448,12 +447,12 @@ main(int argc, char **argv) /* if the cross-reference is to be considered up-to-date */ if (isuptodate == true) { if ((oldrefs = vpfopen(reffile, "rb")) == NULL) { - postfatal("cscope: cannot open file %s\n", reffile); + postfatal(PROGRAM_NAME ": cannot open file %s\n", reffile); /* falseTREACHED */ } /* get the crossref file version but skip the current directory */ - if (fscanf(oldrefs, "cscope %d %*s", &fileversion) != 1) { - postfatal("cscope: cannot read file version from file %s\n", + if (fscanf(oldrefs, PROGRAM_NAME " %d %*s", &fileversion) != 1) { + postfatal(PROGRAM_NAME ": cannot read file version from file %s\n", reffile); /* falseTREACHED */ } @@ -494,7 +493,7 @@ main(int argc, char **argv) /* get the number of source files */ if (fscanf(oldrefs, "%lu", &nsrcfiles) != 1) { postfatal( - "cscope: cannot read source file size from file %s\n", + PROGRAM_NAME ": cannot read source file size from file %s\n", reffile); /* falseTREACHED */ } @@ -505,7 +504,7 @@ main(int argc, char **argv) /* allocate the string space */ if (fscanf(oldrefs, "%d", &oldnum) != 1) { postfatal( - "cscope: cannot read string space size from file %s\n", + PROGRAM_NAME ": cannot read string space size from file %s\n", reffile); /* falseTREACHED */ } @@ -515,7 +514,7 @@ main(int argc, char **argv) /* read the strings */ if (fread(s, oldnum, 1, oldrefs) != 1) { postfatal( - "cscope: cannot read source file names from file %s\n", + PROGRAM_NAME ": cannot read source file names from file %s\n", reffile); /* falseTREACHED */ } @@ -543,7 +542,7 @@ main(int argc, char **argv) switch (i) { case 'p': /* file path components to display */ if (*s < '0' || *s > '9') { - posterr("cscope: -p option in file %s: missing or invalid numeric value\n", namefile); + posterr(PROGRAM_NAME ": -p option in file %s: missing or invalid numeric value\n", namefile); } dispcomponents = atoi(s); @@ -555,8 +554,9 @@ main(int argc, char **argv) for (i = 0; i < nsrcfiles; ++i) { if (!fgets(path, sizeof(path), oldrefs) ) { postfatal( - "cscope: cannot read source file name from file %s\n", - reffile); + PROGRAM_NAME ": cannot read source file name from file %s\n", + reffile + ); /* falseTREACHED */ } srcfiles[i] = strdup(path); @@ -576,8 +576,8 @@ main(int argc, char **argv) srcfiles = malloc(msrcfiles * sizeof(*srcfiles)); makefilelist(); if (nsrcfiles == 0) { - postfatal("cscope: no source files found\n"); - /* falseTREACHED */ + postfatal(PROGRAM_NAME ": no source files found\n"); + /* NOTREACHED */ } /* get include directories from the environment */ if ((s = getenv("INCLUDEDIRS")) != NULL) { diff --git a/src/opt.c b/src/opt.c index 8b1b7ee..8229502 100644 --- a/src/opt.c +++ b/src/opt.c @@ -90,7 +90,7 @@ char ** parse_options(int *argc, char **argv) verbosemode = true; break; case 'V': - fprintf(stderr, "%s: version %d%s\n", argv0, + fprintf(stderr, PROGRAM_NAME ": version %d%s\n", FILEVERSION, FIXVERSION); myexit(0); break; diff --git a/src/vpinit.c b/src/vpinit.c index 9e21941..175b56d 100644 --- a/src/vpinit.c +++ b/src/vpinit.c @@ -81,7 +81,7 @@ vpinit(char *current_dir) } /* if not given, get the current directory name */ if (current_dir == NULL && (current_dir = getcwd(buf, MAXPATH)) == NULL) { - (void) fprintf(stderr, "%s: cannot get current directory name\n", argv0); + (void) fprintf(stderr, PROGRAM_NAME ": cannot get current directory name\n"); return; } /* see if this directory is in the first view path node */