Minor whitespace tweaking.
[checkpath] / tmpdir.c
index 943c4d4..47914df 100644 (file)
--- a/tmpdir.c
+++ b/tmpdir.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: tmpdir.c,v 1.4 2003/01/25 23:58:44 mdw Exp $
+ * $Id: tmpdir.c,v 1.5 2004/04/08 01:36:22 mdw Exp $
  *
  * Choose and check temporary directories
  *
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-/*----- Revision history --------------------------------------------------* 
- *
- * $Log: tmpdir.c,v $
- * Revision 1.4  2003/01/25 23:58:44  mdw
- * Make guts into official library.
- *
- * Revision 1.3  1999/05/21 22:07:20  mdw
- * Take advantage of new dynamic string macros.
- *
- * Revision 1.2  1999/05/19 20:37:28  mdw
- * Track gratuitous change in mdwopt interface.
- *
- * Revision 1.1.1.1  1999/04/06 20:12:07  mdw
- * Import new project.
- *
- */
-
 /*----- Header files ------------------------------------------------------*/
 
 #include <errno.h>
@@ -197,9 +180,7 @@ good:
  */
 
 static int fullcheck(const char *p)
-{
-  return (checkpath(p, &cp) == 0 && ok(p, 0));
-}
+  { return (checkpath(p, &cp) == 0 && ok(p, 0)); }
 
 /* --- @goodtmp@ --- *
  *
@@ -222,16 +203,12 @@ static char *goodtmp(void)
 
   /* --- Try making a directory in `/tmp' --- */
 
-  if (!(q = getenv("USER")) && !(q = getenv("LOGNAME")))
-    q = pw->pw_name;
-  if ((q = trytmp("/tmp", q)) != 0)
+  if ((q = trytmp("/tmp", pw->pw_name)) != 0)
     return (q);
 
   /* --- That failed: try a directory in the user's home --- */
 
-  if (!(q = getenv("HOME")))
-    q = pw->pw_dir;
-  if ((q = trytmp(q, "tmp")) != 0)
+  if ((q = trytmp(pw->pw_dir, "tmp")) != 0)
     return (q);
 
   /* --- Still no joy: give up --- *
@@ -246,16 +223,12 @@ static char *goodtmp(void)
 /* --- @usage@ --- */
 
 static void usage(FILE *fp)
-{
-  fprintf(fp, "Usage: %s [-bc] [-v PATH]\n", QUIS);
-}
+  { fprintf(fp, "Usage: %s [-bc] [-v PATH]\n", QUIS); }
 
 /* --- @version@ --- */
 
 static void version(FILE *fp)
-{
-  fprintf(fp, "%s version %s\n", QUIS, VERSION);
-}
+  { fprintf(fp, "%s version %s\n", QUIS, VERSION); }
 
 /* --- @help@ --- */
 
@@ -311,7 +284,7 @@ int main(int argc, char *argv[])
   /* --- Initialize variables --- */
 
   ego(argv[0]);
-  me = getuid();
+  me = geteuid();
   cp.cp_what = CP_WRWORLD | CP_WRGRP | CP_WROTHUSR | CP_STICKYOK;
   cp.cp_verbose = 0;
   cp.cp_report = 0;
@@ -332,7 +305,7 @@ int main(int argc, char *argv[])
       { "verify",      OPTF_ARGREQ,    0,      'v' },
       { 0,             0,              0,      0 }
     };
-    int i = mdwopt(argc, argv, "hVu bcv:", opts, 0, 0, 0);
+    int i = mdwopt(argc, argv, "hVu" "bcv:", opts, 0, 0, 0);
 
     if (i < 0)
       break;