<commit_before>/*
 * =====================================================================================
 *
 *       Filename:  main.c
 *
 *    Description:  sleep and hibernate.
 *
 *        Version:  1.0
 *        Created:  12/13/14 16:26:55
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  <NAME> (foxiepaws), <EMAIL>
 *
 * =====================================================================================
 */


#include "generic.h"
#include "sleep.h"
#include "hibernate.h"


/*
 * ===  FUNCTION  ======================================================================
 *         Name:  main
 *  Description:
 * =====================================================================================
 */
int
main ( int argc, char *argv[] )
{
    if (argc < 2) goto fail;
    unsigned int fgs = 0;
    int o;
    while ((o = getopt(argc,argv,"sH")) != -1) {
        switch (o) {
            case 's':
                if (fgs & 1) {
                    goto fail;
                }
                fgs += 1;
                break;
                ;;
            case 'H':
                if (fgs & 2) {
                    goto fail;
                }
                fgs += 2;
                break;
                ;;
            default:
                goto fail;
                ;;
        }
    }
    if (fgs == 3) {
        /* both flags are set, failure */
        goto fail;
    }
    if (fgs == 1) {
    	printf("attempting to sleep\n");
        sw_sleep();
	printf("Welcome Back =)\n");
    }
    if (fgs == 2) {
    	printf("attempting to hibernate\n");
        sw_hiber();
	printf("Welcome Back =)\n");
    }

    return EXIT_SUCCESS;
fail:
    fprintf(stderr,
            "Usage: %s [-s|-H]\n",
            argv[0]);
    exit(EXIT_FAILURE);
}
/* ----------  end of function main  ---------- */
<commit_msg>add getopt.h<commit_after>/*
 * =====================================================================================
 *
 *       Filename:  main.c
 *
 *    Description:  sleep and hibernate.
 *
 *        Version:  1.0
 *        Created:  12/13/14 16:26:55
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  <NAME> (foxiepaws), <EMAIL>
 *
 * =====================================================================================
 */


#include "generic.h"
#include "sleep.h"
#include "hibernate.h"
#include <getopt.h>

/*
 * ===  FUNCTION  ======================================================================
 *         Name:  main
 *  Description:
 * =====================================================================================
 */
int
main ( int argc, char *argv[] )
{
    if (argc < 2) goto fail;
    unsigned int fgs = 0;
    int o;
    while ((o = getopt(argc,argv,"sH")) != -1) {
        switch (o) {
            case 's':
                if (fgs & 1) {
                    goto fail;
                }
                fgs += 1;
                break;
                ;;
            case 'H':
                if (fgs & 2) {
                    goto fail;
                }
                fgs += 2;
                break;
                ;;
            default:
                goto fail;
                ;;
        }
    }
    if (fgs == 3) {
        /* both flags are set, failure */
        goto fail;
    }
    if (fgs == 1) {
    	printf("attempting to sleep\n");
        sw_sleep();
	printf("Welcome Back =)\n");
    }
    if (fgs == 2) {
    	printf("attempting to hibernate\n");
        sw_hiber();
	printf("Welcome Back =)\n");
    }

    return EXIT_SUCCESS;
fail:
    fprintf(stderr,
            "Usage: %s [-s|-H]\n",
            argv[0]);
    exit(EXIT_FAILURE);
}
/* ----------  end of function main  ---------- */

{'fraction_non_alphanumeric': 0.3056004308023694, 'fraction_numerical': 0.013462574044157244, 'mean_word_length': 1.5567790777701307, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 8, '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': '3564119', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1011, 'n_words': 241}