Various minor cleanups.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 8 Dec 2008 10:41:08 +0000 (10:41 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 8 Dec 2008 20:11:31 +0000 (20:11 +0000)
  * Spacing fix in server/peer.c.

  * Minor reformatting in tunnel drivers and client.

  * Remove bogus declaration for long-dead u_daemon in common/util.h.

  * Reformatting of client/tripectl.c.

client/tripectl.c
common/util.h
server/peer.c
server/tun-bsd.c
server/tun-linux.c
server/tun-unet.c

index af5c183..d9f5dd8 100644 (file)
@@ -120,10 +120,7 @@ static void checkbg(char **p)
 }
 
 static void checkfg(void)
-{
-  if (bgtag)
-    die(EXIT_FAILURE, "unexpected foreground response");
-}
+  { if (bgtag) die(EXIT_FAILURE, "unexpected foreground response"); }
 
 static void cline(char *p, size_t len, void *b)
 {
@@ -273,18 +270,10 @@ static void logfile(const char *name)
 
 static void sighup(int sig, void *v) { logfile(logname); }
 
-static void cleanup(void)
-{
-  if (pidfile)
-    unlink(pidfile);
-}
+static void cleanup(void) { if (pidfile) unlink(pidfile); }
 
 static void sigdie(int sig)
-{
-  cleanup();
-  signal(sig, SIG_DFL);
-  raise(sig);
-}
+  { cleanup(); signal(sig, SIG_DFL); raise(sig); }
 
 static void version(FILE *fp)
   { pquis(fp, "$, TrIPE version " VERSION "\n"); }
@@ -473,15 +462,12 @@ int main(int argc, char *argv[])
     if (!kid) {
       dup2(pfd[1], STDIN_FILENO);
       dup2(pfd[1], STDOUT_FILENO);
-      close(pfd[1]);
       close(pfd[0]);
-      if (logfp)
-       fclose(logfp);
-      if (pidfp)
-       fclose(pidfp);
+      close(pfd[1]);
+      if (logfp) fclose(logfp);
+      if (pidfp) fclose(pidfp);
       closelog();
-      if (f & f_daemon)
-       detachtty();
+      if (f & f_daemon) detachtty();
       execvp(DA(&spawnopts)[0], DA(&spawnopts));
       die(127, "couldn't exec `%s': %s", spawnpath, strerror(errno));
     }
index b76e125..aaef36f 100644 (file)
 
 extern void u_quotify(dstr */*d*/, const char */*p*/);
 
-/* --- @u_detach@ --- *
- *
- * Arguments:  ---
- *
- * Returns:    ---
- *
- * Use:                Detaches from the current terminal and ensures it can never
- *             acquire a new one.  Calls @fork@.
- */
-
-extern void u_detach(void);
-
-/* --- @u_daemon@ --- *
- *
- * Arguments:  ---
- *
- * Returns:    Zero if OK, nonzero on failure.
- *
- * Use:                Becomes a daemon.
- */
-
-extern int u_daemon(void);
-
 /*----- That's all, folks -------------------------------------------------*/
 
 #ifdef __cplusplus
index e57c6ba..b23ef7b 100644 (file)
@@ -707,10 +707,10 @@ peer *p_create(peerspec *spec)
   if (kx_init(&p->kx, p, &p->ks, p->spec.kxf))
     goto tidy_3;
   a_notify("ADD",
-           "?PEER", p,
-           "%s", p->ifname,
-           "?ADDR", &p->spec.sa,
-           A_END);
+          "?PEER", p,
+          "%s", p->ifname,
+          "?ADDR", &p->spec.sa,
+          A_END);
   if (!(p->spec.kxf & KXF_CORK)) {
     a_notify("KXSTART", "?PEER", p, A_END);
     /* Couldn't tell anyone before */
index 12765e5..49b5e0e 100644 (file)
@@ -161,11 +161,7 @@ static void t_inject(tunnel *t, buf *b)
  */
 
 static void t_destroy(tunnel *t)
-{
-  sel_rmfile(&t->f);
-  close(t->f.fd);
-  DESTROY(t);
-}
+  { sel_rmfile(&t->f); close(t->f.fd); DESTROY(t); }
 
 const tunnel_ops tun_bsd = {
   "bsd",
index 28c2050..cffeb56 100644 (file)
@@ -161,11 +161,7 @@ static void t_inject(tunnel *t, buf *b)
  */
 
 static void t_destroy(tunnel *t)
-{
-  sel_rmfile(&t->f);
-  close(t->f.fd);
-  DESTROY(t);
-}
+  { sel_rmfile(&t->f); close(t->f.fd); DESTROY(t); }
 
 const tunnel_ops tun_linux = {
   "linux",
index 5ebcc79..2d11ca0 100644 (file)
@@ -162,11 +162,7 @@ static void t_inject(tunnel *t, buf *b)
  */
 
 static void t_destroy(tunnel *t)
-{
-  sel_rmfile(&t->f);
-  close(t->f.fd);
-  DESTROY(t);
-}
+  { sel_rmfile(&t->f); close(t->f.fd); DESTROY(t); }
 
 const tunnel_ops tun_unet = {
   "unet",