aboutsummaryrefslogtreecommitdiff
#include <stdio.h>
#include <stdint.h>

int main(int argc, char **argv)
{
	uint8_t color_value = 0;
	uint8_t bits_read = 0;
	uint8_t channels_read = 0;
	int pixels_processed = 0;
	int input;

	/* http://netpbm.sourceforge.net/doc/ppm.html */
	puts("P3");
	puts("640 480");
	puts("7");

	while (1) {
		input = getchar();

		if (input == EOF)
			break;

		if (input != '1' && input != '0')
			continue;

		if (input == '1')
			color_value |= 1 << (2 - bits_read);

		if (++bits_read == 3) {
			printf(" %d", color_value);

			color_value = 0;
			bits_read = 0;

			if (++channels_read == 3) {
				channels_read = 0;

				putchar(++pixels_processed % 8 == 0 ?
					'\n' : ' ');
			}
		}
	}

	return 0;
}
/span>Richard Sent 2024-05-30home: services: Add home-startx-command-service-type....Tomas Volf 2024-04-29home: services: bash: Move default PS1 prompt to bashrc...Richard Sent 2024-04-17services: Add the Guix Home service....Richard Sent 2024-03-27home: services: bash: Reorder aliases....Jason Darby 2024-03-21services: shepherd: Load each service file in a fresh module....Ludovic Courtès 2024-03-06gnu: home: dotfiles: Properly support both plain and Stow directory layouts....Giacomo Leidi 2024-02-19home: symlink-manager: Allow busy device skip....Nicolas Graves 2024-01-28home: Add home-dotfiles-service....Giacomo Leidi 2024-01-17home: fontutils: Don't install fontconfig....Efraim Flashner 2024-01-17home: services: zsh: Use unified zprofile....Efraim Flashner 2024-01-08home: services: shepherd: Use the 0.10.x interface....Ludovic Courtès 2023-12-26gnu: home: Add home-pipewire service....Brian Cully 2023-12-02gnu: Use ‘libc-utf8-locales-for-target’....Janneke Nieuwenhuizen 2023-11-05home: services: Add 'x11-display' service....Ludovic Courtès 2023-09-17gnu: home: zsh: Load environment when running via ssh...Saku Laesvuori 2023-09-14home: services: redshift: Use redshift package specified in configuration...Kjartan Oli Agustsson 2023-09-04home: Add parcimonie service....Efraim Flashner 2023-08-29home: services: dicod, syncthing: Import (gnu home services shepherd)....Ludovic Courtès 2023-08-20home: services: ssh: Fix compilation warning with 'serialize-match-criteria'....Nicolas Graves 2023-08-20home: services: Add Syncthing....Ludovic Courtès 2023-08-20home: services: Add dicod....Ludovic Courtès 2023-08-20home: services: mcron: Define as a mapping of the system service....Ludovic Courtès 2023-08-20home: services: Support mapping of System services to Home services....Ludovic Courtès