From c94931edf30d81eb9084c24694ba4af15517fdad Mon Sep 17 00:00:00 2001 From: alfred Date: Sat, 11 May 2002 04:17:55 +0000 Subject: replace __FUNCTION__ with standardized __func__. Requested by: jhb --- usr.sbin/pkg_install/add/extract.c | 20 ++++++++++---------- usr.sbin/pkg_install/create/perform.c | 26 +++++++++++++------------- usr.sbin/pkg_install/create/pl.c | 8 ++++---- usr.sbin/pkg_install/delete/perform.c | 12 ++++++------ usr.sbin/pkg_install/info/show.c | 2 +- usr.sbin/pkg_install/lib/deps.c | 2 +- usr.sbin/pkg_install/lib/file.c | 18 +++++++++--------- usr.sbin/pkg_install/lib/match.c | 8 ++++---- usr.sbin/pkg_install/lib/pen.c | 14 +++++++------- usr.sbin/pkg_install/lib/plist.c | 4 ++-- usr.sbin/pkg_install/sign/pgp_sign.c | 2 +- 11 files changed, 58 insertions(+), 58 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/pkg_install/add/extract.c b/usr.sbin/pkg_install/add/extract.c index 8771190..f74a90b 100644 --- a/usr.sbin/pkg_install/add/extract.c +++ b/usr.sbin/pkg_install/add/extract.c @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); cleanup(0); \ errx(2, \ "%s: can not invoke %ld byte tar pipeline: %s", \ - __FUNCTION__, \ + __func__, \ (long)strlen(where_args), where_args); \ } \ strcpy(where_args, STARTSTRING); \ @@ -90,12 +90,12 @@ extract_plist(const char *home, Package *pkg) where_args = alloca(maxargs); if (!where_args) { cleanup(0); - errx(2, "%s: can't get argument list space", __FUNCTION__); + errx(2, "%s: can't get argument list space", __func__); } perm_args = alloca(maxargs); if (!perm_args) { cleanup(0); - errx(2, "%s: can't get argument list space", __FUNCTION__); + errx(2, "%s: can't get argument list space", __func__); } strcpy(where_args, STARTSTRING); @@ -132,7 +132,7 @@ extract_plist(const char *home, Package *pkg) if (strrchr(p->name,'\'')) { cleanup(0); - errx(2, "%s: Bogus filename \"%s\"", __FUNCTION__, p->name); + errx(2, "%s: Bogus filename \"%s\"", __func__, p->name); } /* first try to rename it into place */ @@ -161,7 +161,7 @@ extract_plist(const char *home, Package *pkg) add_count = snprintf(&perm_args[perm_count], maxargs - perm_count, "'%s' ", p->name); if (add_count < 0 || add_count > maxargs - perm_count) { cleanup(0); - errx(2, "%s: oops, miscounted strings!", __FUNCTION__); + errx(2, "%s: oops, miscounted strings!", __func__); } perm_count += add_count; } @@ -181,7 +181,7 @@ extract_plist(const char *home, Package *pkg) add_count = snprintf(&where_args[where_count], maxargs - where_count, " '%s'", p->name); if (add_count < 0 || add_count > maxargs - where_count) { cleanup(0); - errx(2, "%s: oops, miscounted strings!", __FUNCTION__); + errx(2, "%s: oops, miscounted strings!", __func__); } where_count += add_count; add_count = snprintf(&perm_args[perm_count], @@ -189,7 +189,7 @@ extract_plist(const char *home, Package *pkg) "'%s' ", p->name); if (add_count < 0 || add_count > maxargs - perm_count) { cleanup(0); - errx(2, "%s: oops, miscounted strings!", __FUNCTION__); + errx(2, "%s: oops, miscounted strings!", __func__); } perm_count += add_count; } @@ -203,7 +203,7 @@ extract_plist(const char *home, Package *pkg) if (strcmp(p->name, ".")) { if (!Fake && make_hierarchy(p->name) == FAIL) { cleanup(0); - errx(2, "%s: unable to cwd to '%s'", __FUNCTION__, p->name); + errx(2, "%s: unable to cwd to '%s'", __func__, p->name); } Directory = p->name; } @@ -216,12 +216,12 @@ extract_plist(const char *home, Package *pkg) strstr(p->name, "%f")) && last_file == NULL) { cleanup(0); errx(2, "%s: no last file specified for '%s' command", - __FUNCTION__, p->name); + __func__, p->name); } if (strstr(p->name, "%D") && Directory == NULL) { cleanup(0); errx(2, "%s: no directory specified for '%s' command", - __FUNCTION__, p->name); + __func__, p->name); } format_cmd(cmd, p->name, Directory, last_file); PUSHOUT(Directory); diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c index 0c6ebdc..619e749 100644 --- a/usr.sbin/pkg_install/create/perform.c +++ b/usr.sbin/pkg_install/create/perform.c @@ -95,7 +95,7 @@ pkg_perform(char **pkgs) if (!pkg_in) { cleanup(0); errx(2, "%s: unable to open contents file '%s' for input", - __FUNCTION__, Contents); + __func__, Contents); } } plist.head = plist.tail = NULL; @@ -119,7 +119,7 @@ pkg_perform(char **pkgs) /* Create easy to use NULL-terminated list */ deps = alloca(sizeof(*deps) * ndeps + 1); if (deps == NULL) { - errx(2, "%s: alloca() failed", __FUNCTION__); + errx(2, "%s: alloca() failed", __func__); /* Not reached */ } for (i = 0; Pkgdeps;) { @@ -176,7 +176,7 @@ pkg_perform(char **pkgs) if (asprintf(&cp, "PKG_FORMAT_REVISION:%d.%d", PLIST_FMT_VER_MAJOR, PLIST_FMT_VER_MINOR) == -1) { - errx(2, "%s: asprintf() failed", __FUNCTION__); + errx(2, "%s: asprintf() failed", __func__); } add_plist_top(&plist, PLIST_COMMENT, cp); free(cp); @@ -257,13 +257,13 @@ pkg_perform(char **pkgs) if (!fp) { cleanup(0); errx(2, "%s: can't open file %s for writing", - __FUNCTION__, CONTENTS_FNAME); + __func__, CONTENTS_FNAME); } write_plist(&plist, fp); if (fclose(fp)) { cleanup(0); errx(2, "%s: error while closing %s", - __FUNCTION__, CONTENTS_FNAME); + __func__, CONTENTS_FNAME); } /* And stick it into a tar ball */ @@ -328,11 +328,11 @@ make_dist(const char *homedir, const char *pkg, const char *suff, Package *plist /* Set up a pipe for passing the filenames, and fork off a tar process. */ if (pipe(pipefds) == -1) { cleanup(0); - errx(2, "%s: cannot create pipe", __FUNCTION__); + errx(2, "%s: cannot create pipe", __func__); } if ((pid = fork()) == -1) { cleanup(0); - errx(2, "%s: cannot fork process for tar", __FUNCTION__); + errx(2, "%s: cannot fork process for tar", __func__); } if (pid == 0) { /* The child */ dup2(pipefds[0], 0); @@ -340,14 +340,14 @@ make_dist(const char *homedir, const char *pkg, const char *suff, Package *plist close(pipefds[1]); execv("/usr/bin/tar", (char * const *)(uintptr_t)args); cleanup(0); - errx(2, "%s: failed to execute tar command", __FUNCTION__); + errx(2, "%s: failed to execute tar command", __func__); } /* Meanwhile, back in the parent process ... */ close(pipefds[0]); if ((totar = fdopen(pipefds[1], "w")) == NULL) { cleanup(0); - errx(2, "%s: fdopen failed", __FUNCTION__); + errx(2, "%s: fdopen failed", __func__); } fprintf(totar, "%s\n", CONTENTS_FNAME); @@ -383,7 +383,7 @@ make_dist(const char *homedir, const char *pkg, const char *suff, Package *plist /* assume either signal or bad exit is enough for us */ if (ret) { cleanup(0); - errx(2, "%s: tar command failed with code %d", __FUNCTION__, ret); + errx(2, "%s: tar command failed with code %d", __func__, ret); } } @@ -393,17 +393,17 @@ sanity_check() if (!Comment) { cleanup(0); errx(2, "%s: required package comment string is missing (-c comment)", - __FUNCTION__); + __func__); } if (!Desc) { cleanup(0); errx(2, "%s: required package description string is missing (-d desc)", - __FUNCTION__); + __func__); } if (!Contents) { cleanup(0); errx(2, "%s: required package contents list is missing (-f [-]file)", - __FUNCTION__); + __func__); } } diff --git a/usr.sbin/pkg_install/create/pl.c b/usr.sbin/pkg_install/create/pl.c index 0859e1f..9970249 100644 --- a/usr.sbin/pkg_install/create/pl.c +++ b/usr.sbin/pkg_install/create/pl.c @@ -102,7 +102,7 @@ trylink(const char *from, const char *to) strcat(where_args, "|tar xpf -"); \ if (system(where_args)) { \ cleanup(0); \ - errx(2, "%s: can't invoke tar pipeline", __FUNCTION__); \ + errx(2, "%s: can't invoke tar pipeline", __func__); \ } \ memset(where_args, 0, maxargs); \ last_chdir = NULL; \ @@ -134,7 +134,7 @@ copy_plist(const char *home, Package *plist) where_args = malloc(maxargs); if (!where_args) { cleanup(0); - errx(2, "%s: can't get argument list space", __FUNCTION__); + errx(2, "%s: can't get argument list space", __func__); } memset(where_args, 0, maxargs); @@ -203,7 +203,7 @@ copy_plist(const char *home, Package *plist) } if (add_count < 0 || add_count > maxargs - where_count) { cleanup(0); - errx(2, "%s: oops, miscounted strings!", __FUNCTION__); + errx(2, "%s: oops, miscounted strings!", __func__); } where_count += add_count; } @@ -241,7 +241,7 @@ copy_plist(const char *home, Package *plist) p->name); if (add_count < 0 || add_count > maxargs - where_count) { cleanup(0); - errx(2, "%s: oops, miscounted strings!", __FUNCTION__); + errx(2, "%s: oops, miscounted strings!", __func__); } where_count += add_count; last_chdir = (mythere ? mythere : where); diff --git a/usr.sbin/pkg_install/delete/perform.c b/usr.sbin/pkg_install/delete/perform.c index ffbfbd9..a4f8370 100644 --- a/usr.sbin/pkg_install/delete/perform.c +++ b/usr.sbin/pkg_install/delete/perform.c @@ -77,14 +77,14 @@ pkg_perform(char **pkgs) */ rbtmp = rb = alloca((errcode + 1) * sizeof(*rb)); if (rb == NULL) { - warnx("%s(): alloca() failed", __FUNCTION__); + warnx("%s(): alloca() failed", __func__); err_cnt++; continue; } STAILQ_FOREACH(rb_entry, rb_list, link) { *rbtmp = alloca(strlen(rb_entry->pkgname) + 1); if (*rbtmp == NULL) { - warnx("%s(): alloca() failed", __FUNCTION__); + warnx("%s(): alloca() failed", __func__); err_cnt++; continue; } @@ -140,7 +140,7 @@ pkg_do(char *pkg) if (!getcwd(home, FILENAME_MAX)) { cleanup(0); - errx(2, "%s: unable to get current working directory!", __FUNCTION__); + errx(2, "%s: unable to get current working directory!", __func__); } if (chdir(LogDir) == FAIL) { @@ -240,7 +240,7 @@ pkg_do(char *pkg) if (chdir(home) == FAIL) { cleanup(0); - errx(2, "%s: unable to return to working directory %s!", __FUNCTION__, + errx(2, "%s: unable to return to working directory %s!", __func__, home); } @@ -273,7 +273,7 @@ pkg_do(char *pkg) if (chdir(home) == FAIL) { cleanup(0); - errx(2, "%s: unable to return to working directory %s!", __FUNCTION__, + errx(2, "%s: unable to return to working directory %s!", __func__, home); } @@ -301,7 +301,7 @@ sanity_check(char *pkg) { if (!fexists(CONTENTS_FNAME)) { cleanup(0); - errx(2, "%s: installed package %s has no %s file!", __FUNCTION__, + errx(2, "%s: installed package %s has no %s file!", __func__, pkg, CONTENTS_FNAME); } } diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c index efeb513..e26888d 100644 --- a/usr.sbin/pkg_install/info/show.c +++ b/usr.sbin/pkg_install/info/show.c @@ -180,7 +180,7 @@ show_plist(const char *title, Package *plist, plist_t type, Boolean showall) default: cleanup(0); errx(2, "%s: unknown command type %d (%s)", - __FUNCTION__, p->type, p->name); + __func__, p->type, p->name); break; } p = p->next; diff --git a/usr.sbin/pkg_install/lib/deps.c b/usr.sbin/pkg_install/lib/deps.c index aea2788..cf366f0 100644 --- a/usr.sbin/pkg_install/lib/deps.c +++ b/usr.sbin/pkg_install/lib/deps.c @@ -185,7 +185,7 @@ requiredby(const char *pkgname, struct reqr_by_head **list, Boolean strict, Bool retval++; rb_entry = malloc(sizeof(*rb_entry)); if (rb_entry == NULL) { - warnx("%s(): malloc() failed", __FUNCTION__); + warnx("%s(): malloc() failed", __func__); retval = -1; break; } diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c index df87201..163517a 100644 --- a/usr.sbin/pkg_install/lib/file.c +++ b/usr.sbin/pkg_install/lib/file.c @@ -300,18 +300,18 @@ fileGetContents(const char *fname) if (stat(fname, &sb) == FAIL) { cleanup(0); - errx(2, "%s: can't stat '%s'", __FUNCTION__, fname); + errx(2, "%s: can't stat '%s'", __func__, fname); } contents = (char *)malloc(sb.st_size + 1); fd = open(fname, O_RDONLY, 0); if (fd == FAIL) { cleanup(0); - errx(2, "%s: unable to open '%s' for reading", __FUNCTION__, fname); + errx(2, "%s: unable to open '%s' for reading", __func__, fname); } if (read(fd, contents, sb.st_size) != sb.st_size) { cleanup(0); - errx(2, "%s: short read on '%s' - did not get %qd bytes", __FUNCTION__, + errx(2, "%s: short read on '%s' - did not get %qd bytes", __func__, fname, (long long)sb.st_size); } close(fd); @@ -364,17 +364,17 @@ write_file(const char *name, const char *str) fp = fopen(name, "w"); if (!fp) { cleanup(0); - errx(2, "%s: cannot fopen '%s' for writing", __FUNCTION__, name); + errx(2, "%s: cannot fopen '%s' for writing", __func__, name); } len = strlen(str); if (fwrite(str, 1, len, fp) != len) { cleanup(0); errx(2, "%s: short fwrite on '%s', tried to write %ld bytes", - __FUNCTION__, name, (long)len); + __func__, name, (long)len); } if (fclose(fp)) { cleanup(0); - errx(2, "%s: failure to fclose '%s'", __FUNCTION__, name); + errx(2, "%s: failure to fclose '%s'", __func__, name); } } @@ -389,7 +389,7 @@ copy_file(const char *dir, const char *fname, const char *to) snprintf(cmd, FILENAME_MAX, "cp -r %s/%s %s", dir, fname, to); if (vsystem(cmd)) { cleanup(0); - errx(2, "%s: could not perform '%s'", __FUNCTION__, cmd); + errx(2, "%s: could not perform '%s'", __func__, cmd); } } @@ -404,7 +404,7 @@ move_file(const char *dir, const char *fname, const char *to) snprintf(cmd, FILENAME_MAX, "mv %s/%s %s", dir, fname, to); if (vsystem(cmd)) { cleanup(0); - errx(2, "%s: could not perform '%s'", __FUNCTION__, cmd); + errx(2, "%s: could not perform '%s'", __func__, cmd); } } @@ -436,7 +436,7 @@ copy_hierarchy(const char *dir, const char *fname, Boolean to) #endif if (system(cmd)) { cleanup(0); - errx(2, "%s: could not perform '%s'", __FUNCTION__, cmd); + errx(2, "%s: could not perform '%s'", __func__, cmd); } } diff --git a/usr.sbin/pkg_install/lib/match.c b/usr.sbin/pkg_install/lib/match.c index 90b6979..5671406 100644 --- a/usr.sbin/pkg_install/lib/match.c +++ b/usr.sbin/pkg_install/lib/match.c @@ -66,7 +66,7 @@ matchinstalled(match_t MatchType, char **patterns, int *retval) if (store == NULL) { store = malloc(sizeof *store); if (store == NULL) { - warnx("%s(): malloc() failed", __FUNCTION__); + warnx("%s(): malloc() failed", __func__); if (retval != NULL) *retval = 1; return NULL; @@ -95,7 +95,7 @@ matchinstalled(match_t MatchType, char **patterns, int *retval) for (len = 0; patterns[len]; len++) {} lmatched = alloca(sizeof(*lmatched) * len); if (lmatched == NULL) { - warnx("%s(): alloca() failed", __FUNCTION__); + warnx("%s(): alloca() failed", __func__); if (retval != NULL) *retval = 1; return NULL; @@ -203,14 +203,14 @@ storeappend(struct store *store, const char *item) store->currlen * sizeof(*(store->store))); if (store->store == NULL) { store->currlen = 0; - warnx("%s(): reallocf() failed", __FUNCTION__); + warnx("%s(): reallocf() failed", __func__); return 1; } } asprintf(&(store->store[store->used]), "%s", item); if (store->store[store->used] == NULL) { - warnx("%s(): malloc() failed", __FUNCTION__); + warnx("%s(): malloc() failed", __func__); return 1; } store->used++; diff --git a/usr.sbin/pkg_install/lib/pen.c b/usr.sbin/pkg_install/lib/pen.c index 5879108..eedda00 100644 --- a/usr.sbin/pkg_install/lib/pen.c +++ b/usr.sbin/pkg_install/lib/pen.c @@ -62,7 +62,7 @@ find_play_pen(char *pen, off_t sz) errx(2, "%s: can't find enough temporary space to extract the files, please set your\n" "PKG_TMPDIR environment variable to a location with at least %ld bytes\n" -"free", __FUNCTION__, (long)sz); +"free", __func__, (long)sz); return NULL; } return pen; @@ -76,7 +76,7 @@ static void pushPen(const char *pen) { if (++pdepth == MAX_STACK) - errx(2, "%s: stack overflow.\n", __FUNCTION__); + errx(2, "%s: stack overflow.\n", __func__); pstack[pdepth] = strdup(pen); } @@ -103,11 +103,11 @@ make_playpen(char *pen, off_t sz) if (!mkdtemp(pen)) { cleanup(0); - errx(2, "%s: can't mktemp '%s'", __FUNCTION__, pen); + errx(2, "%s: can't mktemp '%s'", __func__, pen); } if (chmod(pen, 0700) == FAIL) { cleanup(0); - errx(2, "%s: can't mkdir '%s'", __FUNCTION__, pen); + errx(2, "%s: can't mkdir '%s'", __func__, pen); } if (Verbose) { @@ -120,7 +120,7 @@ make_playpen(char *pen, off_t sz) cleanup(0); errx(2, "%s: not enough free space to create '%s'.\n" "Please set your PKG_TMPDIR environment variable to a location\n" - "with more space and\ntry the command again", __FUNCTION__, pen); + "with more space and\ntry the command again", __func__, pen); } if (!getcwd(Previous, FILENAME_MAX)) { @@ -130,7 +130,7 @@ make_playpen(char *pen, off_t sz) if (chdir(pen) == FAIL) { cleanup(0); - errx(2, "%s: can't chdir to '%s'", __FUNCTION__, pen); + errx(2, "%s: can't chdir to '%s'", __func__, pen); } if (PenLocation[0]) @@ -151,7 +151,7 @@ leave_playpen() if (Previous[0]) { if (chdir(Previous) == FAIL) { cleanup(0); - errx(2, "%s: can't chdir back to '%s'", __FUNCTION__, Previous); + errx(2, "%s: can't chdir back to '%s'", __func__, Previous); } Previous[0] = '\0'; } diff --git a/usr.sbin/pkg_install/lib/plist.c b/usr.sbin/pkg_install/lib/plist.c index 0f7a010..603588e 100644 --- a/usr.sbin/pkg_install/lib/plist.c +++ b/usr.sbin/pkg_install/lib/plist.c @@ -275,7 +275,7 @@ read_plist(Package *pkg, FILE *fp) cmd = plist_cmd(pline + 1, &cp); if (cmd == FAIL) { cleanup(0); - errx(2, "%s: bad command '%s'", __FUNCTION__, pline); + errx(2, "%s: bad command '%s'", __func__, pline); } if (*cp == '\0') { cp = NULL; @@ -384,7 +384,7 @@ write_plist(Package *pkg, FILE *fp) default: cleanup(0); - errx(2, "%s: unknown command type %d (%s)", __FUNCTION__, + errx(2, "%s: unknown command type %d (%s)", __func__, plist->type, plist->name); break; } diff --git a/usr.sbin/pkg_install/sign/pgp_sign.c b/usr.sbin/pkg_install/sign/pgp_sign.c index a3d9cf1..cb7d186 100644 --- a/usr.sbin/pkg_install/sign/pgp_sign.c +++ b/usr.sbin/pkg_install/sign/pgp_sign.c @@ -232,7 +232,7 @@ handle_pgp_passphrase() int fd[2]; char *p; -printf("Short-circuiting %s\n", __FUNCTION__); +printf("Short-circuiting %s\n", __func__); return; /* Retrieve the pgp passphrase */ -- cgit v1.1