+2008-01-16 Guillem Jover <guillem@debian.org>
+
+ * dpkg-deb/build.c (do_build): Use NULL instead of 0.
+ * dpkg-deb/extract.c (extracthalf, do_fsystarfile): Likewise.
+ * dpkg-deb/info.c (info_prepare, info_spew): Likewise.
+ (do_contents, do_field): Likewise.
+ * dpkg-deb/main.c (cipaction, action, cmdinfos, main): Likewise.
+ * dpkg-split/join.c (do_join): Likewise.
+ * dpkg-split/queue.c (do_auto): Likewise.
+ * lib/dpkg.h (standard_startup, standard_shutdown): Likewise.
+ * src/archives.c (destroyobstack, deconfigure, addfiletolist)
+ (tarobject, check_breaks, check_conflict, archivefiles)
+ (newconff_append): Likewise.
+ * src/configure.c (deferred_configure, conffderef, md5hash): Likewise.
+ * src/depcon.c (findbreakcyclerecursive, findbreakcycle)
+ (depisok): Likewise.
+ * src/enquiry.c (limiteddescription, badstatinfos, unpackchk)
+ (assertversion, assertpredep, assertepoch, assertlongfilenames)
+ (assertmulticonrep, predeppackage, cmpversions): Likewise.
+ * src/errors.c (reports, print_error_perpackage): Likewise.
+ * src/filesdb.c (diversions, diversionsfile, statoverridefile)
+ (ensure_packagefiles_available, ensure_allinstfiles_available)
+ (write_filelist_except, reversefilelist_init, reversefilelist_next)
+ (ensure_diversions, iterfilestart, iterfilenext, filesdbinit)
+ (findnamenode): Likewise.
+ * src/help.c (checkpath, ensure_package_clientdata
+ (vbuildarglist, cu_restorescriptsignals, script_catchsignals)
+ (clear_istobes): Likewise.
+ * src/main.c (cipaction, ignoredepends, forceinfos)
+ (ACTION, OBSOLETE, ACTIONBACKEND, cmdinfos)
+ (execbackend, commandfd, main): Likewise.
+ * src/packages.c (queuehead, add_to_queue, packages, process_queue)
+ (breakses_ok, dependencies_ok): Likewise.
+ * src/processarc.c (process_archive): Likewise.
+ * src/remove.c (deferred_remove, removal_bulk_remove_files)
+ (removal_bulk_remove_leftover_dirs, removal_bulk_remove_configfiles)
+ (removal_bulk): Likewise.
+ * src/update.c (updateavailable): Likewise.
+ * utils/start-stop-daemon.c (xgettimeofday, run_stop_schedule)
+ (parse_options): Likewise.
+ (pid_is_cmd, pid_is_user, pid_is_exec) [HAVE_KVM_H]: Likewise.
+
2008-01-15 Raphael Hertzog <hertzog@debian.org>
* scripts/dpkg-shlibdeps.pl (filter_deps): Fix filtering of
*/
void do_build(const char *const *argv) {
static const char *const maintainerscripts[]= {
- PREINSTFILE, POSTINSTFILE, PRERMFILE, POSTRMFILE, 0
+ PREINSTFILE, POSTINSTFILE, PRERMFILE, POSTRMFILE, NULL
};
char *m;
strcpy(tfbuf,envbuf);
strcat(tfbuf,"/dpkg.XXXXXX");
subdir= 0;
- if ((debar= *argv++) !=0) {
+ debar = *argv++;
+ if (debar != NULL) {
if (*argv) badusage(_("--build takes at most two arguments"));
if (debar) {
if (stat(debar,&debarstab)) {
* build something. Lets start by making the ar-wrapper.
*/
if (!(ar=fopen(debar,"wb"))) ohshite(_("unable to create `%.255s'"),debar);
- if (setvbuf(ar, 0, _IONBF, 0)) ohshite(_("unable to unbuffer `%.255s'"),debar);
+ if (setvbuf(ar, NULL, _IONBF, 0))
+ ohshite(_("unable to unbuffer `%.255s'"), debar);
/* Fork a tar to package the control-section of the package */
m_pipe(p1);
if (!(c1= m_fork())) {
if (fprintf(ar, "%-8s\n%ld\n", OLDARCHIVEVERSION, (long)controlstab.st_size) == EOF)
werr(debar);
} else {
- thetime= time(0);
+ thetime = time(NULL);
if (fprintf(ar,
"!<arch>\n"
"debian-binary %-12lu0 0 100644 %-10ld`\n"
size_t ctrllennum, memberlen= 0;
int dummy, l= 0;
pid_t c1=0,c2,c3;
- unsigned char *ctrlarea= 0;
+ unsigned char *ctrlarea = NULL;
int p1[2], p2[2];
FILE *ar, *pi;
struct stat stab;
badusage(_("--%s needs a .deb filename argument"),cipaction->olong);
if (*argv)
badusage(_("--%s takes only one argument (.deb filename)"),cipaction->olong);
- extracthalf(debar,0,0,0);
+ extracthalf(debar, NULL, NULL, 0);
}
void do_control(const char *const *argv) { controlextractvextract(1, "x", argv); }
ohshite(_("failed to exec rm -rf"));
}
waitsubproc(c1,"rm -rf",0);
- push_cleanup(cu_info_prepare,-1, 0,0, 1, (void*)dbuf);
+ push_cleanup(cu_info_prepare, -1, NULL, 0, 1, (void *)dbuf);
extracthalf(*debarp, dbuf, "mx", admininfo);
}
FILE *co;
int re= 0;
- while ((component= *argv++) != 0) {
+ while ((component = *argv++) != NULL) {
pathlen = strlen(directory) + strlen(component) + 2;
controlfile = (void *) realloc((void *) controlfile, pathlen);
if (!controlfile)
info_prepare(&argv,&debar,&directory,1);
if (*argv) {
- info_field(debar, directory, argv, argv[1]!=0);
+ info_field(debar, directory, argv, argv[1] != NULL);
} else {
- static const char *const controlonly[]= { "control", 0 };
+ static const char *const controlonly[] = { "control", NULL };
info_spew(debar,directory, controlonly);
}
}
const char *debar;
if (!(debar= *argv++) || *argv) badusage(_("--contents takes exactly one argument"));
- extracthalf(debar, 0, "tv", 0);
+ extracthalf(debar, NULL, "tv", 0);
}
/* vi: sw=2
*/
int debugflag=0, nocheckflag=0, oldformatflag=BUILDOLDPKGFORMAT;
const char* compression=NULL;
enum compress_type compress_type = compress_type_gzip;
-const struct cmdinfo *cipaction=0;
-dofunction *action=0;
+const struct cmdinfo *cipaction = NULL;
+dofunction *action = NULL;
static void helponly(const struct cmdinfo *cip, const char *value) NONRETURNING;
static void helponly(const struct cmdinfo *cip, const char *value) {
* same order as dofunctions:
*/
static const struct cmdinfo cmdinfos[]= {
- { "build", 'b', 0, 0, 0, setaction },
- { "contents", 'c', 0, 0, 0, setaction },
- { "control", 'e', 0, 0, 0, setaction },
- { "info", 'I', 0, 0, 0, setaction },
- { "field", 'f', 0, 0, 0, setaction },
- { "extract", 'x', 0, 0, 0, setaction },
- { "vextract", 'X', 0, 0, 0, setaction },
- { "fsys-tarfile", 0, 0, 0, 0, setaction },
- { "show", 'W', 0, 0, 0, setaction },
- { "new", 0, 0, &oldformatflag, 0, 0, 0 },
- { "old", 0, 0, &oldformatflag, 0, 0, 1 },
- { "debug", 'D', 0, &debugflag, 0, 0, 1 },
- { "nocheck", 0, 0, &nocheckflag, 0, 0, 1 },
- { "compression", 'z', 1, 0, &compression, 0, 1 },
- { "compress_type",'Z', 1, 0, 0, setcompresstype },
- { "showformat", 0, 1, 0, &showformat, 0 },
- { "help", 'h', 0, 0, 0, helponly },
- { "version", 0, 0, 0, 0, versiononly },
- { "licence", 0, 0, 0, 0, showcopyright }, /* UK spelling */
- { "license", 0, 0, 0, 0, showcopyright }, /* US spelling */
- { 0, 0 }
+ { "build", 'b', 0, NULL, NULL, setaction },
+ { "contents", 'c', 0, NULL, NULL, setaction },
+ { "control", 'e', 0, NULL, NULL, setaction },
+ { "info", 'I', 0, NULL, NULL, setaction },
+ { "field", 'f', 0, NULL, NULL, setaction },
+ { "extract", 'x', 0, NULL, NULL, setaction },
+ { "vextract", 'X', 0, NULL, NULL, setaction },
+ { "fsys-tarfile", 0, 0, NULL, NULL, setaction },
+ { "show", 'W', 0, NULL, NULL, setaction },
+ { "new", 0, 0, &oldformatflag, NULL, NULL, 0 },
+ { "old", 0, 0, &oldformatflag, NULL, NULL, 1 },
+ { "debug", 'D', 0, &debugflag, NULL, NULL, 1 },
+ { "nocheck", 0, 0, &nocheckflag, NULL, NULL, 1 },
+ { "compression", 'z', 1, NULL, &compression, NULL, 1 },
+ { "compress_type", 'Z', 1, NULL, NULL, setcompresstype },
+ { "showformat", 0, 1, NULL, &showformat, NULL },
+ { "help", 'h', 0, NULL, NULL, helponly },
+ { "version", 0, 0, NULL, NULL, versiononly },
+ /* UK spelling. */
+ { "licence", 0, 0, NULL, NULL, showcopyright },
+ /* US spelling. */
+ { "license", 0, 0, NULL, NULL, showcopyright },
+ { NULL, 0, 0, NULL, NULL, NULL }
};
static void setaction(const struct cmdinfo *cip, const char *value) {
jmp_buf ejbuf;
setlocale(LC_NUMERIC, "POSIX");
- standard_startup(&ejbuf, argc, &argv, NULL, 0, cmdinfos);
+ standard_startup(&ejbuf, argc, &argv, NULL, NULL, cmdinfos);
if (!cipaction) badusage(_("need an action option"));
unsetenv("GZIP");
action(argv);
- standard_shutdown(0);
+ standard_shutdown(NULL);
exit(0);
}
if (!refi || pq->info.thispartn < refi->thispartn) refi= &pq->info;
assert(refi);
partlist= nfmalloc(sizeof(struct partinfo*)*refi->maxpartn);
- for (i=0; i<refi->maxpartn; i++) partlist[i]= 0;
+ for (i = 0; i < refi->maxpartn; i++)
+ partlist[i] = NULL;
for (pq= queue; pq; pq= pq->nextinqueue) {
pi= &pq->info;
addtopartlist(partlist,pi,refi);
fclose(part);
scandepot();
partlist= nfmalloc(sizeof(struct partinfo*)*refi->maxpartn);
- for (i=0; i<refi->maxpartn; i++) partlist[i]= 0;
+ for (i = 0; i < refi->maxpartn; i++)
+ partlist[i] = NULL;
for (pq= queue; pq; pq= pq->nextinqueue) {
pi= &pq->info;
if (!partmatches(pi,refi)) continue;
if (setjmp(*ejbuf)) { /* expect warning about possible clobbering of argv */\
error_unwind(ehflag_bombout); exit(2);\
}\
- push_error_handler(ejbuf,print_error_fatal,0);\
+ push_error_handler(ejbuf, print_error_fatal, NULL); \
umask(022); /* Make sure all our status databases are readable. */\
if (loadcfg)\
loadcfgfile(prog, cmdinfos);\
} while (0)
#define standard_shutdown(freemem) do {\
- set_error_display(0,0);\
+ set_error_display(NULL, NULL); \
error_unwind(ehflag_normaltidy);\
if (freemem)\
nffreeall();\
if (lseek(fd, limit, SEEK_CUR) == -1) { \
if(errno != ESPIPE) ohshite(__VA_ARGS__); \
buffer_copy_setup_IntPtr(fd, BUFFER_READ_FD, NULL, \
- 0, BUFFER_WRITE_NULL, NULL, \
+ NULL, BUFFER_WRITE_NULL, NULL, \
limit, __VA_ARGS__);\
}
# define stream_null_copy(file, limit, ...) \
if (fseek(file, limit, SEEK_CUR) == -1) { \
if(errno != EBADF) ohshite(__VA_ARGS__); \
buffer_copy_setup_PtrPtr(file, BUFFER_READ_STREAM, NULL, \
- 0, BUFFER_WRITE_NULL, NULL, \
+ NULL, BUFFER_WRITE_NULL, NULL, \
limit, __VA_ARGS__);\
}
# define stream_fd_copy(file, fd, limit, ...)\
if (lseek(fd, limit, SEEK_CUR) == -1) { \
if(errno != ESPIPE) ohshite(desc); \
buffer_copy_setup_IntPtr(fd, BUFFER_READ_FD, NULL, \
- 0, BUFFER_WRITE_NULL, NULL, \
+ NULL, BUFFER_WRITE_NULL, NULL, \
limit, desc);\
}
# define stream_null_copy(file, limit, desc...) \
if (fseek(file, limit, SEEK_CUR) == -1) { \
if(errno != EBADF) ohshite(desc); \
buffer_copy_setup_PtrPtr(file, BUFFER_READ_STREAM, NULL, \
- 0, BUFFER_WRITE_NULL, NULL, \
+ NULL, BUFFER_WRITE_NULL, NULL, \
limit, desc);\
}
# define stream_fd_copy(file, fd, limit, desc...)\
/* destroy the obstack */
static void destroyobstack(void) {
if (tarobs_init) {
- obstack_free(&tar_obs, 0);
+ obstack_free(&tar_obs, NULL);
tarobs_init= 0;
}
}
struct varbuf fnamevb;
struct varbuf fnametmpvb;
struct varbuf fnamenewvb;
-struct packageinlist *deconfigure= 0;
+struct packageinlist *deconfigure = NULL;
static time_t currenttime;
nifd= obstack_alloc(&tar_obs, sizeof(struct fileinlist));
nifd->namenode= namenode;
- nifd->next= 0; *tc->newfilesp= nifd; tc->newfilesp= &nifd->next;
+ nifd->next = NULL;
+ *tc->newfilesp = nifd;
+ tc->newfilesp = &nifd->next;
return nifd;
}
if (keepexisting) {
obstack_free(&tar_obs, nifd);
tc->newfilesp= oldnifd;
- *oldnifd = 0;
+ *oldnifd = NULL;
/* We need to advance the tar file to the next object, so read the
* file data and set it to oblivion.
* if something goes wrong. Watch out for the CLEANUP comments to
* keep an eye on what's installed on the disk at each point.
*/
- push_cleanup(cu_installnew,~ehflag_normaltidy, 0,0, 1,(void*)nifd);
+ push_cleanup(cu_installnew, ~ehflag_normaltidy, NULL, 0, 1, (void *)nifd);
/* CLEANUP: Now we either have the old file on the disk, or not, in
* its original filename.
*/
fd= open(fnamenewvb.buf, (O_CREAT|O_EXCL|O_WRONLY), 0);
if (fd < 0) ohshite(_("unable to create `%.255s'"),ti->Name);
- push_cleanup(cu_closefd,ehflag_bombout, 0,0, 1,&fd);
+ push_cleanup(cu_closefd, ehflag_bombout, NULL, 0, 1, &fd);
debug(dbg_eachfiledetail,"tarobject NormalFile[01] open size=%lu",
(unsigned long)ti->Size);
{ char fnamebuf[256];
varbufinit(&why);
- fixbydeconf= 0;
+ fixbydeconf = NULL;
if (depisok(dep, &why, &fixbydeconf, 0)) {
varbuffree(&why);
return;
fixbydeconf->name, action);
ok= try_deconfigure_can(force_breaks, fixbydeconf, dep->list,
- action, 0, why.buf);
+ action, NULL, why.buf);
if (ok == 1) {
fprintf(stderr, _("dpkg: yes, will deconfigure %s (broken by %s).\n"),
fixbydeconf->name, pkg->name);
varbufinit(&conflictwhy);
varbufinit(&removalwhy);
- fixbyrm= 0;
+ fixbyrm = NULL;
if (depisok(dep, &conflictwhy, &fixbyrm, 0)) {
varbuffree(&conflictwhy);
varbuffree(&removalwhy);
fprintf(stderr,
_("%s is not properly installed - ignoring any dependencies on it.\n"),
fixbyrm->name);
- pdep= 0;
+ pdep = NULL;
} else {
for (pdep= fixbyrm->installed.depended;
pdep;
pdep= pdep->nextrev) {
if (pdep->up->type != dep_depends && pdep->up->type != dep_predepends)
continue;
- if (depisok(pdep->up, &removalwhy, 0,0)) continue;
+ if (depisok(pdep->up, &removalwhy, NULL, 0))
+ continue;
varbufaddc(&removalwhy,0);
if (!try_remove_can(pdep,fixbyrm,removalwhy.buf))
break;
pdep= pdep->nextrev) {
if (pdep->up->type != dep_depends && pdep->up->type != dep_predepends)
continue;
- if (depisok(pdep->up, &removalwhy, 0,0)) continue;
+ if (depisok(pdep->up, &removalwhy, NULL, 0))
+ continue;
varbufaddc(&removalwhy,0);
fprintf(stderr, _("dpkg"
": may have trouble removing %s, as it provides %s ...\n"),
arglist[i++] = "-type";
arglist[i++] = "f";
arglist[i++] = "-print0";
- arglist[i++] = 0;
+ arglist[i++] = NULL;
execvp(FIND, (char *const *)arglist);
ohshite(_("failed to exec find for --recursive"));
}
arglist[i++]= p;
while ((c= *p++) != 0);
}
- arglist[i]= 0;
+ arglist[i] = NULL;
argp= arglist;
} else {
}
- currenttime= time(0);
+ currenttime = time(NULL);
varbufinit(&fnamevb);
varbufinit(&fnametmpvb);
ensure_diversions();
ensure_statoverrides();
- while ((thisarg= *argp++) != 0) {
+ while ((thisarg = *argp++) != NULL) {
if (setjmp(ejbuf)) {
error_unwind(ehflag_bombout);
if (onerr_abort > 0) break;
if (ferror(stdout)) werr("stdout");
if (ferror(stderr)) werr("stderr");
onerr_abort--;
- set_error_display(0,0);
+ set_error_display(NULL, NULL);
error_unwind(ehflag_normaltidy);
}
struct fileinlist *newconff;
newconff= m_malloc(sizeof(struct fileinlist));
- newconff->next= 0;
+ newconff->next = NULL;
newconff->namenode= namenode;
**newconffileslastp_io= newconff;
*newconffileslastp_io= &newconff->next;
char *cdr2rest;
int ok, r, useredited, distedited;
struct conffile *conff;
- char *currenthash= 0, *newdisthash= 0;
+ char *currenthash = NULL, *newdisthash = NULL;
struct stat stab;
enum conffopt what;
static const char *EMPTY_HASH = "-";
sincenothing= 0;
varbufinit(&aemsgs);
- ok= dependencies_ok(pkg,0,&aemsgs);
+ ok = dependencies_ok(pkg, NULL, &aemsgs);
if (ok == 1) {
varbuffree(&aemsgs);
pkg->clientdata->istobe= itb_installnew;
* Returns 0 if everything went ok, -1 otherwise.
*/
int conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in) {
- static char* linkreadbuf = 0;
+ static char *linkreadbuf = NULL;
static int linkreadbufsize = 0;
struct stat stab;
int r, need;
fd=open(fn,O_RDONLY);
if (fd>=0) {
- push_cleanup(cu_closefd,ehflag_bombout, 0,0, 1,&fd);
+ push_cleanup(cu_closefd, ehflag_bombout, NULL, 0, 1, &fd);
fd_md5(fd, hashbuf, -1, _("md5hash"));
pop_cleanup(ehflag_normaltidy); /* fd= open(cdr.buf) */
close(fd);
}
thislink.pkg= pkg;
thislink.back= sofar;
- thislink.possi= 0;
+ thislink.possi = NULL;
for (dep= pkg->installed.depends; dep; dep= dep->next) {
if (dep->type != dep_depends && dep->type != dep_predepends) continue;
for (possi= dep->list; possi; possi= possi->next) {
tpkg->color = white;
}
- return findbreakcyclerecursive(pkg, 0);
+ return findbreakcyclerecursive(pkg, NULL);
}
void describedepcon(struct varbuf *addto, struct dependency *dep) {
dep->type == dep_recommends || dep->type == dep_suggests ||
dep->type == dep_enhances);
- if (canfixbyremove) *canfixbyremove= 0;
+ if (canfixbyremove)
+ *canfixbyremove = NULL;
/* The dependency is always OK if we're trying to remove the depend*ing*
* package.
provider->up->up->name, possi->ed->name);
varbufaddstr(whynot, linebuf);
/* We can't remove the one we're about to install: */
- if (canfixbyremove) *canfixbyremove= 0;
+ if (canfixbyremove)
+ *canfixbyremove = NULL;
return 0;
}
}
if (!nconflicts) return 1;
- if (nconflicts>1) *canfixbyremove= 0;
+ if (nconflicts > 1)
+ *canfixbyremove = NULL;
return 0;
} /* if (dependency) {...} else {...} */
const char *pdesc, *p;
int l;
- pdesc= pkg->installed.valid ? pkg->installed.description : 0;
+ pdesc = pkg->installed.valid ? pkg->installed.description : NULL;
if (!pdesc) pdesc= _("(no description available)");
p= strchr(pdesc,'\n');
if (!p) p= pdesc+strlen(pdesc);
"installation. The installation can probably be completed by retrying it;\n"
"the packages can be removed using dselect or dpkg --remove:\n")
}, {
- 0
+ NULL
}
};
modstatdb_init(admindir,msdbrw_readonly|msdbrw_noavail);
totalcount= 0;
- sectionentries= 0;
+ sectionentries = NULL;
sects= 0;
it= iterpkgstart();
while ((pkg= iterpkgnext(it))) {
if (totalcount <= 12) {
it= iterpkgstart();
while ((pkg= iterpkgnext(it))) {
- if (!yettobeunpacked(pkg,0)) continue;
+ if (!yettobeunpacked(pkg, NULL))
+ continue;
describebriefly(pkg);
}
iterpkgend(it);
if (verrev_buf->epoch == ~0UL) {
verrev_buf->epoch= 0;
verrev_buf->version= nfstrsave(reqversion);
- verrev_buf->revision= 0;
+ verrev_buf->revision = NULL;
}
pkg= findpackage("dpkg");
switch (pkg->status) {
}
void assertpredep(const char *const *argv) {
- static struct versionrevision predepversion = {~0UL,0,0};
+ static struct versionrevision predepversion = { ~0UL, NULL, NULL };
assertversion(argv,&predepversion,"1.1.0");
}
void assertepoch(const char *const *argv) {
- static struct versionrevision epochversion = {~0UL,0,0};
+ static struct versionrevision epochversion = { ~0UL, NULL, NULL };
assertversion(argv,&epochversion,"1.4.0.7");
}
void assertlongfilenames(const char *const *argv) {
- static struct versionrevision epochversion = {~0UL,0,0};
+ static struct versionrevision epochversion = { ~0UL, NULL, NULL };
assertversion(argv,&epochversion,"1.4.1.17");
}
void assertmulticonrep(const char *const *argv) {
- static struct versionrevision epochversion = {~0UL,0,0};
+ static struct versionrevision epochversion = { ~0UL, NULL, NULL };
assertversion(argv,&epochversion,"1.4.1.19");
}
static struct varbuf vb;
struct pkgiterator *it;
- struct pkginfo *pkg= 0, *startpkg, *trypkg;
+ struct pkginfo *pkg = NULL, *startpkg, *trypkg;
struct dependency *dep;
struct deppossi *possi, *provider;
modstatdb_init(admindir,msdbrw_readonly);
clear_istobes(); /* We use clientdata->istobe to detect loops */
- for (it=iterpkgstart(), dep=0;
+ for (it = iterpkgstart(), dep = NULL;
!dep && (pkg=iterpkgnext(it));
) {
if (pkg->want != want_install) continue; /* Ignore packages user doesn't want */
pkg->clientdata->istobe= itb_preinstall;
for (dep= pkg->available.depends; dep; dep= dep->next) {
if (dep->type != dep_predepends) continue;
- if (depisok(dep,&vb,0,1)) continue;
+ if (depisok(dep, &vb, NULL, 1))
+ continue;
break; /* This will leave dep non-NULL, and so exit the loop. */
}
pkg->clientdata->istobe= itb_normal;
*/
do {
/* We search for a package which would satisfy dep, and put it in pkg */
- for (possi=dep->list, pkg=0;
+ for (possi = dep->list, pkg = NULL;
!pkg && possi;
possi=possi->next) {
trypkg= possi->ed;
pkg->clientdata->istobe= itb_preinstall;
for (dep= pkg->available.depends; dep; dep= dep->next) {
if (dep->type != dep_predepends) continue;
- if (depisok(dep,&vb,0,1)) continue;
+ if (depisok(dep, &vb, NULL, 1))
+ continue;
break; /* This will leave dep non-NULL, and so exit the loop. */
}
} while (dep);
{ ">", 1,0,0, 1,0,0 }, /* */
{ ">=", 1,0,0, 1,0,0 },
{ ">>", 1,1,0, 1,1,0 },
- { 0 }
+ { NULL }
};
const struct relationinfo *rip;
const char *what;
};
-static struct error_report *reports=0;
+static struct error_report *reports = NULL;
static struct error_report **lastreport= &reports;
static struct error_report emergency;
nr= &emergency;
}
nr->what= arg;
- nr->next= 0;
+ nr->next = NULL;
*lastreport= nr;
lastreport= &nr->next;
static int allpackagesdone= 0;
static int nfiles= 0;
-static struct diversion *diversions= 0;
-static FILE *diversionsfile= 0;
-static FILE *statoverridefile= 0;
+static struct diversion *diversions = NULL;
+static FILE *diversionsfile = NULL;
+static FILE *statoverridefile = NULL;
void note_must_reread_files_inpackage(struct pkginfo *pkg) {
allpackagesdone= 0;
* the list is null-pointer-terminated.
*/
packageslump->pkgs[search]= packageslump->pkgs[findlast];
- packageslump->pkgs[findlast]= 0;
+ packageslump->pkgs[findlast] = NULL;
/* This may result in an empty link in the list. This is OK. */
goto xit_search_to_delete_from_perfilenodelist;
}
* we shouldn't free them.
*/
}
- pkg->clientdata->files= 0;
+ pkg->clientdata->files = NULL;
/* Packages which aren't installed don't have a files list. */
if (pkg->status == stat_notinstalled) {
_("dpkg: serious warning: files list file for package `%.250s' missing,"
" assuming package has no files currently installed.\n"), pkg->name);
}
- pkg->clientdata->files= 0;
+ pkg->clientdata->files = NULL;
pkg->clientdata->fileslistvalid= 1;
return;
}
- push_cleanup(cu_closefd,ehflag_bombout, 0,0, 1,&fd);
+ push_cleanup(cu_closefd, ehflag_bombout, NULL, 0, 1, &fd);
if(fstat(fd, &stat_buf))
ohshite("unable to stat files list file for package `%.250s'",pkg->name);
*ptr = 0;
newent= nfmalloc(sizeof(struct fileinlist));
newent->namenode= findnamenode(thisline, fnn_nocopy);
- newent->next= 0;
+ newent->next = NULL;
*lendp= newent;
lendp= &newent->next;
thisline = nextline;
if (packageslump) {
for (; putat < PERFILEPACKAGESLUMP && packageslump->pkgs[putat];
putat++);
- if (putat >= PERFILEPACKAGESLUMP) packageslump= 0;
+ if (putat >= PERFILEPACKAGESLUMP)
+ packageslump = NULL;
}
if (!packageslump) {
packageslump= nfmalloc(sizeof(struct filepackages));
putat= 0;
}
packageslump->pkgs[putat]= pkg;
- if (++putat < PERFILEPACKAGESLUMP) packageslump->pkgs[putat]= 0;
+ if (++putat < PERFILEPACKAGESLUMP)
+ packageslump->pkgs[putat] = NULL;
}
pkg->clientdata->fileslistvalid= 1;
}
printf(_("(Reading database ... "));
}
it= iterpkgstart();
- while ((pkg= iterpkgnext(it)) != 0) ensure_packagefiles_available(pkg);
+ while ((pkg = iterpkgnext(it)) != NULL)
+ ensure_packagefiles_available(pkg);
iterpkgend(it);
allpackagesdone= 1;
file= fopen(newvb.buf,"w+");
if (!file)
ohshite(_("unable to create updated files list file for package %s"),pkg->name);
- push_cleanup(cu_closefile,ehflag_bombout, 0,0, 1,(void*)file);
+ push_cleanup(cu_closefile, ehflag_bombout, NULL, 0, 1, (void *)file);
while (list) {
if (!(leaveout && (list->namenode->flags & fnnf_elide_other_lists))) {
fputs(list->namenode->name,file);
*/
struct fileinlist *newent;
- iterptr->todo= 0;
+ iterptr->todo = NULL;
while (files) {
newent= m_malloc(sizeof(struct fileinlist));
newent->namenode= files->namenode;
struct fileinlist *todo;
todo= iterptr->todo;
- if (!todo) return 0;
+ if (!todo)
+ return NULL;
ret= todo->namenode;
iterptr->todo= todo->next;
free(todo);
setcloexec(fileno(diversionsfile), vb.buf);
for (ov= diversions; ov; ov= ov->next) {
- ov->useinstead->divert->camefrom->divert= 0;
- ov->useinstead->divert= 0;
+ ov->useinstead->divert->camefrom->divert = NULL;
+ ov->useinstead->divert = NULL;
}
- diversions= 0;
+ diversions = NULL;
if (!file) { onerr_abort--; return; }
while (fgets(linebuf,sizeof(linebuf),file)) {
if (linebuf[--l] != '\n') ohshit(_("diversions file has too-long line or EOF [i]"));
linebuf[l]= 0;
oialtname->camefrom= findnamenode(linebuf, 0);
- oialtname->useinstead= 0;
+ oialtname->useinstead = NULL;
if (!fgets(linebuf,sizeof(linebuf),file)) {
if (ferror(file)) ohshite(_("read error in diversions [ii]"));
if (linebuf[--l] != '\n') ohshit(_("diversions file has too-long line or EOF [ii]"));
linebuf[l]= 0;
oicontest->useinstead= findnamenode(linebuf, 0);
- oicontest->camefrom= 0;
+ oicontest->camefrom = NULL;
if (!fgets(linebuf,sizeof(linebuf),file)) {
if (ferror(file)) ohshite(_("read error in diversions [iii]"));
linebuf[l]= 0;
oicontest->pkg= oialtname->pkg=
- strcmp(linebuf,":") ? findpackage(linebuf) : 0;
+ strcmp(linebuf, ":") ? findpackage(linebuf) : NULL;
if (oialtname->camefrom->divert || oicontest->useinstead->divert)
ohshit(_("conflicting diversions involving `%.250s' or `%.250s'"),
struct fileiterator *iterfilestart(void) {
struct fileiterator *i;
i= m_malloc(sizeof(struct fileiterator));
- i->namenode= 0;
+ i->namenode = NULL;
i->nbinn= 0;
return i;
}
struct filenamenode *r= NULL;
while (!i->namenode) {
- if (i->nbinn >= BINS) return 0;
+ if (i->nbinn >= BINS)
+ return NULL;
i->namenode= bins[i->nbinn++];
}
r= i->namenode;
for (i=0; i<BINS; i++)
for (fnn= bins[i]; fnn; fnn= fnn->next) {
fnn->flags= 0;
- fnn->oldhash= 0;
- fnn->filestat= 0;
+ fnn->oldhash = NULL;
+ fnn->filestat = NULL;
}
}
if (*pointerp) return *pointerp;
newnode= nfmalloc(sizeof(struct filenamenode));
- newnode->packages= 0;
+ newnode->packages = NULL;
if((flags & fnn_nocopy) && name > orig_name && name[-1] == '/')
newnode->name = name - 1;
else {
newnode->name= newname;
}
newnode->flags= 0;
- newnode->next= 0;
- newnode->divert= 0;
- newnode->statoverride= 0;
- newnode->filestat= 0;
+ newnode->next = NULL;
+ newnode->divert = NULL;
+ newnode->statoverride = NULL;
+ newnode->filestat = NULL;
*pointerp= newnode;
nfiles++;
#if WITH_START_STOP_DAEMON
"start-stop-daemon",
#endif
- "install-info", "update-rc.d", 0
+ "install-info",
+ "update-rc.d",
+ NULL
};
struct stat stab;
pkg->clientdata= nfmalloc(sizeof(struct perpackagestate));
pkg->clientdata->istobe= itb_normal;
pkg->clientdata->fileslistvalid= 0;
- pkg->clientdata->files= 0;
+ pkg->clientdata->files = NULL;
}
void cu_closepipe(int argc, void **argv) {
if (!nextarg) break;
bufs[i++]= nextarg;
}
- bufs[i]= 0;
+ bufs[i] = NULL;
return bufs;
}
static void cu_restorescriptsignals(int argc, void **argv) {
int i;
for (i=0; i<NSCRIPTCATCHSIGNALS; i++) {
- if (sigaction(script_catchsignallist[i],&script_uncatchsignal[i],0)) {
+ if (sigaction(script_catchsignallist[i], &script_uncatchsignal[i], NULL)) {
fprintf(stderr,_("error un-catching signal %s: %s\n"),
strsignal(script_catchsignallist[i]),strerror(errno));
onerr_abort++;
if (sigaction(script_catchsignallist[i],&catchsig,&script_uncatchsignal[i]))
ohshite(_("unable to ignore signal %s before running script"),
strsignal(script_catchsignallist[i]));
- push_cleanup(cu_restorescriptsignals,~0, 0,0, 0);
+ push_cleanup(cu_restorescriptsignals, ~0, NULL, 0, 0);
onerr_abort--;
}
struct pkginfo *pkg;
it= iterpkgstart();
- while ((pkg= iterpkgnext(it)) != 0) {
+ while ((pkg = iterpkgnext(it)) != NULL) {
ensure_package_clientdata(pkg);
pkg->clientdata->istobe= itb_normal;
pkg->clientdata->replacingfilesandsaid= 0;
"\n"
"Options marked [*] produce a lot of output - pipe it through `less' or `more' !");
-const struct cmdinfo *cipaction= 0;
+const struct cmdinfo *cipaction = NULL;
int f_pending=0, f_recursive=0, f_alsoselect=1, f_skipsame=0, f_noact=0;
int f_autodeconf=0, f_nodebsig=0;
unsigned long f_debug=0;
int errabort = 50;
const char *admindir= ADMINDIR;
const char *instdir= "";
-struct packageinlist *ignoredependss=0;
+struct packageinlist *ignoredependss = NULL;
static const struct forceinfo {
const char *name;
{ "bad-verify", &fc_badverify },
/* FIXME: obsolete options, remove in the future. */
{ "auto-select", NULL },
- { 0 }
+ { NULL }
};
static void helponly(const struct cmdinfo *cip, const char *value) NONRETURNING;
}
p= copy;
while (*p) {
- pnerr= illegal_packagename(p,0);
+ pnerr = illegal_packagename(p, NULL);
if (pnerr) ohshite(_("--ignore-depends requires a legal package name. "
"`%.250s' is not; %s"), p, pnerr);
ni= m_malloc(sizeof(struct packageinlist));
* have a very similar structure.
*/
#define ACTION(longopt,shortopt,code,function) \
- { longopt, shortopt, 0,0,0, setaction, code, 0, (voidfnp)function }
+ { longopt, shortopt, 0, NULL, NULL, setaction, code, NULL, (voidfnp)function }
#define OBSOLETE(longopt,shortopt) \
- { longopt, shortopt, 0,0,0, setobsolete, 0, 0, 0 }
+ { longopt, shortopt, 0, NULL, NULL, setobsolete, 0, NULL, NULL }
#define ACTIONBACKEND(longopt,shortop, backend) \
- { longopt, shortop, 0,0,0, setaction, 0, (void*)backend, (voidfnp)execbackend }
+ { longopt, shortop, 0, NULL, NULL, setaction, 0, (void *)backend, (voidfnp)execbackend }
ACTION( "install", 'i', act_install, archivefiles ),
ACTION( "unpack", 0, act_unpack, archivefiles ),
ACTION( "command-fd", 'c', act_commandfd, commandfd ),
*/
- { "status-fd", 0, 1, 0, 0, setpipe, 0, &status_pipes },
- { "log", 0, 1, 0, &log_file, 0 },
- { "pending", 'a', 0, &f_pending, 0, 0, 1 },
- { "recursive", 'R', 0, &f_recursive, 0, 0, 1 },
- { "no-act", 0, 0, &f_noact, 0, 0, 1 },
- { "dry-run", 0, 0, &f_noact, 0, 0, 1 },
- { "simulate", 0, 0, &f_noact, 0, 0, 1 },
- { "no-debsig", 0, 0, &f_nodebsig, 0, 0, 1 },
- { 0, 'G', 0, &fc_downgrade, 0, 0, /* alias for --refuse */ 0 },
- { "selected-only", 'O', 0, &f_alsoselect, 0, 0, 0 },
- { "no-also-select", 'N', 0, &f_alsoselect, 0,0,0 /* fixme: remove sometime */ },
- { "skip-same-version", 'E', 0, &f_skipsame, 0, 0, 1 },
- { "auto-deconfigure", 'B', 0, &f_autodeconf, 0, 0, 1 },
+ { "status-fd", 0, 1, NULL, NULL, setpipe, 0, &status_pipes },
+ { "log", 0, 1, NULL, &log_file, NULL, 0 },
+ { "pending", 'a', 0, &f_pending, NULL, NULL, 1 },
+ { "recursive", 'R', 0, &f_recursive, NULL, NULL, 1 },
+ { "no-act", 0, 0, &f_noact, NULL, NULL, 1 },
+ { "dry-run", 0, 0, &f_noact, NULL, NULL, 1 },
+ { "simulate", 0, 0, &f_noact, NULL, NULL, 1 },
+ { "no-debsig", 0, 0, &f_nodebsig, NULL, NULL, 1 },
+ /* Alias ('G') for --refuse. */
+ { NULL, 'G', 0, &fc_downgrade, NULL, NULL, 0 },
+ { "selected-only", 'O', 0, &f_alsoselect, NULL, NULL, 0 },
+ /* FIXME: Remove ('N') sometime. */
+ { "no-also-select", 'N', 0, &f_alsoselect, NULL, NULL, 0 },
+ { "skip-same-version", 'E', 0, &f_skipsame, NULL, NULL, 1 },
+ { "auto-deconfigure", 'B', 0, &f_autodeconf, NULL, NULL, 1 },
OBSOLETE( "largemem", 0 ),
OBSOLETE( "smallmem", 0 ),
- { "root", 0, 1, 0, 0, setroot },
- { "abort-after", 0, 1, &errabort, 0, setinteger, 0 },
- { "admindir", 0, 1, 0, &admindir, 0 },
- { "instdir", 0, 1, 0, &instdir, 0 },
- { "ignore-depends", 0, 1, 0, 0, ignoredepends },
- { "force", 0, 2, 0, 0, setforce, 1 },
- { "refuse", 0, 2, 0, 0, setforce, 0 },
- { "no-force", 0, 2, 0, 0, setforce, 0 },
- { "debug", 'D', 1, 0, 0, setdebug },
- { "help", 'h', 0, 0, 0, helponly },
- { "version", 0, 0, 0, 0, versiononly },
- { "licence",/* UK spelling */ 0,0,0,0, showcopyright },
- { "license",/* US spelling */ 0,0,0,0, showcopyright },
+ { "root", 0, 1, NULL, NULL, setroot, 0 },
+ { "abort-after", 0, 1, &errabort, NULL, setinteger, 0 },
+ { "admindir", 0, 1, NULL, &admindir, NULL, 0 },
+ { "instdir", 0, 1, NULL, &instdir, NULL, 0 },
+ { "ignore-depends", 0, 1, NULL, NULL, ignoredepends, 0 },
+ { "force", 0, 2, NULL, NULL, setforce, 1 },
+ { "refuse", 0, 2, NULL, NULL, setforce, 0 },
+ { "no-force", 0, 2, NULL, NULL, setforce, 0 },
+ { "debug", 'D', 1, NULL, NULL, setdebug, 0 },
+ { "help", 'h', 0, NULL, NULL, helponly, 0 },
+ { "version", 0, 0, NULL, NULL, versiononly, 0 },
+ /* UK spelling. */
+ { "licence", 0, 0, NULL, NULL, showcopyright, 0 },
+ /* US spelling. */
+ { "license", 0, 0, NULL, NULL, showcopyright, 0 },
ACTIONBACKEND( "build", 'b', BACKEND),
ACTIONBACKEND( "contents", 'c', BACKEND),
ACTIONBACKEND( "control", 'e', BACKEND),
ACTIONBACKEND( "old", 0, BACKEND),
ACTIONBACKEND( "vextract", 'X', BACKEND),
ACTIONBACKEND( "fsys-tarfile", 0, BACKEND),
- { 0, 0 }
+ { NULL, 0, 0, NULL, NULL, NULL, 0 }
};
void execbackend(const char *const *argv) {
const char *const *arg = argv;
int pass_admindir = 0;
- while (*arg != 0) {
+ while (*arg != NULL) {
arg++; argc++;
}
if (!nargv[i])
ohshite(_("couldn't strdup in execbackend"));
}
- nargv[i] = 0;
+ nargv[i] = NULL;
execvp(cipaction->parg, nargv);
ohshite(_("failed to exec %s"), (char *)cipaction->parg);
const char **oldargs= NULL;
int argc= 1, mode= 0;
lno= 0;
- push_error_handler(&ejbuf,print_error_fatal,0);
+ push_error_handler(&ejbuf, print_error_fatal, NULL);
do { c= getc(in); if (c == '\n') lno++; } while (c != EOF && isspace(c));
if (c == EOF) break;
ptr++;
}
*ptr= 0;
- newargs[argc++] = 0;
+ newargs[argc++] = NULL;
/* We strdup each argument, but never free it, because the error messages
* contain references back to these strings. Freeing them, and reusing
actionfunction= (void (*)(const char* const*))cipaction->farg;
actionfunction(newargs);
- set_error_display(0,0);
+ set_error_display(NULL, NULL);
error_unwind(ehflag_normaltidy);
}
}
standard_startup(&ejbuf, argc, &argv, DPKG, 1, cmdinfos);
if (!cipaction) badusage(_("need an action option"));
- setvbuf(stdout,0,_IONBF,0);
+ setvbuf(stdout, NULL, _IONBF, 0);
filesdbinit();
actionfunction= (void (*)(const char* const*))cipaction->farg;
struct pkginfo *pkg;
};
-static struct pkginqueue *queuehead= 0, **queuetail= &queuehead;
+static struct pkginqueue *queuehead = NULL, **queuetail = &queuehead;
int queuelen=0, sincenothing=0, dependtry=0;
newent= m_malloc(sizeof(struct pkginqueue));
newent->pkg= pkg;
- newent->next= 0;
+ newent->next = NULL;
*queuetail= newent;
queuetail= &newent->next;
badusage(_("--%s --pending does not take any non-option arguments"),cipaction->olong);
it= iterpkgstart();
- while ((pkg= iterpkgnext(it)) != 0) {
+ while ((pkg = iterpkgnext(it)) != NULL) {
switch (cipaction->arg) {
case act_configure:
if (pkg->status != stat_unpacked && pkg->status != stat_halfconfigured)
if (!*argv)
badusage(_("--%s needs at least one package name argument"), cipaction->olong);
- while ((thisarg= *argv++) != 0) {
+ while ((thisarg = *argv++) != NULL) {
pkg= findpackage(thisarg);
if (pkg->status == stat_notinstalled) {
l= strlen(pkg->name);
default:
internerr("unknown action in duplicate");
}
- rundown->pkg= 0;
+ rundown->pkg = NULL;
} else {
rundown->pkg->clientdata->istobe= istobe;
}
}
if (ferror(stdout)) werr("stdout");
if (ferror(stderr)) werr("stderr");
- set_error_display(0,0);
+ set_error_display(NULL, NULL);
error_unwind(ehflag_normaltidy);
}
}
debug(dbg_depcon, " checking Breaks");
- breaks_check_target(aemsgs, &ok, pkg, pkg, 0);
+ breaks_check_target(aemsgs, &ok, pkg, pkg, NULL);
for (dep= pkg->installed.depends; dep; dep= dep->next) {
if (dep->type != dep_provides) continue;
debug(dbg_depcondetail," break cycle so ok and found");
found= 3; break;
}
- thisf= deppossi_ok_found(possi->ed,pkg,removing,0,
+ thisf = deppossi_ok_found(possi->ed, pkg, removing, NULL,
&matched,possi,&interestingwarnings,&oemsgs);
if (thisf > found) found= thisf;
if (found != 3 && possi->verrel == dvr_none) {
if (provider->up->type != dep_provides) continue;
debug(dbg_depcondetail," checking provider %s",provider->up->up->name);
thisf= deppossi_ok_found(provider->up->up,pkg,removing,possi->ed,
- &matched,0,&interestingwarnings,&oemsgs);
+ &matched, NULL, &interestingwarnings, &oemsgs);
if (thisf > found) found= thisf;
}
}
*/
static int p1[2];
static char cidirtmpnambuf[L_tmpnam+100];
- static char *cidirbuf=0, *reasmbuf=0;
+ static char *cidirbuf = NULL, *reasmbuf = NULL;
static struct fileinlist *newconffiles, *newfileslist;
static enum pkgstatus oldversionstatus;
static struct varbuf infofnvb, fnvb, depprobwhy;
}
if (unlink(reasmbuf) && errno != ENOENT)
ohshite(_("error ensuring `%.250s' doesn't exist"),reasmbuf);
- push_cleanup(cu_pathname,~0, 0,0, 1,(void*)reasmbuf);
+ push_cleanup(cu_pathname, ~0, NULL, 0, 1, (void *)reasmbuf);
c1= m_fork();
if (!c1) {
execlp(SPLITTER, SPLITTER, "-Qao", reasmbuf, filename, NULL);
assert(*cidir && cidirrest[-1] == '/'); cidirrest[-1]= 0;
ensure_pathname_nonexisting(cidir); cidirrest[-1]= '/';
- push_cleanup(cu_cidir,~0, 0,0, 2,(void*)cidir,(void*)cidirrest);
+ push_cleanup(cu_cidir, ~0, NULL, 0, 2, (void *)cidir, (void *)cidirrest);
c1= m_fork();
if (!c1) {
cidirrest[-1]= 0;
&pkg,NULL,NULL);
if (!pkg->files) {
pkg->files= nfmalloc(sizeof(struct filedetails));
- pkg->files->next= 0;
- pkg->files->name= pkg->files->msdosname= pkg->files->md5sum= 0;
+ pkg->files->next = NULL;
+ pkg->files->name = pkg->files->msdosname = pkg->files->md5sum = NULL;
}
/* Always nfmalloc. Otherwise, we may overwrite some other field(like md5sum). */
pkg->files->size= nfmalloc(30);
deconpiltemp= deconpil->next;
free(deconpil);
}
- deconfigure= 0;
+ deconfigure = NULL;
clear_istobes();
if (!wanttoinstall(pkg,&pkg->available.version,1)) {
/* Ignore these here. */
break;
case dep_predepends:
- if (!depisok(dsearch,&depprobwhy,0,1)) {
+ if (!depisok(dsearch, &depprobwhy, NULL, 1)) {
varbufaddc(&depprobwhy,0);
fprintf(stderr, _("dpkg: regarding %s containing %s, pre-dependency problem:\n%s"),
pfilename, pkg->name, depprobwhy.buf);
/* OK, we're going ahead. First we read the conffiles, and copy the
* hashes across.
*/
- newconffiles= 0; newconffileslastp= &newconffiles;
- push_cleanup(cu_fileslist,~0, 0, 0, 0);
+ newconffiles = NULL;
+ newconffileslastp = &newconffiles;
+ push_cleanup(cu_fileslist, ~0, NULL, 0, 0);
strcpy(cidirrest,CONFFILESFILE);
conff= fopen(cidir,"r");
if (conff) {
- push_cleanup(cu_closefile,ehflag_bombout, 0,0, 1,(void*)conff);
+ push_cleanup(cu_closefile, ehflag_bombout, NULL, 0, 1, (void *)conff);
while (fgets(conffilenamebuf,MAXCONFFILENAME-2,conff)) {
p= conffilenamebuf + strlen(conffilenamebuf);
assert(p != conffilenamebuf);
* having that file. If several packages are listed as owning
* the file we pick one at random.
*/
- searchconff= 0;
+ searchconff = NULL;
for (packageslump= newconff->namenode->packages;
packageslump;
packageslump= packageslump->more) {
pkg->eflag |= eflagf_reinstreq;
pkg->status= stat_halfconfigured;
modstatdb_note(pkg);
- push_cleanup(cu_prermupgrade,~ehflag_normaltidy, 0,0, 1,(void*)pkg);
+ push_cleanup(cu_prermupgrade, ~ehflag_normaltidy, NULL, 0, 1, (void *)pkg);
maintainer_script_alternative(pkg, PRERMFILE, "pre-removal", cidir, cidirrest,
"upgrade", "failed-upgrade");
pkg->status= stat_unpacked;
conflictor[i]->status == stat_installed)) continue;
conflictor[i]->status= stat_halfconfigured;
modstatdb_note(conflictor[i]);
- push_cleanup(cu_prerminfavour,~ehflag_normaltidy, 0,0,
+ push_cleanup(cu_prerminfavour, ~ehflag_normaltidy, NULL, 0,
2,(void*)conflictor[i],(void*)pkg);
maintainer_script_installed(conflictor[i], PRERMFILE, "pre-removal",
"remove", "in-favour", pkg->name,
pkg->status= stat_halfinstalled;
modstatdb_note(pkg);
if (oldversionstatus == stat_notinstalled) {
- push_cleanup(cu_preinstverynew,~ehflag_normaltidy, 0,0,
+ push_cleanup(cu_preinstverynew, ~ehflag_normaltidy, NULL, 0,
3,(void*)pkg,(void*)cidir,(void*)cidirrest);
maintainer_script_new(pkg->name, PREINSTFILE, "pre-installation", cidir, cidirrest,
"install", NULL);
} else if (oldversionstatus == stat_configfiles) {
- push_cleanup(cu_preinstnew,~ehflag_normaltidy, 0,0,
+ push_cleanup(cu_preinstnew, ~ehflag_normaltidy, NULL, 0,
3,(void*)pkg,(void*)cidir,(void*)cidirrest);
maintainer_script_new(pkg->name, PREINSTFILE, "pre-installation", cidir, cidirrest,
"install", versiondescribe(&pkg->installed.version,
vdew_nonambig),
NULL);
} else {
- push_cleanup(cu_preinstupgrade,~ehflag_normaltidy, 0,0,
+ push_cleanup(cu_preinstupgrade, ~ehflag_normaltidy, NULL, 0,
4,(void*)pkg,(void*)cidir,(void*)cidirrest,(void*)&oldversionstatus);
maintainer_script_new(pkg->name, PREINSTFILE, "pre-installation", cidir, cidirrest,
"upgrade", versiondescribe(&pkg->installed.version,
*/
m_pipe(p1);
- push_cleanup(cu_closepipe,ehflag_bombout, 0,0, 1,(void*)&p1[0]);
+ push_cleanup(cu_closepipe, ehflag_bombout, NULL, 0, 1, (void *)&p1[0]);
c1= m_fork();
if (!c1) {
m_dup2(p1[1],1); close(p1[0]); close(p1[1]);
}
close(p1[1]);
- newfileslist= 0; tc.newfilesp= &newfileslist;
- push_cleanup(cu_fileslist,~0, 0, 0, 0);
+ newfileslist = NULL;
+ tc.newfilesp = &newfileslist;
+ push_cleanup(cu_fileslist, ~0, NULL, 0, 0);
tc.pkg= pkg;
tc.backendpipe= p1[0];
- push_cleanup(cu_closefd,~ehflag_bombout, 0,0, 1,&tc.backendpipe);
+ push_cleanup(cu_closefd, ~ehflag_bombout, NULL, 0, 1, &tc.backendpipe);
r= TarExtractor((void*)&tc, &tf);
if (r) {
*/
pkg->status= stat_halfinstalled;
modstatdb_note(pkg);
- push_cleanup(cu_postrmupgrade,~ehflag_normaltidy, 0,0, 1,(void*)pkg);
+ push_cleanup(cu_postrmupgrade, ~ehflag_normaltidy, NULL, 0, 1, (void *)pkg);
maintainer_script_alternative(pkg, POSTRMFILE, "post-removal", cidir, cidirrest,
"upgrade", "failed-upgrade");
}
* the process a little leaner. We are only worried about new ones
* since ones that stayed the same don't really apply here.
*/
- struct fileinlist *sameas= 0;
+ struct fileinlist *sameas = NULL;
/* If we can't stat the old or new file, or it's a directory,
* we leave it up to the normal code
*/
varbufaddc(&infofnvb,0);
dsd= opendir(infofnvb.buf);
if (!dsd) ohshite(_("cannot read info directory"));
- push_cleanup(cu_closedir,~0, 0,0, 1,(void*)dsd);
- while ((de= readdir(dsd)) != 0) {
+ push_cleanup(cu_closedir, ~0, NULL, 0, 1, (void *)dsd);
+ while ((de = readdir(dsd)) != NULL) {
debug(dbg_veryverbose, "process_archive info file `%s'", de->d_name);
if (de->d_name[0] == '.') continue; /* ignore dotfiles, including `.' and `..' */
p= strrchr(de->d_name,'.'); if (!p) continue; /* ignore anything odd */
*cidirrest= 0; /* the directory itself */
dsd= opendir(cidir);
if (!dsd) ohshite(_("unable to open temp control directory"));
- push_cleanup(cu_closedir,~0, 0,0, 1,(void*)dsd);
+ push_cleanup(cu_closedir, ~0, NULL, 0, 1, (void *)dsd);
while ((de= readdir(dsd))) {
if (strchr(de->d_name,'.')) {
debug(dbg_scripts,"process_archive tmp.ci script/file `%s' contains dot",
* links (linking our deppossi's into the reverse chains)
* can be done by copy_dependency_links.
*/
- newdeplist= 0; newdeplistlastp= &newdeplist;
+ newdeplist = NULL;
+ newdeplistlastp = &newdeplist;
for (dep= pkg->available.depends; dep; dep= dep->next) {
newdep= nfmalloc(sizeof(struct dependency));
newdep->up= pkg;
- newdep->next= 0;
- newdep->list= 0; newpossilastp= &newdep->list;
+ newdep->next = NULL;
+ newdep->list = NULL;
+ newpossilastp = &newdep->list;
for (possi= dep->list; possi; possi= possi->next) {
newpossi= nfmalloc(sizeof(struct deppossi));
newpossi->up= newdep;
newpossi->ed= possi->ed;
- newpossi->next= 0; newpossi->nextrev= newpossi->backrev= 0;
+ newpossi->next = NULL;
+ newpossi->nextrev = newpossi->backrev = NULL;
newpossi->verrel= possi->verrel;
if (possi->verrel != dvr_none)
newpossi->version= possi->version;
pkg->installed.bugs = pkg->available.bugs;
/* We have to generate our own conffiles structure. */
- pkg->installed.conffiles= 0; iconffileslastp= &pkg->installed.conffiles;
+ pkg->installed.conffiles = NULL;
+ iconffileslastp = &pkg->installed.conffiles;
for (cfile= newconffiles; cfile; cfile= cfile->next) {
newiconff= nfmalloc(sizeof(struct conffile));
- newiconff->next= 0;
+ newiconff->next = NULL;
newiconff->name= nfstrsave(cfile->namenode->name);
newiconff->hash= nfstrsave(cfile->namenode->oldhash);
newiconff->obsolete= !!(cfile->namenode->flags & fnnf_obs_conff);
* with them !).
*/
it= iterpkgstart();
- while ((otherpkg= iterpkgnext(it)) != 0) {
+ while ((otherpkg = iterpkgnext(it)) != NULL) {
ensure_package_clientdata(otherpkg);
if (otherpkg == pkg ||
otherpkg->status == stat_notinstalled ||
pdep= pdep->nextrev) {
if (pdep->up->type != dep_depends && pdep->up->type != dep_predepends &&
pdep->up->type != dep_recommends) continue;
- if (depisok(pdep->up, &depprobwhy, 0,0)) continue;
+ if (depisok(pdep->up, &depprobwhy, NULL, 0))
+ continue;
varbufaddc(&depprobwhy,0);
debug(dbg_veryverbose,"process_archive cannot disappear: %s",depprobwhy.buf);
break;
if (pdep->up->type != dep_depends && pdep->up->type != dep_predepends &&
pdep->up->type != dep_recommends)
continue;
- if (depisok(pdep->up, &depprobwhy, 0,0)) continue;
+ if (depisok(pdep->up, &depprobwhy, NULL, 0))
+ continue;
varbufaddc(&depprobwhy,0);
debug(dbg_veryverbose,"process_archive cannot disappear (provides %s): %s",
providecheck->list->ed->name, depprobwhy.buf);
infodirbaseused= fnvb.used;
varbufaddc(&fnvb,0);
dsd= opendir(fnvb.buf); if (!dsd) ohshite(_("cannot read info directory"));
- push_cleanup(cu_closedir,~0, 0,0, 1,(void*)dsd);
+ push_cleanup(cu_closedir, ~0, NULL, 0, 1, (void *)dsd);
debug(dbg_general, "process_archive disappear cleaning info directory");
- while ((de= readdir(dsd)) != 0) {
+ while ((de = readdir(dsd)) != NULL) {
debug(dbg_veryverbose, "process_archive info file `%s'", de->d_name);
if (de->d_name[0] == '.') continue;
p= strrchr(de->d_name,'.'); if (!p) continue;
otherpkg->want= want_purge;
otherpkg->eflag= eflagv_ok;
- otherpkg->installed.depends= 0;
+ otherpkg->installed.depends = NULL;
otherpkg->installed.essential= 0;
- otherpkg->installed.description= otherpkg->installed.maintainer= 0;
- otherpkg->installed.installedsize= otherpkg->installed.source= 0;
- otherpkg->installed.origin= otherpkg->installed.bugs= 0;
- otherpkg->installed.architecture= 0;
- otherpkg->installed.conffiles= 0;
+ otherpkg->installed.description = otherpkg->installed.maintainer = NULL;
+ otherpkg->installed.installedsize = otherpkg->installed.source = NULL;
+ otherpkg->installed.origin = otherpkg->installed.bugs = NULL;
+ otherpkg->installed.architecture = NULL;
+ otherpkg->installed.conffiles = NULL;
blankversion(&otherpkg->installed.version);
- otherpkg->installed.arbs= 0;
+ otherpkg->installed.arbs = NULL;
otherpkg->clientdata->fileslistvalid= 0;
modstatdb_note(otherpkg);
cfile->namenode->name, divpkg ? divpkg->name : "<local>");
}
} else {
- divpkg= 0;
+ divpkg = NULL;
debug(dbg_eachfile, "process_archive looking for overwriting `%s'",
cfile->namenode->name);
}
oldpkgstatus= pkg->status;
pkg->status= stat_halfconfigured;
modstatdb_note(pkg);
- push_cleanup(cu_prermremove, ~ehflag_normaltidy, 0, 0, 2,
+ push_cleanup(cu_prermremove, ~ehflag_normaltidy, NULL, 0, 2,
(void *)pkg, (void *)&oldpkgstatus);
maintainer_script_installed(pkg, PRERMFILE, "pre-removal",
"remove", NULL);
push_checkpoint(~ehflag_bombout, ehflag_normaltidy);
reversefilelist_init(&rlistit,pkg->clientdata->files);
- leftover= 0;
+ leftover = NULL;
while ((namenode= reversefilelist_next(&rlistit))) {
debug(dbg_eachfile, "removal_bulk `%s' flags=%o",
namenode->name, namenode->flags);
infodirbaseused= fnvb.used;
varbufaddc(&fnvb,0);
dsd= opendir(fnvb.buf); if (!dsd) ohshite(_("cannot read info directory"));
- push_cleanup(cu_closedir,~0, 0,0, 1,(void*)dsd);
+ push_cleanup(cu_closedir, ~0, NULL, 0, 1, (void *)dsd);
*out_foundpostrm= 0;
debug(dbg_general, "removal_bulk cleaning info directory");
- while ((de= readdir(dsd)) != 0) {
+ while ((de = readdir(dsd)) != NULL) {
char *p;
debug(dbg_veryverbose, "removal_bulk info file `%s'", de->d_name);
push_checkpoint(~ehflag_bombout, ehflag_normaltidy);
reversefilelist_init(&rlistit,pkg->clientdata->files);
- leftover= 0;
+ leftover = NULL;
while ((namenode= reversefilelist_next(&rlistit))) {
debug(dbg_eachfile, "removal_bulk `%s' flags=%o",
namenode->name, namenode->flags);
}
static void removal_bulk_remove_configfiles(struct pkginfo *pkg) {
- static const char *const removeconffexts[]= { REMOVECONFFEXTS, 0 };
+ static const char *const removeconffexts[] = { REMOVECONFFEXTS, NULL };
int r, removevbbase;
int conffnameused, conffbasenamelen;
char *conffbasename;
* are involved in diversions, except if we are the package doing the
* diverting.
*/
- for (lconffp= &pkg->installed.conffiles; (conff= *lconffp) != 0; ) {
+ for (lconffp = &pkg->installed.conffiles; (conff = *lconffp) != NULL; ) {
for (searchfile= pkg->clientdata->files;
searchfile && strcmp(searchfile->namenode->name,conff->name);
searchfile= searchfile->next);
fnvb.buf, conff->name);
}
debug(dbg_conffdetail, "removal_bulk conffile cleaning dsd %s", fnvb.buf);
- push_cleanup(cu_closedir,~0, 0,0, 1,(void*)dsd);
+ push_cleanup(cu_closedir, ~0, NULL, 0, 1, (void *)dsd);
*p= '/';
conffbasenamelen= strlen(++p);
conffbasename= fnvb.buf+conffnameused-conffbasenamelen;
- while ((de= readdir(dsd)) != 0) {
+ while ((de = readdir(dsd)) != NULL) {
debug(dbg_stupidlyverbose, "removal_bulk conffile dsd entry=`%s'"
" conffbasename=`%s' conffnameused=%d conffbasenamelen=%d",
de->d_name, conffbasename, conffnameused, conffbasenamelen);
}
- pkg->installed.conffiles= 0;
+ pkg->installed.conffiles = NULL;
modstatdb_note(pkg);
maintainer_script_installed(pkg, POSTRMFILE, "post-removal",
/* This will mess up reverse links, but if we follow them
* we won't go back because pkg->status is stat_notinstalled.
*/
- pkg->installed.depends= 0;
+ pkg->installed.depends = NULL;
pkg->installed.essential= 0;
- pkg->installed.description= pkg->installed.maintainer= 0;
- pkg->installed.source= pkg->installed.installedsize= 0;
- pkg->installed.origin= pkg->installed.bugs= 0;
- pkg->installed.architecture= 0;
+ pkg->installed.description = pkg->installed.maintainer = NULL;
+ pkg->installed.source = pkg->installed.installedsize = NULL;
+ pkg->installed.origin = pkg->installed.bugs = NULL;
+ pkg->installed.architecture = NULL;
blankversion(&pkg->installed.version);
- pkg->installed.arbs= 0;
+ pkg->installed.arbs = NULL;
}
pkg->eflag= eflagv_ok;
varbufaddc(&vb,0);
if (cipaction->arg == act_avmerge)
- parsedb(vb.buf, pdb_recordavailable|pdb_rejectstatus, 0,0,0);
+ parsedb(vb.buf, pdb_recordavailable | pdb_rejectstatus, NULL, NULL, NULL);
if (cipaction->arg != act_avclear)
- count+= parsedb(sourcefile, pdb_recordavailable|pdb_rejectstatus, 0,0,0);
+ count += parsedb(sourcefile, pdb_recordavailable | pdb_rejectstatus,
+ NULL, NULL, NULL);
if (!f_noact) {
writedb(vb.buf,1,0);
static void
xgettimeofday(struct timeval *tv)
{
- if (gettimeofday(tv,0) != 0)
+ if (gettimeofday(tv, NULL) != 0)
fatal("gettimeofday failed: %s", strerror(errno));
}
for (;;) {
c = getopt_long(argc, argv, "HKSVa:n:op:qr:s:tu:vx:c:N:k:bmR:g:d:",
- longopts, (int *) 0);
+ longopts, NULL);
if (c == -1)
break;
switch (c) {
kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
- if (kd == 0)
+ if (kd == NULL)
errx(1, "%s", errbuf);
- if ((kp = kvm_getprocs(kd, KERN_PROC_PID, pid, &nentries)) == 0)
+ if ((kp = kvm_getprocs(kd, KERN_PROC_PID, pid, &nentries)) == NULL)
errx(1, "%s", kvm_geterr(kd));
- if ((pid_argv_p = kvm_getargv(kd, kp, argv_len)) == 0)
+ if ((pid_argv_p = kvm_getargv(kd, kp, argv_len)) == NULL)
errx(1, "%s", kvm_geterr(kd));
start_argv_0_p = *pid_argv_p;
kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
- if (kd == 0)
+ if (kd == NULL)
errx(1, "%s", errbuf);
- if ((kp = kvm_getprocs(kd, KERN_PROC_PID, pid, &nentries)) == 0)
+ if ((kp = kvm_getprocs(kd, KERN_PROC_PID, pid, &nentries)) == NULL)
errx(1, "%s", kvm_geterr(kd));
if (kp->kp_proc.p_cred )
kvm_read(kd, (u_long)&(kp->kp_proc.p_cred->p_ruid),
char errbuf[_POSIX2_LINE_MAX], *pidexec;
kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
- if (kd == 0)
+ if (kd == NULL)
errx(1, "%s", errbuf);
- if ((kp = kvm_getprocs(kd, KERN_PROC_PID, pid, &nentries)) == 0)
+ if ((kp = kvm_getprocs(kd, KERN_PROC_PID, pid, &nentries)) == NULL)
errx(1, "%s", kvm_geterr(kd));
pidexec = (&kp->kp_proc)->p_comm;
if (strlen(name) != strlen(pidexec))
interval.tv_usec <= MIN_POLL_INTERVAL)
interval.tv_usec = MIN_POLL_INTERVAL;
- r = select(0,0,0,0,&interval);
+ r = select(0, NULL, NULL, NULL, &interval);
if (r < 0 && errno != EINTR)
fatal("select() failed for pause: %s",
strerror(errno));