lcs_translate_block(PCI) 6 January 1993 lcs_translate_block(PCI) Name lcs_translate_block - translate input block to output block Syntax #include <lcs.h> int lcs_translate_block(out, out_size, in, in_len) char *out, *in; int out_size, in_len; Description This function translates a block of characters in in and places the results in out. inlen specifies the size in bytes of in. No more than outsize bytes are placed in out. lcstranslateblock, unlike lcstranslatestring, does not recognize '\0' as a delimiter, which means multistring text blocks get translated. To use this function, you must first get the tables, set the tables, and set the options. Return value If the translation is successful, this function returns the number of bytes translated into out. It returns -1 when a translation error occurs. Translation statistics are described in lcsintro. Error codes are returned in lcserrno. Example #include <lcs.h> #define MAX_LINE 1024; char inbuf[MAX_LINE]; char outbuf[2*MAX_LINE]; /* allow us to double our output size */ : : /* Get input table */ : : /* Get output table */ : : /* Set the tables */ : : /* Set the options */ : : if ( lcs_translate_block(outbuf, 2*MAX_LINE, inbuf, MAX_LINE) < 0) { switch(lcs_errno) { case LCS_ERR_NOTFOUND: fprintf(stderr,"Translation table(s) not found!\n"); exit(1); case LCS_ERR_BADTABLE: fprintf(stderr, "Translation table(s) bad!\n"); exit(1); case LCS_ERR_NOTABLE: fprintf(stderr, "Translation tables not set!\n"); exit(1); case LCS_ERR_NOSPACE: /* Insufficient space, hhmm */ fprintf(stderr, "Insufficient space in output buffer!\n"); exit(1); case LCS_ERR_STOPXLAT: /* Untranslatable character and abort_on */ fprintf(stderr, "Untranslatable character!\n"); exit(1); case LCS_ERR_INPUT_SPLIT: /* Input is split across multiple buffers */ fprintf(stderr, "Input split!\n"); exit(1); default: /* Unknown error condition, help! */ fprintf(stderr, "Unknown error: %d\n", lcs_errno); exit(1); } /* end switch */ } See also lcsintro(PCI), lcstranslatestring(PCI), lcsgettable(PCI), lcssettables(PCI), lcssetoptions(PCI)