<commit_before>/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

#define LIGHTBAR "/sys/devices/virtual/chromeos/cros_ec/lightbar"

int main(int argc, char **argv)
{
	int major, minor, fd_v;
	int i, tries, fd_s, fd_l;
	char buf[80];
	int ret = 1;

	/* Check version */
	fd_v = open(LIGHTBAR "/version", O_RDONLY);
	if (fd_v < 0) {
		perror("can't open version file");
		goto out;
	}
	ret = read(fd_v, buf, sizeof(buf));
	if (ret <= 0) {
		perror("can't read version");
		close(fd_v);
		goto out;
	}
	buf[ret] = '\0';
	close(fd_v);

	errno = 0;
	/* Expect "MAJOR MINOR" */
	if (2 != sscanf(buf, "%d %d", &major, &minor)) {
		if (errno)
			perror("can't parse version string");
		else
			fprintf(stderr, "can't parse version string\n");
		goto out;
	}
	/* Pixel is "0 0". Minor change will be compatible, Major may not */
	if (major != 0) {
		fprintf(stderr, "Don't know how to handle version %d.%d\n",
			major, minor);
		goto out;
	}
<commit_msg>Fix some stupid.<commit_after>/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

#define LIGHTBAR "/sys/devices/virtual/chromeos/cros_ec/lightbar"

int main(int argc, char **argv)
{
	int major, minor, fd_v;
	int i, tries, fd_s, fd_l;
	char buf[80];
	int ret = 1;

	/* Check version */
	fd_v = open(LIGHTBAR "/version", O_RDONLY);
	if (fd_v < 0) {
		perror("can't open version file");
		goto out;
	}
	ret = read(fd_v, buf, sizeof(buf) - 1);
	if (ret <= 0) {
		perror("can't read version");
		close(fd_v);
		goto out;
	}
	buf[ret] = '\0';
	close(fd_v);

	errno = 0;
	/* Expect "MAJOR MINOR" */
	if (2 != sscanf(buf, "%d %d", &major, &minor)) {
		if (errno)
			perror("can't parse version string");
		else
			fprintf(stderr, "can't parse version string\n");
		goto out;
	}
	/* Pixel is "0 0". Minor change will be compatible, Major may not */
	if (major != 0) {
		fprintf(stderr, "Don't know how to handle version %d.%d\n",
			major, minor);
		goto out;
	}

{'fraction_non_alphanumeric': 0.16686159844054582, 'fraction_numerical': 0.012085769980506823, 'mean_word_length': 3.57397504456328, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4350793', 'n_tokens_mistral': 1081, 'n_tokens_neox': 1001, 'n_words': 315}