aboutsummaryrefslogtreecommitdiff
path: root/src/triplet.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/triplet.c')
-rw-r--r--src/triplet.c100
1 files changed, 79 insertions, 21 deletions
diff --git a/src/triplet.c b/src/triplet.c
index dbba486..f18f573 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -52,6 +52,7 @@ hash_triplet_free (void *data)
free (tp->directive);
free (tp->blurb);
free (tp->tmp);
+ free (tp->check_diag);
/* FIXME: free uploader list */
free (tp);
@@ -368,7 +369,7 @@ format_file_data (struct file_triplet *trp, enum file_type type, char **pret)
}
static const char *
-expand_triplet_full (struct metadef *def, void *data)
+expand_triplet_ls_full (struct metadef *def, void *data)
{
struct file_triplet *trp = data;
char *buf[FILE_TYPE_COUNT] = { NULL, NULL, NULL };
@@ -406,7 +407,7 @@ expand_triplet_full (struct metadef *def, void *data)
}
static const char *
-expand_triplet_upload (struct metadef *def, void *data)
+expand_triplet_ls_upload (struct metadef *def, void *data)
{
struct file_triplet *trp = data;
char *buf[2] = { NULL, NULL };
@@ -441,13 +442,34 @@ static const char *
expand_triplet_dist (struct metadef *def, void *data)
{
struct file_triplet *trp = data;
+ return trp->file[file_dist].name;
+}
+
+static const char *
+expand_triplet_sig (struct metadef *def, void *data)
+{
+ struct file_triplet *trp = data;
+ return trp->file[file_signature].name;
+}
+
+static const char *
+expand_triplet_dir (struct metadef *def, void *data)
+{
+ struct file_triplet *trp = data;
+ return trp->file[file_directive].name;
+}
+
+static const char *
+expand_triplet_ls_dist (struct metadef *def, void *data)
+{
+ struct file_triplet *trp = data;
format_file_data (trp, file_dist, &def->storage);
def->value = def->storage;
return def->value;
}
static const char *
-expand_triplet_sig (struct metadef *def, void *data)
+expand_triplet_ls_sig (struct metadef *def, void *data)
{
struct file_triplet *trp = data;
format_file_data (trp, file_signature, &def->storage);
@@ -456,7 +478,7 @@ expand_triplet_sig (struct metadef *def, void *data)
}
static const char *
-expand_triplet_directive (struct metadef *def, void *data)
+expand_triplet_ls_directive (struct metadef *def, void *data)
{
struct file_triplet *trp = data;
format_file_data (trp, file_directive, &def->storage);
@@ -509,6 +531,37 @@ expand_comment (struct metadef *def, void *data)
return def->value;
}
+static const char *
+expand_check_diagn (struct metadef *def, void *data)
+{
+ struct file_triplet *trp = data;
+ return trp->check_diag;
+}
+
+static const char *
+expand_check_result (struct metadef *def, void *data)
+{
+ struct file_triplet *trp = data;
+ int status = trp->check_result;
+ char sbuf[INT_BUFSIZE_BOUND (uintmax_t)];
+
+ if (status == 0)
+ return def->value = "0";
+ else if (WIFEXITED (status))
+ {
+ char *p = umaxtostr (WEXITSTATUS (status), sbuf);
+ def->storage = xstrdup (p);
+ }
+ else if (WIFSIGNALED (status))
+ {
+ char *p = umaxtostr (WTERMSIG (status), sbuf);
+ asprintf (&def->storage, "SIG+%s", p);
+ }
+ else
+ def->storage = "[unrecognized return code]";
+ return def->value = def->storage;
+}
+
#define DECL_EXPAND_TIMER(what) \
static const char * \
__cat2__(expand_timer_,what) (struct metadef *def, void *data) \
@@ -555,23 +608,28 @@ triplet_expand_dictionary_query (struct dictionary *dict, void *handle,
}
struct metadef triplet_meta[] = {
- { "project", NULL, expand_project_base, NULL },
- { "url", NULL, expand_url, NULL },
- { "spool", NULL, expand_tag, NULL },
- { "dir", NULL, expand_relative_dir, NULL },
- { "dest-dir", NULL, expand_dest_dir, NULL },
- { "source-dir", NULL, expand_source_dir, NULL },
- { "triplet:full", NULL, expand_triplet_full, NULL },
- { "triplet:upload", NULL, expand_triplet_upload, NULL },
- { "triplet:dist", NULL, expand_triplet_dist, NULL },
- { "triplet:sig", NULL, expand_triplet_sig, NULL },
- { "triplet:dir", NULL, expand_triplet_directive, NULL },
- { "user", NULL, expand_user_name, NULL },
- { "user:name", NULL, expand_user_name, NULL },
- { "user:real-name", NULL, expand_user_real_name, NULL },
- { "user:email", NULL, expand_user_email, NULL },
- { "report", NULL, expand_report, NULL },
- { "comment", NULL, expand_comment, NULL },
+ { "project", NULL, expand_project_base, NULL },
+ { "url", NULL, expand_url, NULL },
+ { "spool", NULL, expand_tag, NULL },
+ { "dir", NULL, expand_relative_dir, NULL },
+ { "dest-dir", NULL, expand_dest_dir, NULL },
+ { "source-dir", NULL, expand_source_dir, NULL },
+ { "triplet:dist", NULL, expand_triplet_dist, NULL },
+ { "triplet:sig", NULL, expand_triplet_sig, NULL },
+ { "triplet:dir", NULL, expand_triplet_dir, NULL },
+ { "triplet:ls:full", NULL, expand_triplet_ls_full, NULL },
+ { "triplet:ls:upload", NULL, expand_triplet_ls_upload, NULL },
+ { "triplet:ls:dist", NULL, expand_triplet_ls_dist, NULL },
+ { "triplet:ls:sig", NULL, expand_triplet_ls_sig, NULL },
+ { "triplet:ls:dir", NULL, expand_triplet_ls_directive, NULL },
+ { "check:result", NULL, expand_check_result, NULL },
+ { "check:diagn", NULL, expand_check_diagn, NULL },
+ { "user", NULL, expand_user_name, NULL },
+ { "user:name", NULL, expand_user_name, NULL },
+ { "user:real-name", NULL, expand_user_real_name, NULL },
+ { "user:email", NULL, expand_user_email, NULL },
+ { "report", NULL, expand_report, NULL },
+ { "comment", NULL, expand_comment, NULL },
DECL_FULL_TIMER(wydawca),
DECL_FULL_TIMER(triplet),
DECL_FULL_TIMER(spool),

Return to:

Send suggestions and report system problems to the System administrator.