journal-qrcode.c revision 92221ed7cbf0323919fc2ae379be2322a3e20558
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2012 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <assert.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <stdbool.h>
#include <qrencode.h>
#include "journal-qrcode.h"
#define WHITE_ON_BLACK "\033[40;37;1m"
#define NORMAL "\033[0m"
unsigned x, y;
/* Four rows of border */
for (y = 0; y < 4; y += 2) {
}
}
int print_qr_code(
const void *seed,
const char *hn,
FILE *f;
unsigned x, y;
if (!f)
return -ENOMEM;
fputs("fss://", f);
for (i = 0; i < seed_size; i++) {
if (i > 0 && i % 3 == 0)
fputc('-', f);
}
(unsigned long long) start,
(unsigned long long) interval,
if (hn)
if (ferror(f)) {
fclose(f);
return -ENOMEM;
}
fclose(f);
if (!qr)
return -ENOMEM;
for (x = 0; x < 4; x++)
bool a, b;
a = row1[x] & 1;
if (a && b)
else if (a)
else if (b)
else
}
for (x = 0; x < 4; x++)
}
return 0;
}