home *** CD-ROM | disk | FTP | other *** search
- /*
- Doarchive - news bundling for TIN / DLG
-
- Reads the users user.data file to determine the archiver type. [If
- you add different archivers to your system you will have to modify
- this program to reflect your changes]
-
- News articles saved from within TIN [to $HOME/News] are archived with
- the appropriate archiver and called MESSAGES.lzh|zoo|arc
-
- */
- #include <stdio.h>
- #include <string.h>
- #include <exec/types.h>
- #include <libraries/dosextens.h>
-
-
- main(argc,argv)
- int argc;
- char *argv[];
-
- {
- int items,
- success;
- unsigned short counter;
- char filename[80],
- command[80],
- pattern[5],
- suffix[5],
- userdata[70];
- FILE *userfile;
- BOOL done;
-
- strcpy(filename,"user:");
- strcat(filename,argv[1]);
- strcat(filename,"/user.data");
- if ((userfile = fopen(filename,"rb"))==NULL)
- {
- perror("Unable to open user.data file");
- return(1);
- }
- items = fread(&userdata,67,1,userfile);
- counter = userdata[65];
- if ((counter > 0) && (counter < 4))
- {
- switch (counter)
- {
- case 1 :
- {
- strcpy(command,"arc a user:");
- strcpy(pattern,"*");
- strcpy(suffix,"");
- break;
- }
- case 2 :
- {
- strcpy(command,"zoo a user:");
- strcpy(pattern,"*");
- strcpy(suffix,"");
- break;
- }
- case 3 :
- {
- strcpy(command,"lharc a -r -0 user:");
- strcpy(pattern,"#?");
- strcpy(suffix,".LZH");
- break;
- }
- }
- strcat(command,argv[1]);
- strcat(command,"/news/");
- strcat(command,"messages");
- strcat(command,suffix);
- strcat(command," user:");
- strcat(command,argv[1]);
- strcat(command,"/news/");
- strcat(command,pattern);
- success = Execute(command,0,0);
- return(0);
- }
- return(1);
- }