summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2020-06-17 15:27:52 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2020-06-17 15:27:52 -0400
commit2741e9b381570f362732061dbca7835c8c185e9b (patch)
tree0ceea33a0ec4d3186f8328dfd587ae620ab57bd2
parent49e2c2127743e702154bc4efc040be7bfaaf6433 (diff)
eliminate some unnecessary(?) goto statements
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
-rw-r--r--src/twm.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/src/twm.c b/src/twm.c
index d9a8f6c..a8d1c2f 100644
--- a/src/twm.c
+++ b/src/twm.c
@@ -181,8 +181,7 @@ static char *atom_names[11] = {
#ifdef XPRINT
/* |hasExtension()| and |IsPrintScreen()| have been stolen from
* xc/programs/xdpyinfo/xdpyinfo.c */
-static
- Bool
+static Bool
hasExtension(Display *dpy, char *extname)
{
int num_extensions, i;
@@ -195,8 +194,7 @@ hasExtension(Display *dpy, char *extname)
return i != num_extensions;
}
-static
- Bool
+static Bool
IsPrintScreen(Screen *s)
{
Display *dpy = XDisplayOfScreen(s);
@@ -219,6 +217,17 @@ IsPrintScreen(Screen *s)
}
#endif /* XPRINT */
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: %s [-display dpy] [-f file] [-s] [-q] [-v]"
+#ifdef XPRINT
+ " [-noprint]"
+#endif /* XPRINT */
+ " [-clientId id] [-restore file]\n", ProgramName);
+ exit(1);
+}
+
/***********************************************************************
*
* Procedure:
@@ -251,9 +260,9 @@ main(int argc, char *argv[])
switch (argv[i][1]) {
case 'd': /* -display dpy */
if (strcmp(&argv[i][1], "display"))
- goto usage;
+ usage();
if (++i >= argc)
- goto usage;
+ usage();
display_name = argv[i];
continue;
case 's': /* -single */
@@ -262,13 +271,13 @@ main(int argc, char *argv[])
#ifdef XPRINT
case 'n': /* -noprint */
if (strcmp(&argv[i][1], "noprint"))
- goto usage;
+ usage();
NoPrintscreens = True;
continue;
#endif /* XPRINT */
case 'f': /* -file twmrcfilename */
if (++i >= argc)
- goto usage;
+ usage();
InitFile = argv[i];
continue;
case 'v': /* -verbose */
@@ -276,16 +285,16 @@ main(int argc, char *argv[])
continue;
case 'c': /* -clientId */
if (strcmp(&argv[i][1], "clientId"))
- goto usage;
+ usage();
if (++i >= argc)
- goto usage;
+ usage();
client_id = argv[i];
continue;
case 'r': /* -restore */
if (strcmp(&argv[i][1], "restore"))
- goto usage;
+ usage();
if (++i >= argc)
- goto usage;
+ usage();
restore_filename = argv[i];
continue;
case 'q': /* -quiet */
@@ -293,13 +302,7 @@ main(int argc, char *argv[])
continue;
}
}
- usage:
- fprintf(stderr, "usage: %s [-display dpy] [-f file] [-s] [-q] [-v]"
-#ifdef XPRINT
- " [-noprint]"
-#endif /* XPRINT */
- " [-clientId id] [-restore file]\n", ProgramName);
- exit(1);
+ usage();
}
loc = setlocale(LC_ALL, "");