MCPcopy Create free account
hub / github.com/OpenPrinting/cups / _cupsMessageLoad

Function _cupsMessageLoad

cups/language.c:895–1127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

893 */
894
895cups_array_t * /* O - New message array */
896_cupsMessageLoad(const char *filename, /* I - Message catalog to load */
897 int flags) /* I - Load flags */
898{
899 cups_file_t *fp; /* Message file */
900 cups_array_t *a; /* Message array */
901 _cups_message_t *m; /* Current message */
902 char s[4096], /* String buffer */
903 *ptr, /* Pointer into buffer */
904 *temp; /* New string */
905 size_t length, /* Length of combined strings */
906 ptrlen; /* Length of string */
907
908
909 DEBUG_printf(("4_cupsMessageLoad(filename=\"%s\")", filename));
910
911 /*
912 * Create an array to hold the messages...
913 */
914
915 if ((a = _cupsMessageNew(NULL)) == NULL)
916 {
917 DEBUG_puts("5_cupsMessageLoad: Unable to allocate array!");
918 return (NULL);
919 }
920
921 /*
922 * Open the message catalog file...
923 */
924
925 if ((fp = cupsFileOpen(filename, "r")) == NULL)
926 {
927 DEBUG_printf(("5_cupsMessageLoad: Unable to open file: %s",
928 strerror(errno)));
929 return (a);
930 }
931
932 if (flags & _CUPS_MESSAGE_STRINGS)
933 {
934 while (cups_read_strings(fp, flags, a));
935 }
936 else
937 {
938 /*
939 * Read messages from the catalog file until EOF...
940 *
941 * The format is the GNU gettext .po format, which is fairly simple:
942 *
943 * msgid "some text"
944 * msgstr "localized text"
945 *
946 * The ID and localized text can span multiple lines using the form:
947 *
948 * msgid ""
949 * "some long text"
950 * msgstr ""
951 * "localized text spanning "
952 * "multiple lines"

Callers 4

mainFunction · 0.85
_ppdCreateFromIPP2Function · 0.85
cups_message_loadFunction · 0.85

Calls 8

_cupsMessageNewFunction · 0.85
cupsFileOpenFunction · 0.85
cups_read_stringsFunction · 0.85
cupsFileGetsFunction · 0.85
cups_unquoteFunction · 0.85
cupsArrayAddFunction · 0.85
cupsFileCloseFunction · 0.85
cupsArrayCountFunction · 0.85

Tested by

no test coverage detected