<commit_before>/* $Id$ */
/* Copyright (c) 2014-2015 <NAME> <<EMAIL>> */
/* This file is part of DeforaOS Devel configure */
/* All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */



#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include "configure.h"
#include "../config.h"

#ifndef PROGNAME
# define PROGNAME PACKAGE
#endif


/* configure */
/* private */
/* prototypes */
static void _prefs_init(Prefs * prefs);

static int _usage(void);


/* functions */
/* prefs_init */
static void _prefs_init(Prefs * prefs)
{
	struct stat st;

	memset(prefs, 0, sizeof(*prefs));
	prefs->destdir = "";
	if(stat("/Apps", &st) == 0)
	{
		prefs->bindir = "Binaries";
		prefs->includedir = "Includes";
		prefs->libdir = "Libraries";
		/* XXX needs auto-detection for the sub-directory */
		prefs->prefix = "/Apps";
		prefs->sbindir = "Binaries";
	}
	else
	{
		prefs->bindir = "bin";
		prefs->includedir = "include";
		prefs->libdir = "lib";
		prefs->prefix = "/usr/local";
		prefs->sbindir = "sbin";
	}
}


/* usage */
static int _usage(void)
{
	Prefs prefs;

	_prefs_init(&prefs);
	fprintf(stderr, "%s%s%s%s%s%s%s%s%s%s%s",
"Usage: configure [-nSv][-b bindir][-d destdir][-l libdir][-O system][-p prefix]\n"
"       [-s sbindir][directory...]\n"
"  -n	Do not actually write Makefiles\n"
"  -v	Verbose mode\n"
"  -b	Binary files directory (default: \"", prefs.bindir, "\")\n"
"  -d	Destination prefix (default: \"\")\n"
"  -i	Include files directory (default: \"", prefs.includedir, "\")\n"
"  -l	Library files directory (default: \"", prefs.libdir, "\")\n"
"  -O	Force Operating System (default: auto-detected)\n"
"  -p	Installation directory prefix (default: \"", prefs.prefix, "\")\n"
"  -S	Warn about potential security risks\n"
"  -s	Super-user executable files directory (default: \"", prefs.sbindir,
"\")\n");
	return 1;
}


/* public */
/* functions */
/* main */
int main(int argc, char * argv[])
{
	int ret = 0;
	Prefs prefs;
	int o;

	_prefs_init(&prefs);
	while((o = getopt(argc, argv, "d:i:l:nO:p:Ss:v")) != -1)
		switch(o)
		{
			case 'b':
				prefs.bindir = optarg;
				break;
			case 'd':
				prefs.destdir = optarg;
				break;
			case 'i':
				prefs.includedir = optarg;
				break;
			case 'l':
				prefs.libdir = optarg;
				break;
			case 'n':
				prefs.flags |= PREFS_n;
				break;
			case 'O':
				prefs.os = optarg;
				break;
			case 'p':
				prefs.prefix = optarg;
				break;
			case 'S':
				prefs.flags |= PREFS_S;
				break;
			case 's':
				prefs.sbindir = optarg;
				break;
			case 'v':
				prefs.flags |= PREFS_v;
				break;
			case '?':
				return _usage();
		}
	if(optind == argc)
		return configure(&prefs, ".");
	for(; optind < argc; optind++)
		ret |= configure(&prefs, argv[optind]);
	return (ret == 0) ? 0 : 2;
}
<commit_msg>Do not ignore unsupported flags<commit_after>/* $Id$ */
/* Copyright (c) 2014-2015 <NAME> <<EMAIL>> */
/* This file is part of DeforaOS Devel configure */
/* All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */



#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include "configure.h"
#include "../config.h"

#ifndef PROGNAME
# define PROGNAME PACKAGE
#endif


/* configure */
/* private */
/* prototypes */
static void _prefs_init(Prefs * prefs);

static int _usage(void);


/* functions */
/* prefs_init */
static void _prefs_init(Prefs * prefs)
{
	struct stat st;

	memset(prefs, 0, sizeof(*prefs));
	prefs->destdir = "";
	if(stat("/Apps", &st) == 0)
	{
		prefs->bindir = "Binaries";
		prefs->includedir = "Includes";
		prefs->libdir = "Libraries";
		/* XXX needs auto-detection for the sub-directory */
		prefs->prefix = "/Apps";
		prefs->sbindir = "Binaries";
	}
	else
	{
		prefs->bindir = "bin";
		prefs->includedir = "include";
		prefs->libdir = "lib";
		prefs->prefix = "/usr/local";
		prefs->sbindir = "sbin";
	}
}


/* usage */
static int _usage(void)
{
	Prefs prefs;

	_prefs_init(&prefs);
	fprintf(stderr, "%s%s%s%s%s%s%s%s%s%s%s",
"Usage: configure [-nSv][-b bindir][-d destdir][-l libdir][-O system][-p prefix]\n"
"       [-s sbindir][directory...]\n"
"  -n	Do not actually write Makefiles\n"
"  -v	Verbose mode\n"
"  -b	Binary files directory (default: \"", prefs.bindir, "\")\n"
"  -d	Destination prefix (default: \"\")\n"
"  -i	Include files directory (default: \"", prefs.includedir, "\")\n"
"  -l	Library files directory (default: \"", prefs.libdir, "\")\n"
"  -O	Force Operating System (default: auto-detected)\n"
"  -p	Installation directory prefix (default: \"", prefs.prefix, "\")\n"
"  -S	Warn about potential security risks\n"
"  -s	Super-user executable files directory (default: \"", prefs.sbindir,
"\")\n");
	return 1;
}


/* public */
/* functions */
/* main */
int main(int argc, char * argv[])
{
	int ret = 0;
	Prefs prefs;
	int o;

	_prefs_init(&prefs);
	while((o = getopt(argc, argv, "d:i:l:nO:p:Ss:v")) != -1)
		switch(o)
		{
			case 'b':
				prefs.bindir = optarg;
				break;
			case 'd':
				prefs.destdir = optarg;
				break;
			case 'i':
				prefs.includedir = optarg;
				break;
			case 'l':
				prefs.libdir = optarg;
				break;
			case 'n':
				prefs.flags |= PREFS_n;
				break;
			case 'O':
				prefs.os = optarg;
				break;
			case 'p':
				prefs.prefix = optarg;
				break;
			case 'S':
				prefs.flags |= PREFS_S;
				break;
			case 's':
				prefs.sbindir = optarg;
				break;
			case 'v':
				prefs.flags |= PREFS_v;
				break;
			case '?':
			default:
				return _usage();
		}
	if(optind == argc)
		return configure(&prefs, ".");
	for(; optind < argc; optind++)
		ret |= configure(&prefs, argv[optind]);
	return (ret == 0) ? 0 : 2;
}

{'fraction_non_alphanumeric': 0.14612934835864771, 'fraction_numerical': 0.004409603135717786, 'mean_word_length': 3.3921463152232385, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 39, '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': '590589', 'n_tokens_mistral': 3148, 'n_tokens_neox': 2782, 'n_words': 901}