Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
ef9af67d
Commit
ef9af67d
authored
Mar 5, 2002
by
Martin Stjernholm
Browse files
Options
Downloads
Patches
Plain Diff
Added file_equal().
Rev: lib/modules/Stdio.pmod/module.pmod:1.137
parent
e82a8724
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/modules/Stdio.pmod/module.pmod
+23
-2
23 additions, 2 deletions
lib/modules/Stdio.pmod/module.pmod
with
23 additions
and
2 deletions
lib/modules/Stdio.pmod/module.pmod
+
23
−
2
View file @
ef9af67d
// $Id: module.pmod,v 1.13
6
2002/03/0
2 22:04:29 agehall%shadowbyte.com
Exp $
// $Id: module.pmod,v 1.13
7
2002/03/0
5 14:17:23 mast
Exp $
#pike __REAL_VERSION__
inherit files;
...
...
@@ -1740,10 +1740,11 @@ mixed `[](string index)
}
}
#define BLOCK 65536
#if constant(system.cp)
constant cp=system.cp;
#else
#define BLOCK 65536
int cp(string from, string to)
{
string data;
...
...
@@ -1769,6 +1770,26 @@ int cp(string from, string to)
}
#endif
int file_equal (string file_1, string file_2)
//! Returns nonzero if the given paths are files with identical
//! content, returns zero otherwise. Zero is also returned for any
//! sort of I/O error.
{
File f1 = File(), f2 = File();
if (!f1->open (file_1, "r") || !f2->open (file_2, "r")) return 0;
function(int,int|void:string) f1_read = f1->read, f2_read = f2->read;
string d1, d2;
do {
d1 = f1_read (BLOCK);
if (!d1) return 0;
d2 = f2_read (BLOCK);
if (d1 != d2) return 0;
} while (sizeof (d1) == BLOCK);
f1->close();
f2->close();
return 1;
}
static void call_cp_cb(int len,
function(int, mixed ...:void) cb, mixed ... args)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment