export enforce_utf8() via internal.h #451

pull/555/head
nick black 4 years ago
parent 4951a6876c
commit cd2cbd0d88
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -35,6 +35,7 @@ const char* oiio_version(void);
#include <wctype.h>
#include <termios.h>
#include <stdbool.h>
#include <langinfo.h>
#include "notcurses/notcurses.h"
#include "egcpool.h"
@ -620,6 +621,19 @@ int ncplane_resize_internal(ncplane* n, int keepy, int keepx,
int update_term_dimensions(int fd, int* rows, int* cols);
// might not be particularly fast, use sparingly, ideally once
static inline bool
enforce_utf8(void){
char* enc = nl_langinfo(CODESET);
if(!enc){
return false;
}
if(strcmp(enc, "UTF-8")){
return false;
}
return true;
}
#ifdef __cplusplus
}
#endif

@ -13,7 +13,15 @@
static const char* datadir = NOTCURSES_SHARE;
bool enforce_utf8(){
char* find_data(const char* datum){
char* path = (char*)malloc(strlen(datadir) + 1 + strlen(datum) + 1);
strcpy(path, datadir);
strcat(path, "/");
strcat(path, datum);
return path;
}
bool enforce_utf8(void){
char* enc = nl_langinfo(CODESET);
if(!enc){
return false;
@ -24,14 +32,6 @@ bool enforce_utf8(){
return true;
}
char* find_data(const char* datum){
char* path = (char*)malloc(strlen(datadir) + 1 + strlen(datum) + 1);
strcpy(path, datadir);
strcat(path, "/");
strcat(path, datum);
return path;
}
static void
handle_opts(const char** argv){
bool inarg = false;

Loading…
Cancel
Save