<commit_before>﻿/*****************************************************************************\
*                                                                             *
*   Filename	    TrueName.c						      *
*									      *
*   Description:    Resolve all links in a WIN32 pathname.                    *
*                                                                             *
*   Notes:	    TO DO: Move the WIN32-specific code to subroutines, and   *
*		    port the code to other operating systems.		      *
*		    Note that even though pathnames in Unix are generally     *
*		    case-sensitive, pathnames on Samba/CIFS mounts are not.   *
*		    so a truename program could be useful on Unix too.	      *
*		    							      *
*   History:								      *
*    2014-02-07 JFL Created this program.				      *
*    2014-03-25 JFL Fix the final name case.				      *
*    2014-12-04 JFL Rebuilt with MsvcLibX support for WIN32 paths > 260 chars.*
*		    Version 1.0.1.					      *
*    2015-12-18 JFL Convert the short names to long names.		      *
*                   Renamed some options, and added code page opts -A, -O, -U.*
*		    Version 1.1.					      *
*    2016-09-12 JFL Moved WIN32 UTF-8 routines to the MsvcLibX library.       *
*                   Minor tweaks to fix compilation in Linux.                 *
*		    Version 1.1.1.					      *
*                                                                             *
*         © Copyright 2016 Hewlett Packard Enterprise Development LP          *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/

#define PROGRAM_VERSION "1.1.1"
#define PROGRAM_DATE    "2016-09-15"

#define _CRT_SECURE_NO_WARNINGS 1 /* Avoid Visual C++ 2005 security warnings */

#define _GNU_SOURCE	/* Include extra GNU-specific functions */

#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>	/* For the symlink and readlink functions */

/* MsvcLibX debugging macros */
#include "debugm.h"

DEBUG_GLOBALS	/* Define global variables used by debugging macros. (Necessary for Unix builds) */

/************************ Win32-specific definitions *************************/

#ifdef _WIN32		/* Automatically defined when targeting a Win32 applic. */

#if defined(__MINGW64__)
#define OS_NAME "MinGW64"
#elif defined(__MINGW32__)
#define OS_NAME "MinGW32"
#elif defined(_WIN64)
#define OS_NAME "Win64"
#else
#define OS_NAME "Win32"
#endif

#include <windows.h>		/* Also includes MsvcLibX' WIN32 UTF-8 extensions */

#define cp codePage		/* Initial console code page in iconv.c */

#endif

/*********************************** Other ***********************************/

#ifndef OS_NAME
#error "Unidentified OS. Please define OS-specific settings for it."
#endif

/********************** End of OS-specific definitions ***********************/

#define streq(string1, string2) (strcmp(string1, string2) == 0)

#define TRUE 1
#define FALSE 0

/* Forward declarations */
char *version(void);
void usage(void);
int IsSwitch(char *pszArg);

/*---------------------------------------------------------------------------*\
*                                                                             *
|   Function:	    main						      |
|									      |
|   Description:    C program main initialization routine		      |
|									      |<commit_msg>Added missing include file, following MsvcLibX standard output/error mechanism restructuration.<commit_after>﻿/*****************************************************************************\
*                                                                             *
*   Filename	    TrueName.c						      *
*									      *
*   Description:    Resolve all links in a WIN32 pathname.                    *
*                                                                             *
*   Notes:	    TO DO: Move the WIN32-specific code to subroutines, and   *
*		    port the code to other operating systems.		      *
*		    Note that even though pathnames in Unix are generally     *
*		    case-sensitive, pathnames on Samba/CIFS mounts are not.   *
*		    so a truename program could be useful on Unix too.	      *
*		    							      *
*   History:								      *
*    2014-02-07 JFL Created this program.				      *
*    2014-03-25 JFL Fix the final name case.				      *
*    2014-12-04 JFL Rebuilt with MsvcLibX support for WIN32 paths > 260 chars.*
*		    Version 1.0.1.					      *
*    2015-12-18 JFL Convert the short names to long names.		      *
*                   Renamed some options, and added code page opts -A, -O, -U.*
*		    Version 1.1.					      *
*    2016-09-12 JFL Moved WIN32 UTF-8 routines to the MsvcLibX library.       *
*                   Minor tweaks to fix compilation in Linux.                 *
*		    Version 1.1.1.					      *
*                                                                             *
*         © Copyright 2016 Hewlett Packard Enterprise Development LP          *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/

#define PROGRAM_VERSION "1.1.1"
#define PROGRAM_DATE    "2016-09-15"

#define _CRT_SECURE_NO_WARNINGS 1 /* Avoid Visual C++ 2005 security warnings */

#define _GNU_SOURCE	/* Include extra GNU-specific functions */

#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>	/* For the symlink and readlink functions */

/* MsvcLibX debugging macros */
#include "debugm.h"

DEBUG_GLOBALS	/* Define global variables used by debugging macros. (Necessary for Unix builds) */

/************************ Win32-specific definitions *************************/

#ifdef _WIN32		/* Automatically defined when targeting a Win32 applic. */

#if defined(__MINGW64__)
#define OS_NAME "MinGW64"
#elif defined(__MINGW32__)
#define OS_NAME "MinGW32"
#elif defined(_WIN64)
#define OS_NAME "Win64"
#else
#define OS_NAME "Win32"
#endif

#include <windows.h>		/* Also includes MsvcLibX' WIN32 UTF-8 extensions */
#include <iconv.h>              /* For the codePage variable */

#define cp codePage		/* Initial console code page in iconv.c */

#endif

/*********************************** Other ***********************************/

#ifndef OS_NAME
#error "Unidentified OS. Please define OS-specific settings for it."
#endif

/********************** End of OS-specific definitions ***********************/

#define streq(string1, string2) (strcmp(string1, string2) == 0)

#define TRUE 1
#define FALSE 0

/* Forward declarations */
char *version(void);
void usage(void);
int IsSwitch(char *pszArg);

/*---------------------------------------------------------------------------*\
*                                                                             *
|   Function:	    main						      |
|									      |
|   Description:    C program main initialization routine		      |
|									      |
{'fraction_non_alphanumeric': 0.1928169014084507, 'fraction_numerical': 0.03211267605633803, 'mean_word_length': 1.8540996784565917, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 27, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2590547', 'n_tokens_mistral': 2216, 'n_tokens_neox': 1848, 'n_words': 589}