diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/copyin.c | 60 | ||||
-rw-r--r-- | src/extern.h | 3 |
2 files changed, 5 insertions, 58 deletions
diff --git a/src/copyin.c b/src/copyin.c index 05279d2..99d9cdb 100644 --- a/src/copyin.c +++ b/src/copyin.c | |||
@@ -173,10 +173,8 @@ list_file (struct cpio_file_stat* file_hdr, int in_file_des) | |||
173 | } | 173 | } |
174 | else | 174 | else |
175 | { | 175 | { |
176 | /* Debian hack: Modified to print a list of filenames | 176 | /* Print out the name as it is. The name_end delimiter is normally |
177 | terminiated by a null character when the -t and -0 | 177 | '\n', but can be reset to '\0' by the -0 option. */ |
178 | flags are used. This has been submitted as a | ||
179 | suggestion to "bug-gnu-utils@prep.ai.mit.edu". -BEM */ | ||
180 | printf ("%s%c", file_hdr->c_name, name_end); | 178 | printf ("%s%c", file_hdr->c_name, name_end); |
181 | } | 179 | } |
182 | 180 | ||
@@ -788,65 +786,15 @@ long_format (struct cpio_file_stat *file_hdr, char *link_name) | |||
788 | 786 | ||
789 | printf ("%s ", tbuf + 4); | 787 | printf ("%s ", tbuf + 4); |
790 | 788 | ||
791 | print_name_with_quoting (file_hdr->c_name); | 789 | printf ("%s", quotearg (file_hdr->c_name)); |
792 | if (link_name) | 790 | if (link_name) |
793 | { | 791 | { |
794 | printf (" -> "); | 792 | printf (" -> "); |
795 | print_name_with_quoting (link_name); | 793 | printf ("%s", quotearg (link_name)); |
796 | } | 794 | } |
797 | putc ('\n', stdout); | 795 | putc ('\n', stdout); |
798 | } | 796 | } |
799 | 797 | ||
800 | void | ||
801 | print_name_with_quoting (register char *p) | ||
802 | { | ||
803 | register unsigned char c; | ||
804 | |||
805 | while ( (c = *p++) ) | ||
806 | { | ||
807 | switch (c) | ||
808 | { | ||
809 | case '\\': | ||
810 | printf ("\\\\"); | ||
811 | break; | ||
812 | |||
813 | case '\n': | ||
814 | printf ("\\n"); | ||
815 | break; | ||
816 | |||
817 | case '\b': | ||
818 | printf ("\\b"); | ||
819 | break; | ||
820 | |||
821 | case '\r': | ||
822 | printf ("\\r"); | ||
823 | break; | ||
824 | |||
825 | case '\t': | ||
826 | printf ("\\t"); | ||
827 | break; | ||
828 | |||
829 | case '\f': | ||
830 | printf ("\\f"); | ||
831 | break; | ||
832 | |||
833 | case ' ': | ||
834 | printf ("\\ "); | ||
835 | break; | ||
836 | |||
837 | case '"': | ||
838 | printf ("\\\""); | ||
839 | break; | ||
840 | |||
841 | default: | ||
842 | if (c > 040 && c < 0177) | ||
843 | putchar (c); | ||
844 | else | ||
845 | printf ("\\%03o", (unsigned int) c); | ||
846 | } | ||
847 | } | ||
848 | } | ||
849 | |||
850 | /* Read a pattern file (for the -E option). Put a list of | 798 | /* Read a pattern file (for the -E option). Put a list of |
851 | `num_patterns' elements in `save_patterns'. Any patterns that were | 799 | `num_patterns' elements in `save_patterns'. Any patterns that were |
852 | already in `save_patterns' (from the command line) are preserved. */ | 800 | already in `save_patterns' (from the command line) are preserved. */ |
diff --git a/src/extern.h b/src/extern.h index e27d662..8339050 100644 --- a/src/extern.h +++ b/src/extern.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* extern.h - External declarations for cpio. Requires system.h. | 1 | /* extern.h - External declarations for cpio. Requires system.h. |
2 | Copyright (C) 1990-1992, 2001, 2006-2007, 2009-2010, 2014-2015 Free | 2 | Copyright (C) 1990-1992, 2001, 2006-2007, 2009-2010, 2014-2016 Free |
3 | Software Foundation, Inc. | 3 | Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
@@ -112,7 +112,6 @@ void read_in_binary (struct cpio_file_stat *file_hdr, | |||
112 | void swab_array (char *arg, int count); | 112 | void swab_array (char *arg, int count); |
113 | void process_copy_in (void); | 113 | void process_copy_in (void); |
114 | void long_format (struct cpio_file_stat *file_hdr, char *link_name); | 114 | void long_format (struct cpio_file_stat *file_hdr, char *link_name); |
115 | void print_name_with_quoting (char *p); | ||
116 | 115 | ||
117 | /* copyout.c */ | 116 | /* copyout.c */ |
118 | int write_out_header (struct cpio_file_stat *file_hdr, int out_des); | 117 | int write_out_header (struct cpio_file_stat *file_hdr, int out_des); |