Usability tweak:
Use '' quotes instead of `' to delimit names of files and packages in warning and error messages, because it is easier to cut-n-paste name in question that way (single click) without confusing the shell. And yes, I know that it is less eye-candy... MFC after: 1 month
This commit is contained in:
parent
a9479014c3
commit
fd136a35b7
@ -101,7 +101,7 @@ pkg_do(char *pkg)
|
||||
/* Is it an ftp://foo.bar.baz/file.tgz specification? */
|
||||
if (isURL(pkg)) {
|
||||
if (!(Home = fileGetURL(NULL, pkg))) {
|
||||
warnx("unable to fetch `%s' by URL", pkg);
|
||||
warnx("unable to fetch '%s' by URL", pkg);
|
||||
return 1;
|
||||
}
|
||||
where_to = Home;
|
||||
@ -109,7 +109,7 @@ pkg_do(char *pkg)
|
||||
cfile = fopen(CONTENTS_FNAME, "r");
|
||||
if (!cfile) {
|
||||
warnx(
|
||||
"unable to open table of contents file `%s' - not a package?",
|
||||
"unable to open table of contents file '%s' - not a package?",
|
||||
CONTENTS_FNAME);
|
||||
goto bomb;
|
||||
}
|
||||
@ -142,14 +142,14 @@ pkg_do(char *pkg)
|
||||
setenv("_TOP", Home, 1);
|
||||
if (unpack(pkg_fullname, extract)) {
|
||||
warnx(
|
||||
"unable to extract table of contents file from `%s' - not a package?",
|
||||
"unable to extract table of contents file from '%s' - not a package?",
|
||||
pkg_fullname);
|
||||
goto bomb;
|
||||
}
|
||||
cfile = fopen(CONTENTS_FNAME, "r");
|
||||
if (!cfile) {
|
||||
warnx(
|
||||
"unable to open table of contents file `%s' - not a package?",
|
||||
"unable to open table of contents file '%s' - not a package?",
|
||||
CONTENTS_FNAME);
|
||||
goto bomb;
|
||||
}
|
||||
@ -167,7 +167,7 @@ pkg_do(char *pkg)
|
||||
printf("Desired prefix of %s does not exist, creating..\n", p->name);
|
||||
vsystem("mkdir -p %s", p->name);
|
||||
if (chdir(p->name) == -1) {
|
||||
warn("unable to change directory to `%s'", p->name);
|
||||
warn("unable to change directory to '%s'", p->name);
|
||||
goto bomb;
|
||||
}
|
||||
}
|
||||
@ -176,7 +176,7 @@ pkg_do(char *pkg)
|
||||
}
|
||||
else {
|
||||
warnx(
|
||||
"no prefix specified in `%s' - this is a bad package!",
|
||||
"no prefix specified in '%s' - this is a bad package!",
|
||||
pkg_fullname);
|
||||
goto bomb;
|
||||
}
|
||||
@ -203,7 +203,7 @@ pkg_do(char *pkg)
|
||||
|
||||
/* Finally unpack the whole mess */
|
||||
if (unpack(pkg_fullname, NULL)) {
|
||||
warnx("unable to extract `%s'!", pkg_fullname);
|
||||
warnx("unable to extract '%s'!", pkg_fullname);
|
||||
goto bomb;
|
||||
}
|
||||
}
|
||||
@ -236,7 +236,7 @@ pkg_do(char *pkg)
|
||||
/* See if we're already registered */
|
||||
sprintf(LogDir, "%s/%s", (tmp = getenv(PKG_DBDIR)) ? tmp : DEF_LOG_DIR, PkgName);
|
||||
if (isdir(LogDir) && !Force) {
|
||||
warnx("package `%s' already recorded as installed", PkgName);
|
||||
warnx("package '%s' already recorded as installed", PkgName);
|
||||
code = 1;
|
||||
goto success; /* close enough for government work */
|
||||
}
|
||||
@ -246,7 +246,7 @@ pkg_do(char *pkg)
|
||||
if (p->type != PLIST_PKGDEP)
|
||||
continue;
|
||||
if (Verbose)
|
||||
printf("Package `%s' depends on `%s'.\n", PkgName, p->name);
|
||||
printf("Package '%s' depends on '%s'.\n", PkgName, p->name);
|
||||
if (vsystem("pkg_info -e %s", p->name)) {
|
||||
char path[FILENAME_MAX], *cp = NULL;
|
||||
|
||||
@ -261,7 +261,7 @@ pkg_do(char *pkg)
|
||||
if (Verbose)
|
||||
printf("Loading it from %s.\n", cp);
|
||||
if (vsystem("pkg_add %s'%s'", Verbose ? "-v " : "", cp)) {
|
||||
warnx("autoload of dependency `%s' failed%s",
|
||||
warnx("autoload of dependency '%s' failed%s",
|
||||
cp, Force ? " (proceeding anyway)" : "!");
|
||||
if (!Force)
|
||||
++code;
|
||||
@ -284,13 +284,13 @@ pkg_do(char *pkg)
|
||||
++code;
|
||||
}
|
||||
else if (vsystem("(pwd; cat +CONTENTS) | pkg_add %s-S", Verbose ? "-v " : "")) {
|
||||
warnx("pkg_add of dependency `%s' failed%s",
|
||||
warnx("pkg_add of dependency '%s' failed%s",
|
||||
p->name, Force ? " (proceeding anyway)" : "!");
|
||||
if (!Force)
|
||||
++code;
|
||||
}
|
||||
else if (Verbose)
|
||||
printf("\t`%s' loaded successfully.\n", p->name);
|
||||
printf("\t'%s' loaded successfully.\n", p->name);
|
||||
/* Nuke the temporary playpen */
|
||||
leave_playpen();
|
||||
}
|
||||
@ -439,7 +439,7 @@ pkg_do(char *pkg)
|
||||
if (p->type != PLIST_PKGDEP)
|
||||
continue;
|
||||
if (Verbose)
|
||||
printf("Attempting to record dependency on package `%s'\n", p->name);
|
||||
printf("Attempting to record dependency on package '%s'\n", p->name);
|
||||
sprintf(contents, "%s/%s/%s", (tmp = getenv(PKG_DBDIR)) ? tmp : DEF_LOG_DIR,
|
||||
basename_of(p->name), REQUIRED_BY_FNAME);
|
||||
cfile = fopen(contents, "a");
|
||||
|
@ -130,7 +130,7 @@ pkg_do(char *pkg)
|
||||
|
||||
if (!isemptyfile(REQUIRED_BY_FNAME)) {
|
||||
char buf[512];
|
||||
warnx("package `%s' is required by these other packages\n"
|
||||
warnx("package '%s' is required by these other packages\n"
|
||||
"and may not be deinstalled%s:",
|
||||
pkg, Force ? " (but I'll delete it anyway)" : "" );
|
||||
cfile = fopen(REQUIRED_BY_FNAME, "r");
|
||||
@ -139,7 +139,7 @@ pkg_do(char *pkg)
|
||||
fprintf(stderr, "%s", buf);
|
||||
fclose(cfile);
|
||||
} else
|
||||
warnx("cannot open requirements file `%s'", REQUIRED_BY_FNAME);
|
||||
warnx("cannot open requirements file '%s'", REQUIRED_BY_FNAME);
|
||||
if (!Force)
|
||||
return 1;
|
||||
}
|
||||
@ -258,7 +258,7 @@ pkg_do(char *pkg)
|
||||
if (p->type != PLIST_PKGDEP)
|
||||
continue;
|
||||
if (Verbose)
|
||||
printf("Attempting to remove dependency on package `%s'\n", p->name);
|
||||
printf("Attempting to remove dependency on package '%s'\n", p->name);
|
||||
if (!Fake)
|
||||
undepend(p, pkg);
|
||||
}
|
||||
@ -295,21 +295,21 @@ undepend(PackingList p, char *pkgname)
|
||||
p->name, REQUIRED_BY_FNAME);
|
||||
fp = fopen(fname, "r");
|
||||
if (fp == NULL) {
|
||||
warnx("couldn't open dependency file `%s'", fname);
|
||||
warnx("couldn't open dependency file '%s'", fname);
|
||||
return;
|
||||
}
|
||||
sprintf(ftmp, "%s.XXXXXX", fname);
|
||||
s = mkstemp(ftmp);
|
||||
if (s == -1) {
|
||||
fclose(fp);
|
||||
warnx("couldn't open temp file `%s'", ftmp);
|
||||
warnx("couldn't open temp file '%s'", ftmp);
|
||||
return;
|
||||
}
|
||||
fpwr = fdopen(s, "w");
|
||||
if (fpwr == NULL) {
|
||||
close(s);
|
||||
fclose(fp);
|
||||
warnx("couldn't fdopen temp file `%s'", ftmp);
|
||||
warnx("couldn't fdopen temp file '%s'", ftmp);
|
||||
remove(ftmp);
|
||||
return;
|
||||
}
|
||||
@ -321,18 +321,18 @@ undepend(PackingList p, char *pkgname)
|
||||
}
|
||||
(void) fclose(fp);
|
||||
if (fchmod(s, 0644) == FAIL) {
|
||||
warnx("error changing permission of temp file `%s'", ftmp);
|
||||
warnx("error changing permission of temp file '%s'", ftmp);
|
||||
fclose(fpwr);
|
||||
remove(ftmp);
|
||||
return;
|
||||
}
|
||||
if (fclose(fpwr) == EOF) {
|
||||
warnx("error closing temp file `%s'", ftmp);
|
||||
warnx("error closing temp file '%s'", ftmp);
|
||||
remove(ftmp);
|
||||
return;
|
||||
}
|
||||
if (rename(ftmp, fname) == -1)
|
||||
warnx("error renaming `%s' to `%s'", ftmp, fname);
|
||||
warnx("error renaming '%s' to '%s'", ftmp, fname);
|
||||
remove(ftmp); /* just in case */
|
||||
return;
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ pkg_do(char *pkg)
|
||||
sprintf(log_dir, "%s/%s", (tmp = getenv(PKG_DBDIR)) ? tmp : DEF_LOG_DIR,
|
||||
pkg);
|
||||
if (!fexists(log_dir)) {
|
||||
warnx("can't find package `%s' installed or in a file!", pkg);
|
||||
warnx("can't find package '%s' installed or in a file!", pkg);
|
||||
return 1;
|
||||
}
|
||||
if (chdir(log_dir) == FAIL) {
|
||||
|
@ -380,9 +380,9 @@ delete_package(Boolean ign_err, Boolean nukedirs, Package *pkg)
|
||||
case PLIST_UNEXEC:
|
||||
format_cmd(tmp, p->name, Where, last_file);
|
||||
if (Verbose)
|
||||
printf("Execute `%s'\n", tmp);
|
||||
printf("Execute '%s'\n", tmp);
|
||||
if (!Fake && system(tmp)) {
|
||||
warnx("unexec command for `%s' failed", tmp);
|
||||
warnx("unexec command for '%s' failed", tmp);
|
||||
fail = FAIL;
|
||||
}
|
||||
break;
|
||||
@ -391,7 +391,7 @@ delete_package(Boolean ign_err, Boolean nukedirs, Package *pkg)
|
||||
last_file = p->name;
|
||||
sprintf(tmp, "%s/%s", Where, p->name);
|
||||
if (isdir(tmp) && fexists(tmp) && !issymlink(tmp)) {
|
||||
warnx("cannot delete specified file `%s' - it is a directory!\n"
|
||||
warnx("cannot delete specified file '%s' - it is a directory!\n"
|
||||
"this packing list is incorrect - ignoring delete request", tmp);
|
||||
}
|
||||
else {
|
||||
@ -401,7 +401,7 @@ delete_package(Boolean ign_err, Boolean nukedirs, Package *pkg)
|
||||
if ((cp = MD5File(tmp, buf)) != NULL) {
|
||||
/* Mismatch? */
|
||||
if (strcmp(cp, p->next->name + 4)) {
|
||||
warnx("`%s' fails original MD5 checksum - %s",
|
||||
warnx("'%s' fails original MD5 checksum - %s",
|
||||
tmp, Force ? "deleted anyway." : "not deleted.");
|
||||
if (!Force) {
|
||||
fail = FAIL;
|
||||
@ -433,7 +433,7 @@ delete_package(Boolean ign_err, Boolean nukedirs, Package *pkg)
|
||||
case PLIST_DIR_RM:
|
||||
sprintf(tmp, "%s/%s", Where, p->name);
|
||||
if (!isdir(tmp) && fexists(tmp)) {
|
||||
warnx("cannot delete specified directory `%s' - it is a file!\n"
|
||||
warnx("cannot delete specified directory '%s' - it is a file!\n"
|
||||
"this packing list is incorrect - ignoring delete request", tmp);
|
||||
}
|
||||
else {
|
||||
@ -471,7 +471,7 @@ delete_hierarchy(char *dir, Boolean ign_err, Boolean nukedirs)
|
||||
cp1 = cp2 = dir;
|
||||
if (!fexists(dir)) {
|
||||
if (!ign_err)
|
||||
warnx("%s `%s' doesn't really exist",
|
||||
warnx("%s '%s' doesn't really exist",
|
||||
isdir(dir) ? "directory" : "file", dir);
|
||||
return !ign_err;
|
||||
}
|
||||
@ -497,7 +497,7 @@ delete_hierarchy(char *dir, Boolean ign_err, Boolean nukedirs)
|
||||
return 0;
|
||||
if (RMDIR(dir) && !ign_err) {
|
||||
if (!fexists(dir))
|
||||
warnx("directory `%s' doesn't really exist", dir);
|
||||
warnx("directory '%s' doesn't really exist", dir);
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user