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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#define _XOPEN_SOURCE 500
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
void make_template(bool verbose) {
char tmp_template[] = "/tmp/email_issue_XXXXXX";
int fd = mkstemp(tmp_template);
const char *issue_template =
"# Lines beginning with hashtags (like this one) are generated by the template.\n"
"# They are not included in the issue.\n"
"# Leave a newline at the bottom\n"
"#\n"
"# Valid Types: \n"
"# BUG - Code errors, flaws, failures, or crashes.\n"
"# FEATURE - Proposals or requests for new pipeline functionality.\n"
"# DOCS - Technical manuals, code comments, or web updates.\n"
"# REFACTOR - Structural/readability cleanups (no behavior changes).\n"
"# PATCH - Concrete code submissions fulfilling an issue request.\n"
"#\n"
"# Valid Levels:\n"
"# LOW - Minor cosmetic issues or typos; zero threat to stability.\n"
"# MEDIUM - Minor flaws; system works but specific feature is broken.\n"
"# HIGH - Severe flaws; major workflow failures or loop crashes.\n"
"# FATAL - Completely unusable; unable to boot or compile.\n"
"# EXPLOIT - Security vulnerabilities (overflows, memory leaks, etc.)\n"
"# This must be used for anything that could be used harmfully.\n"
"# Successful reporting will result in your name in ACKNOWLEDGMENTS.\n"
"# More details are in SECURITY.\n"
"#\n"
"# Assignee Handshake Protocol:\n"
"# The assignee should be left default to 'doe' (unless you want to assign yourself)\n"
"# Assignee are in email form unless they are "
"# NOTE: Spamming useless issues or useless information will result in a block\n\n"
"[TYPE LEVEL] Issue title (doe)\n\n"
"Your issue description here...\n\n"
"@@END-OF-ISSUE@@\n";
}
int main (int argc, char *argv[])
{
bool verbose = false;
if (argc < 2) {
fprintf(stderr, "error: no input file or flags specified\n");
fprintf(stderr, "hint: use '--help' for usage instructions \n");
return 1;
}
if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0) {
printf("usage: %s [-hvt] [<file.tti>]\n\n", argv[0]);
printf("options:\n");
printf(" -h, --help Prints this help message\n");
printf(" -v, --verbose Makes logging verbose\n");
printf(" -t, --template Opens a template in a disposable editor session\n");
} else if (strcmp(argv[1], "--verbose") || strcmp(argv[1], "-v")) {
verbose = true;
} else if (strcmp(argv[1], "-t") || strcmp(argv[1], "--template")) {
}
return 0;
}
|