Remove #ifdef __STDC__ junk. We don't do K&R round these parts,
[oweals/busybox.git] / coreutils / uuencode.c
index 91136b3e6d557b2376d7aa0fc786403bf87515ab..8d15adbf6d87b58d9303cfd642401303c91d506f 100644 (file)
  * along with this product; see the file COPYING.  If not, write to
  * the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  * 02111-1307, USA.
- */
-
-/* Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *       This product includes software developed by the University of
- *       California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
+ * Original copyright notice is retained at the end of this file.
  */
-
 /* Reworked to GNU style by Ian Lance Taylor, ian@airs.com, August 93.  */
 /* Hacked to work with BusyBox by Alfred M. Szmidt */
 
-#include "internal.h"
+
+#include "busybox.h"
 
 #include <stdio.h>
 #include <errno.h>
+#include <getopt.h>
 #include <pwd.h>
 
 #define        RW (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
@@ -179,15 +150,6 @@ static void encode()
   }
 }
 
-static const char uuencode_usage[] =
-    "uuencode [OPTION] [INFILE] REMOTEFILE\n"
-#ifndef BB_FEATURE_TRIVIAL_HELP
-    "\nUuencode a file.\n\n"
-    "Options:\n"
-    "\t-m\tuse base64 encoding as of RFC1521\n"
-#endif
-;
-
 int uuencode_main (int argc,
                    char **argv)
 {
@@ -216,8 +178,8 @@ int uuencode_main (int argc,
    case 2:
     /* Optional first argument is input file.  */
     if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) {
-      errorMsg("uuencode: %s: %s\n", argv[optind], strerror(errno));
-      exit FALSE;
+      errorMsg("%s: %s\n", argv[optind], strerror(errno));
+      return EXIT_FAILURE;
     }
     mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
     optind++;
@@ -238,7 +200,41 @@ int uuencode_main (int argc,
   printf(trans_ptr == uu_std ? "end\n" : "====\n");
   if (ferror (stdout)) {
     errorMsg("Write error\n");
-    exit FALSE;
+    return EXIT_FAILURE;
   }
-  exit TRUE;
+  return EXIT_SUCCESS;
 }
+
+/* Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change 
+ *             ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change> 
+ *
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+