home *** CD-ROM | disk | FTP | other *** search
- /***********************************************************************\
- * BBSADD By S.K.Lindsay aka Linds - Terradome *
- *************************************************************************
- * Sorry The codes a bit messy, I have only been doing C for 4 days, be *
- * prepared to see a lot of code from me, I am determined to make a name *
- * for my self in the Amiga world. This file should compile no problems *
- * on any C package on any computer (The escape codes may cockup a bit *
- * on the PC etc.) as I have only used standard input and output *
- * functions. If you have any questions, problems or anything please *
- * contact me, I want connections worldwide, I want code-swappers, demo *
- * writers, tracker writers, grapix artists, C programmers etc. to all *
- * contact me, I * WILL * reply to ANYONE who writes, As it stands at *
- * the moment I am only O.K at C, I can't do a lot of things so I would *
- * like help of anyone or everyone who can help me get good. Also I may *
- * not be too hot myself yet, but I know a lot of people so if you have *
- * a problem on any computer or a piece of hardware, software etc. write *
- * to me and tell me what it is and the chances are I will know someone *
- * that can help you. *
- * *
- * Contact address : 146 High St West, Coatham, Redcar, Cleveland, *
- * TS10 1SD. England. *
- * *
- * If you prefer to phone then contact me on +44 (0642) 475394 and ask *
- * for Steven (Don't ask for linds or you will be hung up on!!) *
- \***********************************************************************/
-
- #include <stdio.h>
-
- void syntax();
- void info();
-
- main(int argc, char *argv[])
- {
- FILE *in, *in2, *out;
- int c, working=0, loop=0;
-
- printf("\nBBSADD by LINDS - TERRADOME\n\n");
-
- if (argc <2)
- {
- info();
- exit();
- }
-
- if (argc >4)
- {
- printf("Error : Too many arguments.\n");
- syntax();
- exit();
- }
-
- if (argc != 4)
- {
- printf("Error : Not enough arguments.\n");
- syntax();
- exit();
- }
-
- if ((in = fopen(argv[1],"r")) == NULL) {
- printf ("Error : Can't load source1 textfile %s\n\n",argv[1]);
- exit();
- }
-
- if ((in2 = fopen(argv[2],"r")) == NULL) {
- printf ("Error : Can't load source2 textfile %s\n\n",argv[2]);
- fclose(in); exit();
- }
-
- if ((out = fopen(argv[3],"w")) == NULL) {
- printf ("Error : Can't save destination %s\n\n",argv[3]);
- fclose(in); fclose(in2); exit();
- }
-
- while ( working == NULL ) {
- if((c=getc(in)) == EOF) {
- printf("Source1 Textfile Read Ok.\n"); working=1; }
-
- if ( working == NULL ) {
- if((putc(c,out)) == EOF) {
- printf("Error : Disk Write Error.\n\n"); working=2; } }
- }
-
- fclose (in);
-
- if (working == 1) {
- for (loop=0; loop<2; loop++) {
- if((putc(10,out)) == EOF) {
- printf("Error : Disk Write Error.\n\n"); working=2; }
- } }
-
- while (working == 1 ) {
- if((c=getc(in2)) == EOF) {
- printf("Source2 Textfile Read OK.\n"); working=3; }
-
- if ( working == 1 ) {
- if((putc(c,out)) == EOF) {
- printf("Error : Disk Write Error.\n\n"); working=2; } }
- }
-
- fclose(in2);
-
- if (working == 3)
- printf("File Written Correctly, Bye, Bye!\n\n");
-
- exit();
- }
-
- void syntax()
- {
- printf ("\n Syntax : BBSADD <source1> <source2> <destination>\n\n");
- }
-
- void info()
- {
- printf ("BBSADD will merge a textfile to the top of another textfile\n");
- printf ("and place a one line gap inbetween them. This was originally\n");
- printf ("intended for Sysops who wish to put the logo and info of there\n");
- printf ("BBS at the top of textfiles to be downloaded from there systems\n");
- printf ("(thus the name), But it can be used to merge any textfiles together.\n");
- printf ("example : differant manuals for the safe product, BBS lists, jokes etc.\n");
- printf ("If it is useful to you send me some good C source code and I will send\n");
- printf ("you some back!\n");
- printf ("\nAddress : 146 High St West, Coatham, Redcar, Cleveland, TS10 1SD, England.\n");
- syntax();
- printf ("Hope it's useful, Greets to Pete, Fudge, Steve and Pazza\n\n");
- }
-