aboutsummaryrefslogtreecommitdiff
path: root/editors/patch.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-08-03 15:41:12 +0000
committerRob Landley <rob@landley.net>2006-08-03 15:41:12 +0000
commitd921b2ecc0d294ad4bf8c7458fc52a60c28727d2 (patch)
treee4a2769349867c441cf2983d83097bb66701a733 /editors/patch.c
parent6dce0b6fa79f2d4bb7e9d90e1fbc0f6beb25f855 (diff)
downloadbusybox-w32-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.tar.gz
busybox-w32-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.tar.bz2
busybox-w32-d921b2ecc0d294ad4bf8c7458fc52a60c28727d2.zip
Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only had one user), clean up lots of #includes... General cleanup pass. What I've been doing for the last couple days. And it conflicts! I've removed httpd.c from this checkin due to somebody else touching that file. It builds for me. I have to catch a bus. (Now you know why I'm looking forward to Mercurial.)
Diffstat (limited to 'editors/patch.c')
-rw-r--r--editors/patch.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/editors/patch.c b/editors/patch.c
index 337d1bbad..a710d8224 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -67,7 +67,7 @@ static char *extract_filename(char *line, int patch_level)
67 filename_start_ptr = temp + 1; 67 filename_start_ptr = temp + 1;
68 } 68 }
69 69
70 return(bb_xstrdup(filename_start_ptr)); 70 return(xstrdup(filename_start_ptr));
71} 71}
72 72
73static int file_doesnt_exist(const char *filename) 73static int file_doesnt_exist(const char *filename)
@@ -89,7 +89,7 @@ int patch_main(int argc, char **argv)
89 if (ret & 1) 89 if (ret & 1)
90 patch_level = bb_xgetlarg(p, 10, -1, USHRT_MAX); 90 patch_level = bb_xgetlarg(p, 10, -1, USHRT_MAX);
91 if (ret & 2) { 91 if (ret & 2) {
92 patch_file = bb_xfopen(i, "r"); 92 patch_file = xfopen(i, "r");
93 } else { 93 } else {
94 patch_file = stdin; 94 patch_file = stdin;
95 } 95 }
@@ -140,7 +140,7 @@ int patch_main(int argc, char **argv)
140 bb_make_directory(new_filename, -1, FILEUTILS_RECUR); 140 bb_make_directory(new_filename, -1, FILEUTILS_RECUR);
141 *line_ptr = '/'; 141 *line_ptr = '/';
142 } 142 }
143 dst_stream = bb_xfopen(new_filename, "w+"); 143 dst_stream = xfopen(new_filename, "w+");
144 backup_filename = NULL; 144 backup_filename = NULL;
145 } else { 145 } else {
146 backup_filename = xmalloc(strlen(new_filename) + 6); 146 backup_filename = xmalloc(strlen(new_filename) + 6);
@@ -150,16 +150,16 @@ int patch_main(int argc, char **argv)
150 bb_perror_msg_and_die("Couldnt create file %s", 150 bb_perror_msg_and_die("Couldnt create file %s",
151 backup_filename); 151 backup_filename);
152 } 152 }
153 dst_stream = bb_xfopen(new_filename, "w"); 153 dst_stream = xfopen(new_filename, "w");
154 } 154 }
155 155
156 if ((backup_filename == NULL) || file_doesnt_exist(original_filename)) { 156 if ((backup_filename == NULL) || file_doesnt_exist(original_filename)) {
157 src_stream = NULL; 157 src_stream = NULL;
158 } else { 158 } else {
159 if (strcmp(original_filename, new_filename) == 0) { 159 if (strcmp(original_filename, new_filename) == 0) {
160 src_stream = bb_xfopen(backup_filename, "r"); 160 src_stream = xfopen(backup_filename, "r");
161 } else { 161 } else {
162 src_stream = bb_xfopen(original_filename, "r"); 162 src_stream = xfopen(original_filename, "r");
163 } 163 }
164 } 164 }
165 165