Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/helper/test-crontab.c # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / helper / test-crontab.c` 35 lines ยท 633 bytes Raw Blame History 1 #include "test-tool.h" 2 3 /* 4 * Usage: test-tool crontab -l| 5 * 6 * If -l is specified, then write the contents of to stdout. 7 * Otherwise, copy the contents of into . 8 */ 9 int cmd__crontab(int argc, const char **argv) 10 { 11 int a; 12 FILE *from, *to; 13 14 if (argc != 3) 15 usage("test-tool crontab -l|"); 16 17 if (!strcmp(argv[2], "-l")) { 18 from = fopen(argv[1], "r"); 19 if (!from) 20 return 0; 21 to = stdout; 22 } else { 23 from = xfopen(argv[2], "r"); 24 to = xfopen(argv[1], "w"); 25 } 26 27 while ((a = fgetc(from)) != EOF) 28 fputc(a, to); 29 30 fclose(from); 31 if (to != stdout) 32 fclose(to); 33 34 return 0; 35 }