st-flexipatch

My st-flexipatch configuration
git clone git://git.ethandl.dev/st-flexipatch
Log | Files | Refs | README | LICENSE

iso14755.c (418B)


      1 void
      2 iso14755(const Arg *arg)
      3 {
      4 	FILE *p;
      5 	char *us, *e, codepoint[9], uc[UTF_SIZ];
      6 	unsigned long utf32;
      7 
      8 	if (!(p = popen(ISO14755CMD, "r")))
      9 		return;
     10 
     11 	us = fgets(codepoint, sizeof(codepoint), p);
     12 	pclose(p);
     13 
     14 	if (!us || *us == '\0' || *us == '-' || strlen(us) > 7)
     15 		return;
     16 	if ((utf32 = strtoul(us, &e, 16)) == ULONG_MAX ||
     17 	    (*e != '\n' && *e != '\0'))
     18 		return;
     19 
     20 	ttywrite(uc, utf8encode(utf32, uc), 1);
     21 }