~ubuntu-branches/ubuntu/vivid/sup/vivid

« back to all changes in this revision

Viewing changes to ffilecopy.c

  • Committer: Bazaar Package Importer
  • Author(s): Jochen Friedrich
  • Date: 2006-11-02 15:03:30 UTC
  • mfrom: (1.1.1 upstream) (3.1.1 dapper)
  • Revision ID: james.westby@ubuntu.com-20061102150330-yt4yavw4rj1hz8yj
Tags: 20060803-2
Fix CFLAGS, so libwrap is built into sup again.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*      $NetBSD: ffilecopy.c,v 1.6 2003/04/03 17:14:24 christos Exp $   */
 
2
 
1
3
/*
2
4
 * Copyright (c) 1991 Carnegie Mellon University
3
5
 * All Rights Reserved.
4
 
 * 
 
6
 *
5
7
 * Permission to use, copy, modify and distribute this software and its
6
8
 * documentation is hereby granted, provided that both the copyright
7
9
 * notice and this permission notice appear in all copies of the
45
47
 */
46
48
 
47
49
#include <stdio.h>
48
 
int filecopy();
 
50
#include "supcdefs.h"
 
51
#include "supextern.h"
49
52
 
50
 
int ffilecopy (here,there)
51
 
FILE *here, *there;
 
53
int 
 
54
ffilecopy(FILE * here, FILE * there)
52
55
{
53
 
        register int i, herefile, therefile;
 
56
        int i, herefile, therefile;
54
57
 
55
58
        herefile = fileno(here);
56
59
        therefile = fileno(there);
57
60
 
58
 
        if (fflush (there) == EOF)              /* flush pending output */
 
61
        if (fflush(there) == EOF)       /* flush pending output */
59
62
                return (EOF);
60
63
 
61
 
#ifndef DEBIAN
62
 
#ifdef __386BSD__
63
 
        if ((here->_r) > 0) {                   /* flush buffered input */
64
 
                i = write (therefile, here->_p, here->_r);
65
 
                if (i != here->_r)  return (EOF);
 
64
#if     defined(__386BSD__) || defined(__NetBSD__)
 
65
        if ((here->_r) > 0) {   /* flush buffered input */
 
66
                i = write(therefile, here->_p, here->_r);
 
67
                if (i != here->_r)
 
68
                        return (EOF);
66
69
                here->_p = here->_bf._base;
67
70
                here->_r = 0;
68
71
        }
69
72
#else
70
 
        if ((here->_cnt) > 0) {                 /* flush buffered input */
71
 
                i = write (therefile, here->_ptr, here->_cnt);
72
 
                if (i != here->_cnt)  return (EOF);
 
73
#ifndef __linux__
 
74
        if ((here->_cnt) > 0) { /* flush buffered input */
 
75
                i = write(therefile, here->_ptr, here->_cnt);
 
76
                if (i != here->_cnt)
 
77
                        return (EOF);
73
78
                here->_ptr = here->_base;
74
79
                here->_cnt = 0;
75
80
        }
76
81
#endif
77
82
#endif
78
 
 
79
 
        i = filecopy (herefile, therefile);     /* fast file copy */
80
 
        if (i < 0)  return (EOF);
81
 
 
82
 
#ifndef DEBIAN
83
 
#ifdef __386BSD__
84
 
        (here->_flags) |= __SEOF;               /* indicate EOF */
85
 
#else
86
 
        (here->_flag) |= _IOEOF;                /* indicate EOF */
 
83
        i = filecopy(herefile, therefile);      /* fast file copy */
 
84
        if (i < 0)
 
85
                return (EOF);
 
86
 
 
87
#if     defined(__386BSD__) || defined(__NetBSD__)
 
88
        (here->_flags) |= __SEOF;       /* indicate EOF */
 
89
#else
 
90
#ifndef __linux__
 
91
        (here->_flag) |= _IOEOF;        /* indicate EOF */
 
92
#else
 
93
        (void)fseeko(here, (off_t)0, SEEK_END); /* seek to end */
87
94
#endif
88
95
#endif
89
96
        return (0);