Lines Matching refs:file
56 status_t Process(int file)
60 fFile = file;
151 fprintf(stderr, "Could not stat file \"%s\": %s\n", path,
163 int file = open(path, O_RDONLY);
164 if (file < 0) {
165 fprintf(stderr, "Could not open file \"%s\": %s\n", path,
170 status_t status = gSHA.Process(file);
197 int file = open(name, O_WRONLY | O_TRUNC | O_CREAT);
198 if (file < 0) {
199 fprintf(stderr, "%s: Could not write hash file \"%s\": %s\n",
204 write(file, "HASH", 4);
206 write(file, &fileCount, sizeof(int));
209 write(file, &length, sizeof(int));
210 write(file, files[i], length + 1);
214 write(file, &fileCount, sizeof(int));
218 write(file, entry.hash, SHA_DIGEST_LENGTH);
219 write(file, &entry.node, sizeof(ino_t));
222 write(file, &length, sizeof(int));
223 write(file, entry.path.c_str(), length + 1);
226 close(file);
234 fprintf(stderr, "usage: %s <hash-file> [<files> ...]\n"
235 "\tWhen invoked without files, the hash-file is updated only.\n",
253 // read files from hash file
255 int file = open(hashFileName, O_RDONLY);
256 if (file < 0) {
257 fprintf(stderr, "%s: Could not open hash file \"%s\": %s\n",
263 read(file, buffer, 4);
265 fprintf(stderr, "%s: \"%s\" is not a hash file\n",
267 close(file);
270 read(file, &fileCount, sizeof(int));
277 close(file);
283 read(file, &length, sizeof(int));
289 close(file);
293 read(file, files[i], length + 1);
297 close(file);
334 "file.\n", gFiles.size(), runtime / 1000000.0,