vfprintf.c (927ecbf3131970f3a11602fee1499bd5ea6eea21) vfprintf.c (6180233fd804806e7301790d2330da50ca57e71f)
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Chris Torek.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 745 unchanged lines hidden (view full) ---

754 case 'c':
755 if (flags & LONGINT) {
756 mbstate_t mbs;
757 size_t mbseqlen;
758
759 memset(&mbs, 0, sizeof(mbs));
760 mbseqlen = wcrtomb(cp = buf,
761 (wchar_t)GETARG(wint_t), &mbs);
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Chris Torek.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 745 unchanged lines hidden (view full) ---

754 case 'c':
755 if (flags & LONGINT) {
756 mbstate_t mbs;
757 size_t mbseqlen;
758
759 memset(&mbs, 0, sizeof(mbs));
760 mbseqlen = wcrtomb(cp = buf,
761 (wchar_t)GETARG(wint_t), &mbs);
762 if (mbseqlen == (size_t)-1)
762 if (mbseqlen == (size_t)-1) {
763 fp->_flags |= __SERR;
763 goto error;
764 goto error;
765 }
764 size = (int)mbseqlen;
765 } else {
766 *(cp = buf) = GETARG(int);
767 size = 1;
768 }
769 sign = '\0';
770 break;
771 case 'D':

--- 157 unchanged lines hidden (view full) ---

929 wchar_t *wcp;
930
931 if (convbuf != NULL)
932 free(convbuf);
933 if ((wcp = GETARG(wchar_t *)) == NULL)
934 cp = "(null)";
935 else {
936 convbuf = __wcsconv(wcp, prec);
766 size = (int)mbseqlen;
767 } else {
768 *(cp = buf) = GETARG(int);
769 size = 1;
770 }
771 sign = '\0';
772 break;
773 case 'D':

--- 157 unchanged lines hidden (view full) ---

931 wchar_t *wcp;
932
933 if (convbuf != NULL)
934 free(convbuf);
935 if ((wcp = GETARG(wchar_t *)) == NULL)
936 cp = "(null)";
937 else {
938 convbuf = __wcsconv(wcp, prec);
937 if (convbuf == NULL)
939 if (convbuf == NULL) {
940 fp->_flags |= __SERR;
938 goto error;
941 goto error;
942 }
939 cp = convbuf;
940 }
941 } else if ((cp = GETARG(char *)) == NULL)
942 cp = "(null)";
943 if (prec >= 0) {
944 /*
945 * can't use strlen; can only look for the
946 * NUL in the first `prec' characters, and

--- 629 unchanged lines hidden ---
943 cp = convbuf;
944 }
945 } else if ((cp = GETARG(char *)) == NULL)
946 cp = "(null)";
947 if (prec >= 0) {
948 /*
949 * can't use strlen; can only look for the
950 * NUL in the first `prec' characters, and

--- 629 unchanged lines hidden ---