aboutsummaryrefslogtreecommitdiff
path: root/editors/diff.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-03-24 18:40:32 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-03-24 18:40:32 +0000
commitdccfe05e17b3aae4d5386f73359992b9ba1915c8 (patch)
tree300364ee45539e5f38ac25a7e5561c84cbb57d63 /editors/diff.c
parent64a76d7b447eeaf2a50606c04f87cec8ef535efb (diff)
downloadbusybox-w32-dccfe05e17b3aae4d5386f73359992b9ba1915c8.tar.gz
busybox-w32-dccfe05e17b3aae4d5386f73359992b9ba1915c8.tar.bz2
busybox-w32-dccfe05e17b3aae4d5386f73359992b9ba1915c8.zip
diff: improve comments (no code chages)
Diffstat (limited to 'editors/diff.c')
-rw-r--r--editors/diff.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/editors/diff.c b/editors/diff.c
index 08729177c..eac4b08c5 100644
--- a/editors/diff.c
+++ b/editors/diff.c
@@ -282,6 +282,9 @@ static int readhash(FILE *fp)
282} 282}
283 283
284 284
285/* Our diff implementation is using seek.
286 * When we meet non-seekable file, we must make a temp copy.
287 */
285static char *make_temp(FILE *f, struct stat *sb) 288static char *make_temp(FILE *f, struct stat *sb)
286{ 289{
287 char *name; 290 char *name;
@@ -1160,7 +1163,7 @@ static void do_diff(char *dir1, char *path1, char *dir2, char *path2)
1160#if ENABLE_FEATURE_DIFF_DIR 1163#if ENABLE_FEATURE_DIFF_DIR
1161/* This function adds a filename to dl, the directory listing. */ 1164/* This function adds a filename to dl, the directory listing. */
1162static int add_to_dirlist(const char *filename, 1165static int add_to_dirlist(const char *filename,
1163 struct stat ATTRIBUTE_UNUSED *sb, 1166 struct stat *sb ATTRIBUTE_UNUSED,
1164 void *userdata, 1167 void *userdata,
1165 int depth ATTRIBUTE_UNUSED) 1168 int depth ATTRIBUTE_UNUSED)
1166{ 1169{
@@ -1178,15 +1181,15 @@ static char **get_recursive_dirlist(char *path)
1178 dl_count = 0; 1181 dl_count = 0;
1179 dl = xzalloc(sizeof(dl[0])); 1182 dl = xzalloc(sizeof(dl[0]));
1180 1183
1181 /* If -r has been set, then the recursive_action function will be 1184 /* We need to trim root directory prefix.
1182 * used. Unfortunately, this outputs the root directory along with 1185 * Using void *userdata to specify its length,
1183 * the recursed paths, so use void *userdata to specify the string 1186 * add_to_dirlist will remove it. */
1184 * length of the root directory - '(void*)(strlen(path)+)'.
1185 * add_to_dirlist then removes root dir prefix. */
1186 if (option_mask32 & FLAG_r) { 1187 if (option_mask32 & FLAG_r) {
1187 recursive_action(path, ACTION_RECURSE|ACTION_FOLLOWLINKS, 1188 recursive_action(path, ACTION_RECURSE|ACTION_FOLLOWLINKS,
1188 add_to_dirlist, NULL, 1189 add_to_dirlist, /* file_action */
1189 (void*)(strlen(path)+1), 0); 1190 NULL, /* dir_action */
1191 (void*)(strlen(path) + 1),
1192 0);
1190 } else { 1193 } else {
1191 DIR *dp; 1194 DIR *dp;
1192 struct dirent *ep; 1195 struct dirent *ep;
@@ -1328,12 +1331,12 @@ int diff_main(int argc ATTRIBUTE_UNUSED, char **argv)
1328 /* NB: "diff dir dir2/dir3/file" must become 1331 /* NB: "diff dir dir2/dir3/file" must become
1329 * "diff dir/file dir2/dir3/file" */ 1332 * "diff dir/file dir2/dir3/file" */
1330 char *slash = strrchr(f2, '/'); 1333 char *slash = strrchr(f2, '/');
1331 f1 = concat_path_file(f1, slash ? slash+1 : f2); 1334 f1 = concat_path_file(f1, slash ? slash + 1 : f2);
1332 xstat(f1, &stb1); 1335 xstat(f1, &stb1);
1333 } 1336 }
1334 if (S_ISDIR(stb2.st_mode)) { 1337 if (S_ISDIR(stb2.st_mode)) {
1335 char *slash = strrchr(f1, '/'); 1338 char *slash = strrchr(f1, '/');
1336 f2 = concat_path_file(f2, slash ? slash+1 : f1); 1339 f2 = concat_path_file(f2, slash ? slash + 1 : f1);
1337 xstat(f2, &stb2); 1340 xstat(f2, &stb2);
1338 } 1341 }
1339 1342