ungetwc.c (5f147b57ac73adde1143d270aae670782b431d38) | ungetwc.c (6180233fd804806e7301790d2330da50ca57e71f) |
---|---|
1/*- 2 * Copyright (c) 2002 Tim J. Robbins. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 35 unchanged lines hidden (view full) --- 44{ 45 char buf[MB_LEN_MAX]; 46 mbstate_t mbs; 47 size_t len; 48 49 if (wc == WEOF) 50 return (WEOF); 51 memset(&mbs, 0, sizeof(mbs)); | 1/*- 2 * Copyright (c) 2002 Tim J. Robbins. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 35 unchanged lines hidden (view full) --- 44{ 45 char buf[MB_LEN_MAX]; 46 mbstate_t mbs; 47 size_t len; 48 49 if (wc == WEOF) 50 return (WEOF); 51 memset(&mbs, 0, sizeof(mbs)); |
52 if ((len = wcrtomb(buf, wc, &mbs)) == (size_t)-1) | 52 if ((len = wcrtomb(buf, wc, &mbs)) == (size_t)-1) { 53 fp->_flags |= __SERR; |
53 return (WEOF); | 54 return (WEOF); |
55 } |
|
54 while (len-- != 0) 55 if (__ungetc((unsigned char)buf[len], fp) == EOF) 56 return (WEOF); 57 58 return (wc); 59} 60 61/* --- 14 unchanged lines hidden --- | 56 while (len-- != 0) 57 if (__ungetc((unsigned char)buf[len], fp) == EOF) 58 return (WEOF); 59 60 return (wc); 61} 62 63/* --- 14 unchanged lines hidden --- |