chiark / gitweb /
Great reorganization.
[tripe] / util.c
diff --git a/util.c b/util.c
deleted file mode 100644 (file)
index ceeb0bd..0000000
--- a/util.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*-c-*-
- *
- * $Id: util.c,v 1.3 2004/04/08 01:36:17 mdw Exp $
- *
- * Utilities for the client and the server
- *
- * (c) 2001 Straylight/Edgeware
- */
-
-/*----- Licensing notice --------------------------------------------------* 
- *
- * This file is part of Trivial IP Encryption (TrIPE).
- *
- * TrIPE is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * TrIPE is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with TrIPE; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/*----- Header files ------------------------------------------------------*/
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include "util.h"
-
-#include <sys/ioctl.h>
-
-/*----- Main code ---------------------------------------------------------*/
-
-/* --- @u_detach@ --- *
- *
- * Arguments:  ---
- *
- * Returns:    ---
- *
- * Use:                Detaches from the current terminal and ensures it can never
- *             acquire a new one.  Calls @fork@.
- */
-
-void u_detach(void)
-{
-#ifdef TIOCNOTTY
-  {
-    int fd;
-    if ((fd = open("/dev/tty", O_RDONLY)) >= 0) {
-      ioctl(fd, TIOCNOTTY);
-      close(fd);
-    }
-  }
-#endif
-  setsid();
-  if (fork() > 0)
-    _exit(0);
-}
-
-/* --- @u_daemon@ --- *
- *
- * Arguments:  ---
- *
- * Returns:    Zero if OK, nonzero on failure.
- *
- * Use:                Becomes a daemon.
- */
-
-int u_daemon(void)
-{
-  pid_t kid;
-
-  if ((kid = fork()) < 0)
-    return (-1);
-  if (kid)
-    _exit(0);
-  u_detach();
-  return (0);
-}
-
-/*----- That's all, folks -------------------------------------------------*/