summaryrefslogtreecommitdiff
path: root/xrefresh.c
diff options
context:
space:
mode:
Diffstat (limited to 'xrefresh.c')
-rw-r--r--xrefresh.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/xrefresh.c b/xrefresh.c
index ae8b7c3..b9f6c99 100644
--- a/xrefresh.c
+++ b/xrefresh.c
@@ -1,3 +1,4 @@
+/* $XdotOrg: $ */
/***********************************************************
Copyright 1987, 1988, 1998 The Open Group
@@ -82,22 +83,6 @@ Syntax(void)
exit (1);
}
-static char *
-copystring(char *s)
-{
- int len = (s ? strlen (s) : 0) + 1;
- char *retval;
-
- retval = malloc (len);
- if (!retval) {
- fprintf (stderr, "%s: unable to allocate %d bytes for string.\n",
- ProgramName, len);
- exit (1);
- }
- (void) strcpy (retval, s);
- return (retval);
-}
-
/*
* The following parses options that should be yes or no; it returns -1, 0, 1
* for error, no, yes.
@@ -235,7 +220,13 @@ main(int argc, char *argv[])
char *def;
if ((def = XGetDefault (dpy, ProgramName, "Solid")) != NULL) {
- solidcolor = copystring (def);
+ solidcolor = strdup (def);
+ if (solidcolor == NULL) {
+ fprintf (stderr,
+ "%s: unable to allocate memory for string.\n",
+ ProgramName);
+ exit (1);
+ }
action = doSolid;
} else {
struct s_pair *pp;