View | Details | Raw Unified | Return to bug 121165 | Differences between
and this patch

Collapse All | Expand All

(-)delete/main.c (+4 lines)
Lines 37-42 Link Here
37
Boolean	Recursive	= FALSE;
37
Boolean	Recursive	= FALSE;
38
match_t	MatchType	= MATCH_GLOB;
38
match_t	MatchType	= MATCH_GLOB;
39
39
40
char	*progname	= NULL;
41
40
static void usage(void);
42
static void usage(void);
41
43
42
static char opts[] = "adDfGhinp:rvxX";
44
static char opts[] = "adDfGhinp:rvxX";
Lines 67-72 Link Here
67
    const char *tmp;
69
    const char *tmp;
68
    struct stat stat_s;
70
    struct stat stat_s;
69
71
72
    if ((progname = basename(argv[0])) == NULL)
73
	err(EXIT_FAILURE, "basename");
70
    pkgs = start = argv;
74
    pkgs = start = argv;
71
    while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1)
75
    while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1)
72
	switch(ch) {
76
	switch(ch) {
(-)create/main.c (+3 lines)
Lines 45-50 Link Here
45
int	Help		= FALSE;
45
int	Help		= FALSE;
46
enum zipper	Zipper  = BZIP2;
46
enum zipper	Zipper  = BZIP2;
47
47
48
char	*progname	= NULL;
48
49
49
static void usage(void);
50
static void usage(void);
50
51
Lines 72-77 Link Here
72
    int ch;
73
    int ch;
73
    char **pkgs, **start, *tmp;
74
    char **pkgs, **start, *tmp;
74
75
76
    if ((progname = basename(argv[0])) == NULL)
77
	err(EXIT_FAILURE, "basename");
75
    pkgs = start = argv;
78
    pkgs = start = argv;
76
    while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1)
79
    while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1)
77
	switch(ch) {
80
	switch(ch) {
(-)version/main.c (+4 lines)
Lines 36-41 Link Here
36
Boolean UseINDEXOnly = FALSE;
36
Boolean UseINDEXOnly = FALSE;
37
Boolean ShowOrigin = FALSE;
37
Boolean ShowOrigin = FALSE;
38
38
39
char	*progname	= NULL;
40
39
static void usage(void);
41
static void usage(void);
40
42
41
static char opts[] = "dIhl:L:qs:XtTO:ov";
43
static char opts[] = "dIhl:L:qs:XtTO:ov";
Lines 67-72 Link Here
67
	cmp = version_match(argv[3], argv[2]);
69
	cmp = version_match(argv[3], argv[2]);
68
	exit(cmp == 1 ? 0 : 1);
70
	exit(cmp == 1 ? 0 : 1);
69
    }
71
    }
72
    if ((progname = basename(argv[0])) == NULL)
73
	err(EXIT_FAILURE, "basename");
70
    else while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
74
    else while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
71
	switch(ch) {
75
	switch(ch) {
72
	case 'v':
76
	case 'v':
(-)lib/pen.c (-11 / +13 lines)
Lines 62-71 Link Here
62
	cleanup(0);
62
	cleanup(0);
63
	humanize_number(humbuf, sizeof humbuf, sz, "", HN_AUTOSCALE,
63
	humanize_number(humbuf, sizeof humbuf, sz, "", HN_AUTOSCALE,
64
	    HN_NOSPACE);
64
	    HN_NOSPACE);
65
	errx(2,
65
	/* XXX: Maintain 80 column width in the error message. */
66
"%s: can't find enough temporary space to extract the files, please set your\n"
66
	errx(EXIT_FAILURE,
67
"PKG_TMPDIR environment variable to a location with at least %s bytes\n"
67
	    "%s.%s: not enough temporary space to extract the files; set PKG_TMPDIR in\n"
68
"free", __func__, humbuf);
68
	    "your environment to a location with at least %s bytes free",
69
	    progname, __func__, humbuf);
69
	return NULL;
70
	return NULL;
70
    }
71
    }
71
    return pen;
72
    return pen;
Lines 79-85 Link Here
79
pushPen(const char *pen)
80
pushPen(const char *pen)
80
{
81
{
81
    if (++pdepth == MAX_STACK)
82
    if (++pdepth == MAX_STACK)
82
	errx(2, "%s: stack overflow.\n", __func__);
83
	errx(2, "%s.%s: stack overflow.", progname, __func__);
83
    pstack[pdepth] = strdup(pen);
84
    pstack[pdepth] = strdup(pen);
84
85
85
    return pstack[pdepth];
86
    return pstack[pdepth];
Lines 131-139 Link Here
131
    if (min_free(pen) < sz) {
132
    if (min_free(pen) < sz) {
132
	rmdir(pen);
133
	rmdir(pen);
133
	cleanup(0);
134
	cleanup(0);
134
	errx(2, "%s: not enough free space to create '%s'.\n"
135
	errx(2, "%s.%s: not enough free space to create '%s'.\n"
135
	     "Please set your PKG_TMPDIR environment variable to a location\n"
136
	     "Please set your PKG_TMPDIR environment variable to a location\n"
136
	     "with more space and\ntry the command again", __func__, pen);
137
	     "with more space and\ntry the command again", progname, __func__,
138
	     pen);
137
    }
139
    }
138
140
139
    if (!getcwd(cwd, FILENAME_MAX)) {
141
    if (!getcwd(cwd, FILENAME_MAX)) {
Lines 143-149 Link Here
143
145
144
    if (chdir(pen) == FAIL) {
146
    if (chdir(pen) == FAIL) {
145
	cleanup(0);
147
	cleanup(0);
146
	errx(2, "%s: can't chdir to '%s'", __func__, pen);
148
	errx(2, "%s:%s: can't chdir to '%s'", progname, __func__, pen);
147
    }
149
    }
148
150
149
    strcpy(PenLocation, pen);
151
    strcpy(PenLocation, pen);
Lines 167-177 Link Here
167
169
168
    if (chdir(PenLocation) == FAIL) {
170
    if (chdir(PenLocation) == FAIL) {
169
	cleanup(0);
171
	cleanup(0);
170
	errx(2, "%s: can't chdir back to '%s'", __func__, PenLocation);
172
	errx(2, "%s.%s: can't chdir back to '%s'", progname, __func__, PenLocation);
171
    }
173
    }
172
174
173
    if (left[0] == '/' && vsystem("/bin/rm -rf %s", left))
175
    if (left[0] == '/' && vsystem("/bin/rm -rf %s", left))
174
	warnx("couldn't remove temporary dir '%s'", left);
176
	warnx("%s.%s: couldn't remove temporary dir '%s'", progname, __func__, left);
175
    signal(SIGINT, oldsig);
177
    signal(SIGINT, oldsig);
176
178
177
    return 1;
179
    return 1;
Lines 183-189 Link Here
183
    struct statfs buf;
185
    struct statfs buf;
184
186
185
    if (statfs(tmpdir, &buf) != 0) {
187
    if (statfs(tmpdir, &buf) != 0) {
186
	warn("statfs");
188
	warn("%s.%s: statfs", progname, __func__);
187
	return -1;
189
	return -1;
188
    }
190
    }
189
    return (off_t)buf.f_bavail * (off_t)buf.f_bsize;
191
    return (off_t)buf.f_bavail * (off_t)buf.f_bsize;
(-)lib/lib.h (-1 / +4 lines)
Lines 30-35 Link Here
30
#include <sys/queue.h>
30
#include <sys/queue.h>
31
#include <ctype.h>
31
#include <ctype.h>
32
#include <dirent.h>
32
#include <dirent.h>
33
#include <err.h>
34
#include <libgen.h>
33
#include <stdarg.h>
35
#include <stdarg.h>
34
#include <stdio.h>
36
#include <stdio.h>
35
#include <stdlib.h>
37
#include <stdlib.h>
Lines 239-247 Link Here
239
int		version_cmp(const char *, const char *);
241
int		version_cmp(const char *, const char *);
240
242
241
/* Externs */
243
/* Externs */
244
extern char	*progname;
242
extern Boolean	Quiet;
245
extern Boolean	Quiet;
243
extern Boolean	Fake;
246
extern Boolean	Fake;
244
extern Boolean  Force;
247
extern Boolean	Force;
245
extern int	AutoAnswer;
248
extern int	AutoAnswer;
246
extern int	Verbose;
249
extern int	Verbose;
247
250
(-)add/main.c (-3 / +8 lines)
Lines 50-55 Link Here
50
50
51
char	**pkgs;
51
char	**pkgs;
52
52
53
char	*progname	= NULL;
54
53
struct {
55
struct {
54
	int lowver;	/* Lowest version number to match */
56
	int lowver;	/* Lowest version number to match */
55
	int hiver;	/* Highest version number to match */
57
	int hiver;	/* Highest version number to match */
Lines 128-136 Link Here
128
    static char temppackageroot[MAXPATHLEN];
130
    static char temppackageroot[MAXPATHLEN];
129
    static char pkgaddpath[MAXPATHLEN];
131
    static char pkgaddpath[MAXPATHLEN];
130
132
131
    if (*argv[0] != '/' && strchr(argv[0], '/') != NULL)
133
    if ((progname = basename(argv[0])) == NULL)
132
	PkgAddCmd = realpath(argv[0], pkgaddpath);
134
	err(EXIT_FAILURE, "basename");
133
    else
135
    if (*argv[0] != '/' && strchr(argv[0], '/') != NULL) {
136
	if ((PkgAddCmd = realpath(argv[0], pkgaddpath)) == NULL)
137
	    err(EXIT_FAILURE, "realpath");
138
    } else
134
	PkgAddCmd = argv[0];
139
	PkgAddCmd = argv[0];
135
140
136
    start = argv;
141
    start = argv;
(-)info/main.c (+4 lines)
Lines 39-44 Link Here
39
Boolean KeepPackage	= FALSE;
39
Boolean KeepPackage	= FALSE;
40
struct which_head *whead;
40
struct which_head *whead;
41
41
42
char	*progname	= NULL;
43
42
static void usage(void);
44
static void usage(void);
43
45
44
static char opts[] = "abcdDe:EfgGhiIjkKl:LmoO:pPqQrRst:vVW:xX";
46
static char opts[] = "abcdDe:EfgGhiIjkKl:LmoO:pPqQrRst:vVW:xX";
Lines 73-78 Link Here
73
	err(2, NULL);
75
	err(2, NULL);
74
    TAILQ_INIT(whead);
76
    TAILQ_INIT(whead);
75
77
78
    if ((progname = basename(argv[0])) == NULL)
79
	err(EXIT_FAILURE, "basename");
76
    pkgs = start = argv;
80
    pkgs = start = argv;
77
    if (argc == 1) {
81
    if (argc == 1) {
78
	MatchType = MATCH_ALL;
82
	MatchType = MATCH_ALL;

Return to bug 121165