fgets.c (333fc21e3cd79bca0c94d7722c5a56cb5ad078d1) | fgets.c (e74101e4eff767325553039def89de70b70f36d3) |
---|---|
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 --- 52 unchanged lines hidden (view full) --- 61 size_t len; 62 char *s; 63 unsigned char *p, *t; 64 65 if (n <= 0) /* sanity check */ 66 return (NULL); 67 68 FLOCKFILE(fp); | 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 --- 52 unchanged lines hidden (view full) --- 61 size_t len; 62 char *s; 63 unsigned char *p, *t; 64 65 if (n <= 0) /* sanity check */ 66 return (NULL); 67 68 FLOCKFILE(fp); |
69 ORIENT(fp, -1); |
|
69 s = buf; 70 n--; /* leave space for NUL */ 71 while (n != 0) { 72 /* 73 * If the buffer is empty, refill it. 74 */ 75 if ((len = fp->_r) <= 0) { 76 if (__srefill(fp)) { --- 39 unchanged lines hidden --- | 70 s = buf; 71 n--; /* leave space for NUL */ 72 while (n != 0) { 73 /* 74 * If the buffer is empty, refill it. 75 */ 76 if ((len = fp->_r) <= 0) { 77 if (__srefill(fp)) { --- 39 unchanged lines hidden --- |