home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 2
/
goldfish_vol2_cd1.bin
/
files
/
comm
/
misc
/
elcheapofax
/
rcs
/
append.c,v
< prev
next >
Wrap
Text File
|
1993-12-21
|
2KB
|
108 lines
head 1.2;
access;
symbols
OCT93:1.2;
locks;
comment @ * @;
1.2
date 93.06.11.16.33.37; author Rhialto; state Exp;
branches;
next 1.1;
1.1
date 93.06.11.14.53.53; author Rhialto; state Exp;
branches;
next ;
desc
@Append files to a pre-existing file
@
1.2
log
@First real RCS checkin
@
text
@/*
* append.c
*
* Copyright (C) 1993 by Olaf 'Rhialto' Seibert. All rights reserved.
*
* $Id$
* $Log$
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int
main(int argc, char **argv)
{
char *outfile = "ascii.g3";
FILE *ofp;
FILE *ifp;
extern char *optarg;
extern int optind;
extern int getopt(int, char **, char *);
int errflg = 0;
int c;
while ((c = getopt(argc, argv, "ao:rv")) != -1) {
switch (c) {
/* Append ignored */
case 'o':
outfile = optarg;
break;
/* Raw ignored */
/* Verbose ignored */
case '?':
errflg++;
break;
}
}
if (errflg || optind >= argc) {
printf(
"Usage: append [-o fax-file] files\n");
exit(EXIT_FAILURE);
}
ofp = fopen(outfile, "ab");
if (ofp == NULL) {
printf("Can't open output file %s.\n", outfile);
exit(EXIT_FAILURE);
}
while (optind < argc) {
char buf[4096];
int size;
if (ifp = fopen(argv[optind], "rb")) {
while ((size = fread(buf, 1, sizeof(buf), ifp)) > 0)
fwrite(buf, 1, size, ofp);
fclose(ifp);
} else {
printf("Can't open input file %s.\n", argv[optind]);
}
optind++;
}
return 0;
}
@
1.1
log
@Initial revision
@
text
@d5 3
@