git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob e7c0137a4779ff005d3b440e1874d570a2d5d797 624 bytes (raw)
name: t/helper/test-crontab.c 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
#include "test-tool.h"
#include "cache.h"

/*
 * Usage: test-tool cron <file> [-l]
 *
 * If -l is specified, then write the contents of <file> to stdout.
 * Otherwise, write from stdin into <file>.
 */
int cmd__crontab(int argc, const char **argv)
{
	int a;
	FILE *from, *to;

	if (argc == 3 && !strcmp(argv[2], "-l")) {
		from = fopen(argv[1], "r");
		if (!from)
			return 0;
		to = stdout;
	} else if (argc == 2) {
		from = stdin;
		to = fopen(argv[1], "w");
	} else
		return error("unknown arguments");

	while ((a = fgetc(from)) != EOF)
		fputc(a, to);

	if (argc == 3)
		fclose(from);
	else
		fclose(to);

	return 0;
}

debug log:

solving e7c0137a47 ...
found e7c0137a47 in https://80x24.org/mirrors/git.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).