fputs.c (333fc21e3cd79bca0c94d7722c5a56cb5ad078d1) fputs.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

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

41__FBSDID("$FreeBSD$");
42
43#include "namespace.h"
44#include <stdio.h>
45#include <string.h>
46#include "un-namespace.h"
47#include "fvwrite.h"
48#include "libc_private.h"
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

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

41__FBSDID("$FreeBSD$");
42
43#include "namespace.h"
44#include <stdio.h>
45#include <string.h>
46#include "un-namespace.h"
47#include "fvwrite.h"
48#include "libc_private.h"
49#include "local.h"
49
50/*
51 * Write the given string to the given file.
52 */
53int
54fputs(s, fp)
55 const char *s;
56 FILE *fp;
57{
58 int retval;
59 struct __suio uio;
60 struct __siov iov;
61
62 iov.iov_base = (void *)s;
63 iov.iov_len = uio.uio_resid = strlen(s);
64 uio.uio_iov = &iov;
65 uio.uio_iovcnt = 1;
66 FLOCKFILE(fp);
50
51/*
52 * Write the given string to the given file.
53 */
54int
55fputs(s, fp)
56 const char *s;
57 FILE *fp;
58{
59 int retval;
60 struct __suio uio;
61 struct __siov iov;
62
63 iov.iov_base = (void *)s;
64 iov.iov_len = uio.uio_resid = strlen(s);
65 uio.uio_iov = &iov;
66 uio.uio_iovcnt = 1;
67 FLOCKFILE(fp);
68 ORIENT(fp, -1);
67 retval = __sfvwrite(fp, &uio);
68 FUNLOCKFILE(fp);
69 return (retval);
70}
69 retval = __sfvwrite(fp, &uio);
70 FUNLOCKFILE(fp);
71 return (retval);
72}