util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sami Kerola <kerolasa@iki.fi>
To: util-linux@vger.kernel.org
Cc: kerolasa@iki.fi
Subject: [PATCH 06/14] pg: add const qualifiers where suitable
Date: Mon,  8 Oct 2012 08:08:12 +0100	[thread overview]
Message-ID: <1349680100-18120-7-git-send-email-kerolasa@iki.fi> (raw)
In-Reply-To: <1349680100-18120-1-git-send-email-kerolasa@iki.fi>

Includes a fix also to one assignment warning (see below).

text-utils/pg.c:1477:24: warning: assignment discards 'const' qualifier \
from pointer target type [enabled by default]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 text-utils/pg.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/text-utils/pg.c b/text-utils/pg.c
index 9f95eac..0168ebc 100644
--- a/text-utils/pg.c
+++ b/text-utils/pg.c
@@ -134,7 +134,7 @@ int		fflag;			/* do not split lines */
 int		nflag;			/* no newline for commands required */
 int		rflag;			/* "restricted" pg */
 int		sflag;			/* use standout mode */
-char		*pstring = ":";		/* prompt string */
+const char	*pstring = ":";		/* prompt string */
 char		*searchfor;		/* search pattern from argv[] */
 int		havepagelen;		/* page length is manually defined */
 long		startline;		/* start line from argv[] */
@@ -241,14 +241,14 @@ static void usage(FILE * out)
 }
 
 static void
-needarg(char *s)
+needarg(const char *s)
 {
 	warnx(_("option requires an argument -- %s"), s);
 	usage(stderr);
 }
 
 static void
-invopt(char *s)
+invopt(const char *s)
 {
 	warnx(_("illegal option -- %s"), s);
 	usage(stderr);
@@ -295,7 +295,7 @@ outcap(int i)
  * Write messages to terminal.
  */
 static void
-mesg(char *message)
+mesg(const char *message)
 {
 	if (ontty == 0)
 		return;
@@ -927,7 +927,7 @@ makepat(void)
  * Process errors that occurred in temporary file operations.
  */
 static void
-tmperr(FILE *f, char *ftype)
+tmperr(FILE *f, const char *ftype)
 {
 	if (ferror(f))
 		warn(_("Read error from %s file"), ftype);
@@ -946,7 +946,7 @@ tmperr(FILE *f, char *ftype)
  * Beware: long and ugly.
  */
 static void
-pgfile(FILE *f, char *name)
+pgfile(FILE *f, const char *name)
 {
 	off_t pos, oldpos, fpos;
 	off_t line = 0, fline = 0, bline = 0, oldline = 0, eofline = 0;
@@ -1465,7 +1465,7 @@ found_bw:
 					switch (cpid = fork()) {
 					case 0:
 						p = getenv("SHELL");
-						if (p == NULL) p = "/bin/sh";
+						if (p == NULL) p = xstrdup("/bin/sh");
 						if (!nobuf)
 							fclose(fbuf);
 						fclose(find);
-- 
1.7.12.2


  parent reply	other threads:[~2012-10-08  7:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-08  7:08 [PATCH 00/14] various: clean ups and fixes Sami Kerola
2012-10-08  7:08 ` [PATCH 01/14] ddate: remove from util-linux Sami Kerola
2012-10-08  9:06   ` Petr Uzel
2012-10-08  7:08 ` [PATCH 02/14] column: add --output-separator option Sami Kerola
2012-10-08  7:08 ` [PATCH 03/14] docs: fix column.1 groff syntax error Sami Kerola
2012-10-08  7:08 ` [PATCH 04/14] pg: refactor argument handing Sami Kerola
2012-10-08  7:08 ` [PATCH 05/14] pg: use libc error printing facilities Sami Kerola
2012-10-08  7:08 ` Sami Kerola [this message]
2012-10-08  7:08 ` [PATCH 07/14] pg: add noreturn function attributes Sami Kerola
2012-10-08  7:08 ` [PATCH 08/14] pg: use unistd.h STDOUT_FILENO Sami Kerola
2012-10-08  7:08 ` [PATCH 09/14] pg: do not turn off warnigns artificially Sami Kerola
2012-10-08  7:08 ` [PATCH 10/14] pg: fix coding style Sami Kerola
2012-10-08  7:08 ` [PATCH 11/14] more: " Sami Kerola
2012-10-08  7:08 ` [PATCH 12/14] more: align void in functions with prototypes, and remove void casts Sami Kerola
2012-10-08  7:08 ` [PATCH 13/14] more: remove few memory leaks Sami Kerola
2012-10-08  7:08 ` [PATCH 14/14] swapon: remove loop declaration [smatch scan] Sami Kerola

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349680100-18120-7-git-send-email-kerolasa@iki.fi \
    --to=kerolasa@iki.fi \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).