home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Extra 1997 #5 / AmigaPlus_Extra-CD_5-97.iso / online-tools / mail / pgp_mip / pgpsendmail / source / system.c < prev    next >
C/C++ Source or Header  |  1993-10-12  |  3KB  |  83 lines

  1. /*
  2.  *      $Filename: system.c $
  3.  *      $Revision: 1.2 $
  4.  *      $Date: 1993/09/24 23:12:19 $
  5.  *
  6.  *      This file contains all routines accessing the AmigaOS. This is
  7.  *      the file you should look into when porting PGPSendMail.
  8.  *
  9.  *      © Copyright 1993 Peter Simons, Germany
  10.  *        All Rights Reserved
  11.  *
  12.  *      $Id: system.c,v 1.2 1993/09/24 23:12:19 simons Stab simons $
  13.  *
  14.  * ------------------------------ log history ----------------------------
  15.  * $Log: system.c,v $
  16.  * Revision 1.2  1993/09/24  23:12:19  simons
  17.  * Added ConfirmEncryption().
  18.  *
  19.  * Revision 1.1  1993/09/24  22:47:13  simons
  20.  * Initial revision
  21.  *
  22.  */
  23.  
  24.  
  25. /**************************************************************************
  26.  *                                                                        *
  27.  * Sektion: Macros, Definitions, Includes, Structures                     *
  28.  *                                                                        *
  29.  **************************************************************************/
  30.  
  31. /************************************* Includes ***********/
  32. #include <proto/dos.h>
  33. #include <dos/dos.h>
  34. #include <proto/intuition.h>
  35. #include <intuition/intuition.h>
  36.  
  37. /************************************* Defines ************/
  38.  
  39. /************************************* Prototypes *********/
  40.  
  41. /************************************* global Variables ***/
  42.  
  43.  
  44.         static const char __RCSId[] = "$Id: system.c,v 1.2 1993/09/24 23:12:19 simons Stab simons $";
  45.  
  46.  
  47. /**************************************************************************
  48.  *                                                                        *
  49.  * Sektion: Subroutines                                                   *
  50.  *                                                                        *
  51.  **************************************************************************/
  52.  
  53. int TruncFile(char *filename, int pos)
  54.         /*
  55.          * Function: This routine truncates a file at a given positition.
  56.          * Comment : AmigaDOS v2.04+ is required.
  57.          */
  58. {
  59.         BPTR fh;
  60.  
  61.         if ((fh = Open(filename, MODE_OLDFILE)) == NULL)
  62.                 return 0;
  63.  
  64.         pos = SetFileSize(fh, pos, OFFSET_BEGINNING);
  65.         Close(fh);
  66.         return (pos == -1) ? 0 : 1;
  67. }
  68.  
  69.  
  70. int ConfirmEncryption(void)
  71. {
  72.         struct EasyStruct es = {
  73.                 sizeof(struct EasyStruct),
  74.                 0L,
  75.                 "PGPSendMail",
  76.                 "A public key for all receipients of this mail is\n" \
  77.                         "available. Shall I encrypt it, using PGP?",
  78.                 "yes|no"
  79.         };
  80.  
  81.         return EasyRequestArgs(0L, &es, 0L, 0L);
  82. }
  83.