summaryrefslogtreecommitdiffstats
path: root/usr.bin/sed/main.c
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2002-05-07 23:06:47 +0000
committerjmallett <jmallett@FreeBSD.org>2002-05-07 23:06:47 +0000
commit8c85827b130d428543fc639b8117498d9e620e80 (patch)
treeea7f54ca670050cce19e287616602671ec5f5435 /usr.bin/sed/main.c
parentcc607e6c2d164e9cb79d2fdec151a8c3a151be83 (diff)
downloadFreeBSD-src-8c85827b130d428543fc639b8117498d9e620e80.zip
FreeBSD-src-8c85827b130d428543fc639b8117498d9e620e80.tar.gz
Un-shadow the `fname' variable.
Diffstat (limited to 'usr.bin/sed/main.c')
-rw-r--r--usr.bin/sed/main.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c
index 990e9aa..b4c0916 100644
--- a/usr.bin/sed/main.c
+++ b/usr.bin/sed/main.c
@@ -412,27 +412,27 @@ add_file(s)
* Modify a pointer to a filename for inplace editing and reopen stdout
*/
static int
-inplace_edit(fname)
- char **fname;
+inplace_edit(filename)
+ char **filename;
{
struct stat orig;
int input, output;
char backup[MAXPATHLEN];
char *buffer;
- if (lstat(*fname, &orig) == -1)
+ if (lstat(*filename, &orig) == -1)
err(1, "lstat");
if ((orig.st_mode & S_IFREG) == 0) {
- warnx("cannot inplace edit %s, not a regular file", fname);
+ warnx("cannot inplace edit %s, not a regular file", *filename);
return -1;
}
- strlcpy(backup, *fname, MAXPATHLEN);
+ strlcpy(backup, *filename, MAXPATHLEN);
strlcat(backup, inplace, MAXPATHLEN);
- input = open(*fname, O_RDONLY);
+ input = open(*filename, O_RDONLY);
if (input == -1)
- err(1, "open(%s)", fname);
+ err(1, "open(%s)", *filename);
output = open(backup, O_WRONLY|O_CREAT);
if (output == -1)
err(1, "open(%s)", backup);
@@ -447,7 +447,7 @@ inplace_edit(fname)
err(1, "write");
close(input);
close(output);
- freopen(*fname, "w", stdout);
- *fname = strdup(backup);
+ freopen(*filename, "w", stdout);
+ *filename = strdup(backup);
return 0;
}
OpenPOWER on IntegriCloud