screen-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[screen-devel] refactor


From: William Pursell
Subject: [screen-devel] refactor
Date: Sun, 05 Oct 2008 12:00:22 +0100
User-agent: Thunderbird 2.0.0.17 (Macintosh/20080914)


Here's a "janitorial" patch of the type I
mentioned in my last mail.  A few questions:

Is it necessary to continue using old K&R style
parameter declarations?

Would there be any problems dumping the
obsolete Makefile.in's and using Automake?

I notice there is neither a 'check' nor
a 'test' target--is there a test suite?
A distclean target would be nice as well,
but it seems easier to use automake than
to start writing targets.


--
William Pursell
>From ffd3717cc5b90d9b4ac5cf0ea2a92700db4d4b01 Mon Sep 17 00:00:00 2001
From: William Pursell <address@hidden>
Date: Sun, 5 Oct 2008 11:52:53 +0100
Subject: [PATCH] Trivial refactor -- cleaning up main().

Pulled debug printf statements re: various compile
time configuration settings out of main and into
a function.  This is a purely for aesthetics.
---
 src/screen.c |  112 ++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 63 insertions(+), 49 deletions(-)

diff --git a/src/screen.c b/src/screen.c
index 8160a73..cbaf226 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -133,6 +133,7 @@ char *ShellArgs[2];
 extern struct NewWindow nwin_undef, nwin_default, nwin_options;
 struct backtick;
 
+static void do_initial_debug_printfs __P(( char* argv0 ));
 static struct passwd *getpwbyname __P((char *, struct passwd *));
 static void  SigChldHandler __P((void));
 static sigret_t SigChld __P(SIGPROTOARG);
@@ -399,58 +400,12 @@ char **av;
 #ifdef DEBUG
   opendebug(1, 0);
 #endif
+  
   sprintf(version, "%d.%.2d.%.2d%s (%s) %s", REV, VERS,
          PATCHLEVEL, STATE, ORIGIN, DATE);
   nversion = REV * 10000 + VERS * 100 + PATCHLEVEL;
-  debug2("-- screen debug started %s (%s)\n", *av, version);
-#ifdef POSIX
-  debug("POSIX\n");
-#endif
-#ifdef TERMIO
-  debug("TERMIO\n");
-#endif
-#ifdef SYSV
-  debug("SYSV\n");
-#endif
-#ifdef SYSVSIGS
-  debug("SYSVSIGS\n");
-#endif
-#ifdef NAMEDPIPE
-  debug("NAMEDPIPE\n");
-#endif
-#if defined(SIGWINCH) && defined(TIOCGWINSZ)
-  debug("Window size changing enabled\n");
-#endif
-#ifdef HAVE_SETREUID
-  debug("SETREUID\n");
-#endif
-#ifdef HAVE_SETEUID
-  debug("SETEUID\n");
-#endif
-#ifdef hpux
-  debug("hpux\n");
-#endif
-#ifdef USEBCOPY
-  debug("USEBCOPY\n");
-#endif
-#ifdef UTMPOK
-  debug("UTMPOK\n");
-#endif
-#ifdef LOADAV
-  debug("LOADAV\n");
-#endif
-#ifdef NETHACK
-  debug("NETHACK\n");
-#endif
-#ifdef TERMINFO
-  debug("TERMINFO\n");
-#endif
-#ifdef SHADOWPW
-  debug("SHADOWPW\n");
-#endif
-#ifdef NAME_MAX
-  debug1("NAME_MAX = %d\n", NAME_MAX);
-#endif
+
+  do_initial_debug_printfs( *av );
 
   BellString = SaveStr("Bell in window %n");
   VisualBellString = SaveStr("   Wuff,  Wuff!!  ");
@@ -3337,3 +3292,62 @@ char *p;
   return 0;
 }
 
+
+/*
+ * Is it really necessary to do K&R style
+ * parameters?
+ */
+static void
+do_initial_debug_printfs( argv0 )
+char* argv0;
+{
+  debug2("-- screen debug started %s (%s)\n", argv0, version);
+#ifdef POSIX
+  debug("POSIX\n");
+#endif
+#ifdef TERMIO
+  debug("TERMIO\n");
+#endif
+#ifdef SYSV
+  debug("SYSV\n");
+#endif
+#ifdef SYSVSIGS
+  debug("SYSVSIGS\n");
+#endif
+#ifdef NAMEDPIPE
+  debug("NAMEDPIPE\n");
+#endif
+#if defined(SIGWINCH) && defined(TIOCGWINSZ)
+  debug("Window size changing enabled\n");
+#endif
+#ifdef HAVE_SETREUID
+  debug("SETREUID\n");
+#endif
+#ifdef HAVE_SETEUID
+  debug("SETEUID\n");
+#endif
+#ifdef hpux
+  debug("hpux\n");
+#endif
+#ifdef USEBCOPY
+  debug("USEBCOPY\n");
+#endif
+#ifdef UTMPOK
+  debug("UTMPOK\n");
+#endif
+#ifdef LOADAV
+  debug("LOADAV\n");
+#endif
+#ifdef NETHACK
+  debug("NETHACK\n");
+#endif
+#ifdef TERMINFO
+  debug("TERMINFO\n");
+#endif
+#ifdef SHADOWPW
+  debug("SHADOWPW\n");
+#endif
+#ifdef NAME_MAX
+  debug1("NAME_MAX = %d\n", NAME_MAX);
+#endif
+}
-- 
1.6.0.2.GIT


reply via email to

[Prev in Thread] Current Thread [Next in Thread]