From owner-svn-src-head@FreeBSD.ORG Mon May 14 09:53:54 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DF9711065674; Mon, 14 May 2012 09:53:54 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BF6F28FC19; Mon, 14 May 2012 09:53:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4E9rsWW025671; Mon, 14 May 2012 09:53:54 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4E9rsbB025667; Mon, 14 May 2012 09:53:54 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201205140953.q4E9rsbB025667@svn.freebsd.org> From: Gabor Kovesdan Date: Mon, 14 May 2012 09:53:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235432 - head/usr.bin/sort X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 May 2012 09:53:55 -0000 Author: gabor Date: Mon May 14 09:53:54 2012 New Revision: 235432 URL: http://svn.freebsd.org/changeset/base/235432 Log: - Fix build with clang Modified: head/usr.bin/sort/file.c head/usr.bin/sort/sort.c Modified: head/usr.bin/sort/file.c ============================================================================== --- head/usr.bin/sort/file.c Mon May 14 09:51:43 2012 (r235431) +++ head/usr.bin/sort/file.c Mon May 14 09:53:54 2012 (r235432) @@ -598,7 +598,7 @@ openfile(const char *fn, const char *mod snprintf(cmd, cmdsz - 1, "%s > %s", compress_program, fn); else - err(2, getstr(7)); + err(2, "%s", getstr(7)); if ((file = popen(cmd, mode)) == NULL) err(2, NULL); @@ -939,7 +939,7 @@ file_header_init(struct file_header **fh (*fh)->fr = file_reader_init(fn); if ((*fh)->fr == NULL) { perror(fn); - err(2, getstr(8)); + err(2, "%s", getstr(8)); } line = file_reader_readline((*fh)->fr); if (line == NULL) { @@ -1276,7 +1276,7 @@ sort_list_to_file(struct sort_list *list sort_opts_vals.sort_method = SORT_RADIXSORT; } else if (sort_opts_vals.sort_method == SORT_RADIXSORT) - err(2, getstr(9)); + err(2, "%s", getstr(9)); /* * to handle stable sort and the unique cases in the @@ -1292,7 +1292,7 @@ sort_list_to_file(struct sort_list *list sort_opts_vals.sort_method = SORT_MERGESORT; break; default: - errx(2, getstr(10)); + errx(2, "%s", getstr(10)); }; } Modified: head/usr.bin/sort/sort.c ============================================================================== --- head/usr.bin/sort/sort.c Mon May 14 09:51:43 2012 (r235431) +++ head/usr.bin/sort/sort.c Mon May 14 09:53:54 2012 (r235432) @@ -74,9 +74,9 @@ MD5_CTX md5_ctx; * is found. */ const char *nlsstr[] = { "", -/* 1*/"you cannot use -%c and -%c together", +/* 1*/"mutually exclusive flags", /* 2*/"extra argument not allowed with -c", -/* 3*/"Unknown feature: %s", +/* 3*/"Unknown feature", /* 4*/"Wrong memory buffer specification", /* 5*/"0 field in key specs", /* 6*/"0 column in key specs", @@ -396,7 +396,7 @@ parse_memory_buffer_value(const char *va membuf = strtoll(value, &endptr, 10); if (errno != 0) { - warn(getstr(4)); + warn("%s",getstr(4)); membuf = available_free_memory; } else { switch (*endptr){ @@ -445,12 +445,10 @@ parse_memory_buffer_value(const char *va * Signal handler that clears the temporary files. */ static void -sig_handler(int sig, siginfo_t *siginfo, void *context) +sig_handler(int sig __unused, siginfo_t *siginfo __unused, + void *context __unused) { - sig = sig; - siginfo = siginfo; - context = context; clear_tmp_files(); exit(-1); } @@ -512,7 +510,7 @@ static void unknown(const char *what) { - errx(2, getstr(3), what); + errx(2, "%s: %s", getstr(3), what); } /* @@ -533,14 +531,13 @@ check_mutually_exclusive_flags(char c, b if (mec != c) { if (mef_flags[i]) { if (found_this) - errx(1, getstr(1), c, mec); + errx(1, "%c:%c: %s", c, mec, getstr(1)); found_others = true; fo_index = i; } } else { if (found_others) - errx(1, getstr(1), c, - mutually_exclusive_flags[fo_index]); + errx(1, "%c:%c: %s", c, mutually_exclusive_flags[fo_index], getstr(1)); mef_flags[i] = true; found_this = true; } @@ -661,7 +658,7 @@ parse_pos(const char *s, struct key_spec if (errno != 0) errx(2, "%s: -k", strerror(errno)); if (ks->f2 == 0) { - warn(getstr(5)); + warn("%s",getstr(5)); goto end; } } else { @@ -670,7 +667,7 @@ parse_pos(const char *s, struct key_spec if (errno != 0) errx(2, "%s: -k", strerror(errno)); if (ks->f1 == 0) { - warn(getstr(5)); + warn("%s",getstr(5)); goto end; } } @@ -693,7 +690,7 @@ parse_pos(const char *s, struct key_spec if (errno != 0) errx(2, "%s: -k", strerror(errno)); if (ks->c1 == 0) { - warn(getstr(6)); + warn("%s",getstr(6)); goto end; } } @@ -814,7 +811,7 @@ parse_pos_obs(const char *s, int *nf, in errno = 0; *nf = (size_t) strtoul(f, NULL, 10); if (errno != 0) - errx(2, getstr(11)); + errx(2, "%s", getstr(11)); if (pmatch[2].rm_eo > pmatch[2].rm_so) { len = pmatch[2].rm_eo - pmatch[2].rm_so - 1; @@ -826,7 +823,7 @@ parse_pos_obs(const char *s, int *nf, in errno = 0; *nc = (size_t) strtoul(c, NULL, 10); if (errno != 0) - errx(2, getstr(11)); + errx(2, "%s", getstr(11)); } if (pmatch[3].rm_eo > pmatch[3].rm_so) { @@ -1054,7 +1051,7 @@ main(int argc, char **argv) case 'o': outfile = sort_realloc(outfile, sizeof(char) * (strlen(optarg) + 1)); - strlcpy(outfile, optarg, (strlen(optarg) + 1)); + strlcpy(outfile, optarg, strlen(outfile)); break; case 's': sort_opts_vals.sflag = true; @@ -1183,7 +1180,7 @@ main(int argc, char **argv) #endif if (sort_opts_vals.cflag && sort_opts_vals.mflag) - errx(1, getstr(1), 'm', 'c'); + errx(1, "%c:%c: %s", 'm', 'c', getstr(1)); #ifndef WITHOUT_NLS catclose(catalog);