Example #1
0
static void
show_history (GPasteClient *client,
              gboolean      oneline,
              gboolean      raw,
              gboolean      zero,
              GError      **error)
{
    g_auto (GStrv) history = (raw) ?
        g_paste_client_get_raw_history_sync (client, error) :
        g_paste_client_get_history_sync (client, error);

    if (!*error)
    {
        guint32 i = 0;

        for (GStrv h = history; *h; ++h)
            print_history_line (*h, i++, oneline, raw, zero);
    }
}
Example #2
0
static void
show_history (GPasteClient *client,
              gboolean      raw,
              gboolean      zero,
              GError      **error)
{
    G_PASTE_CLEANUP_STRFREEV GStrv history = (raw) ?
        g_paste_client_get_raw_history_sync (client, error) :
        g_paste_client_get_history_sync (client, error);

    if (!*error)
    {
        unsigned int i = 0;

        for (GStrv h = history; *h; ++h)
        {
            if (!raw)
                printf ("%d: ", i++);
            printf ("%s%c", *h, (zero) ? '\0' : '\n');
        }
    }
}