pax(1).

--steffen
 
Index: bin/pax/options.c
===================================================================
RCS file: /Users/steffen/arena/code.openbsd/src/bin/pax/options.c,v
retrieving revision 1.74
diff -a -p -u -r1.74 options.c
--- bin/pax/options.c   2 Dec 2010 04:08:27 -0000       1.74
+++ bin/pax/options.c   26 Feb 2012 17:06:00 -0000
@@ -64,7 +64,7 @@ static int no_op(void);
 static void printflg(unsigned int);
 static int c_frmt(const void *, const void *);
 static off_t str_offt(char *);
-static char *getline(FILE *fp);
+static char *pax_getline(FILE *fp);
 static void pax_options(int, char **);
 static void pax_usage(void);
 static void tar_options(int, char **);
@@ -72,10 +72,10 @@ static void tar_usage(void);
 static void cpio_options(int, char **);
 static void cpio_usage(void);
 
-/* errors from getline */
-#define GETLINE_FILE_CORRUPT 1
-#define GETLINE_OUT_OF_MEM 2
-static int getline_error;
+/* errors from pax_getline */
+#define PAX_GETLINE_FILE_CORRUPT       1
+#define PAX_GETLINE_OUT_OF_MEM         2
+static int pax_getline_error;
 
 
 #define GZIP_CMD       "gzip"          /* command to run as gzip */
@@ -884,14 +884,14 @@ tar_options(int argc, char **argv)
                                                paxwarn(1, "Unable to open file 
'%s' for read", file);
                                                tar_usage();
                                        }
-                                       while ((str = getline(fp)) != NULL) {
+                                       while ((str = pax_getline(fp)) != NULL) 
{
                                                if (pat_add(str, dir) < 0)
                                                        tar_usage();
                                                sawpat = 1;
                                        }
                                        if (strcmp(file, "-") != 0)
                                                fclose(fp);
-                                       if (getline_error) {
+                                       if (pax_getline_error) {
                                                paxwarn(1, "Problem with file 
'%s'", file);
                                                tar_usage();
                                        }
@@ -963,13 +963,13 @@ tar_options(int argc, char **argv)
                                        paxwarn(1, "Unable to open file '%s' 
for read", file);
                                        tar_usage();
                                }
-                               while ((str = getline(fp)) != NULL) {
+                               while ((str = pax_getline(fp)) != NULL) {
                                        if (ftree_add(str, 0) < 0)
                                                tar_usage();
                                }
                                if (strcmp(file, "-") != 0)
                                        fclose(fp);
-                               if (getline_error) {
+                               if (pax_getline_error) {
                                        paxwarn(1, "Problem with file '%s'",
                                            file);
                                        tar_usage();
@@ -1185,11 +1185,11 @@ cpio_options(int argc, char **argv)
                                        paxwarn(1, "Unable to open file '%s' 
for read", optarg);
                                        cpio_usage();
                                }
-                               while ((str = getline(fp)) != NULL) {
+                               while ((str = pax_getline(fp)) != NULL) {
                                        pat_add(str, NULL);
                                }
                                fclose(fp);
-                               if (getline_error) {
+                               if (pax_getline_error) {
                                        paxwarn(1, "Problem with file '%s'", 
optarg);
                                        cpio_usage();
                                }
@@ -1284,10 +1284,10 @@ cpio_options(int argc, char **argv)
                         * no read errors allowed on updates/append operation!
                         */
                        maxflt = 0;
-                       while ((str = getline(stdin)) != NULL) {
+                       while ((str = pax_getline(stdin)) != NULL) {
                                ftree_add(str, 0);
                        }
-                       if (getline_error) {
+                       if (pax_getline_error) {
                                paxwarn(1, "Problem while reading stdin");
                                cpio_usage();
                        }
@@ -1515,21 +1515,21 @@ str_offt(char *val)
 }
 
 char *
-getline(FILE *f)
+pax_getline(FILE *f)
 {
        char *name, *temp;
        size_t len;
 
        name = fgetln(f, &len);
        if (!name) {
-               getline_error = ferror(f) ? GETLINE_FILE_CORRUPT : 0;
+               pax_getline_error = ferror(f) ? PAX_GETLINE_FILE_CORRUPT : 0;
                return(0);
        }
        if (name[len-1] != '\n')
                len++;
        temp = malloc(len);
        if (!temp) {
-               getline_error = GETLINE_OUT_OF_MEM;
+               pax_getline_error = PAX_GETLINE_OUT_OF_MEM;
                return(0);
        }
        memcpy(temp, name, len-1);

Reply via email to