@@ -122,6 +122,31 @@ ag was originally created by Geoff Greer. More information (and the latest relea
122
122
can be found at http://geoff.greer.fm/ag\n" );
123
123
}
124
124
125
+ #if SUPPORT_TWO_ENCODINGS
126
+ /* Get the actual name of a code page */
127
+ char * GetCPName (int iCP , LPCPINFOEX lpCpi ) {
128
+ int i ;
129
+ char * pszName = "" ;
130
+ CPINFOEX cpi ;
131
+ if (!lpCpi ) lpCpi = & cpi ;
132
+ if (GetCPInfoEx (iCP , 0 , lpCpi )) { /* Most code pages have a good descrition in the CPINFOEX structure */
133
+ /* (Including many that are not listed in the static list above) */
134
+ pszName = lpCpi -> CodePageName ;
135
+ /* Make a copy because we can't return the address of this one in the local stack frame */
136
+ /* Skip the code page number copy at the beginning of the CPINFOEX name */
137
+ while (strchr ("0123456789" , * pszName )) pszName ++ ;
138
+ while (isspace (* pszName )) pszName ++ ; /* Skip spaces after the number */
139
+ if (* pszName == '(' ) pszName ++ ; /* Remove the leading '(' */
140
+ pszName = strdup (pszName );
141
+ i = (int )strlen (pszName ) - 1 ;
142
+ if (pszName [i ] == ')' ) pszName [i ] = '\0' ; /* Remove the trailing ')' */
143
+ }
144
+ /* But some code pages have a description that's an empty string "" */
145
+ if (!* pszName ) pszName = "(Unknown name)" ;
146
+ return pszName ;
147
+ }
148
+ #endif /* SUPPORT_TWO_ENCODINGS */
149
+
125
150
void print_version (void ) {
126
151
char jit = '-' ;
127
152
char lzma = '-' ;
@@ -137,9 +162,24 @@ void print_version(void) {
137
162
zlib = '+' ;
138
163
#endif
139
164
140
- printf ("ag version %s\n\n" , PACKAGE_VERSION );
165
+ printf ("ag version %s" , PACKAGE_VERSION );
166
+ #if defined(HAS_MSVCLIBX )
167
+ #if defined(_WIN64 )
168
+ #define OS_NAME "Win64"
169
+ #else
170
+ #define OS_NAME "Win32"
171
+ #endif
172
+ printf (" " OS_NAME DEBUG_VERSION );
173
+ #endif /* defined(HAS_MSVCLIBX) */
174
+ printf ("\n\n" );
141
175
printf ("Features:\n" );
142
176
printf (" %cjit %clzma %czlib\n" , jit , lzma , zlib );
177
+ #if SUPPORT_TWO_ENCODINGS
178
+ printf ("\nSupported text file encodings:\n" );
179
+ int iACP = GetACP (); /* Get the Windows System Code Page */
180
+ printf (" Code Page %d = %s\n" , iACP , GetCPName (iACP , NULL ));
181
+ printf (" Code Page 65001 = UTF-8\n" );
182
+ #endif /* SUPPORT_TWO_ENCODINGS */
143
183
}
144
184
145
185
void init_options (void ) {
0 commit comments