home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / amiga / programm / 15441 < prev    next >
Encoding:
Text File  |  1992-11-06  |  2.4 KB  |  80 lines

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!netsys!pagesat!spssig.spss.com!news.oc.com!utacfd.uta.edu!rwsys!caleb!jdp
  2. From: jdp@caleb.UUCP (Jim Pritchett)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: BTN v2.1 handler problem
  5. Message-ID: <lQIWr*sf1@caleb.UUCP>
  6. Date: Wed, 04 Nov 1992 05:32:37 GMT
  7. Organization: is sometimes desirable
  8. Lines: 70
  9.  
  10. Hello,
  11.        I have been Manxifying Jonathon Hue's tar program from the old Fish
  12. disk in order to fix some bugs Andy Finkel pointed out.  (I am using Aztec
  13. C v5.2a.)  I've run into the following problem:
  14.  
  15. the standard write() command produces a return value of -1 and tapemon prints
  16. " Function/mode error."  The write command in tar works fine on files, but it
  17. fails on BTN:.  So, using the same method used in tar, I wrote the simple test
  18. program below:
  19.  
  20.  
  21. #include <stdio.h>
  22.  
  23. main(argc, argv)
  24.   int argc;
  25.   char **argv;
  26.  
  27. {
  28.   char buffer[10240];
  29.   int err, i;
  30.   long tape;
  31.  
  32.   if (argc <= 1)
  33.   {
  34.     printf("No argument.  Syntax is:  %s filename.", argv[0]);
  35.     exit();
  36.   }
  37.  
  38.   tape = creat(argv[1], 0666);
  39.   printf("creat returned %ld.\n", tape);
  40.  
  41.   for (i=0; i < 10240; i++)  buffer[i] = (char) i;
  42.  
  43.   err = write(tape, buffer, 10240L);
  44.  
  45.   printf("err is %ld.\n", err);
  46.  
  47.   (void) close(tape);
  48.  
  49. }
  50.  
  51.  
  52. This program produces the same error.  It also produces this Enforcer hit on the
  53. close() call.  I don't know why.
  54.  
  55. Program Counter (approximate)=  3030D0        Fault address       =4E7343FA
  56. User stack pointer           =  35F844        DOS process address =  2A0E08
  57. Data: 00000000 FFFFFFFF 00000000 00004E55 00000008 0000002B 0000003B 002A0E64
  58. Addr: 4E7343FA 00342662 002A0E08 002A11D0 003478D6 0035F860 0020C9D0 001FFFA0
  59. Stck: 002FDA72 4E7343FA 00000000 0000A008 0000000A 000000A2 00309B34 0035F870
  60. READ-WORD  (---)(-)(-)    SR=0004   SSW=0769
  61. New_WShell, "test"
  62.  
  63.  
  64.  
  65. From looking at the BTN: source, it appears that BTN thinks that the file has
  66. not been opened for "write" access.  (Note, I don't really understand how device
  67. drivers work, so I may have this part wrong.)  Is this a bug in BTN: or Manx?
  68. Or, am I just missing something obvious?  I really don't understand why the
  69. original tar executable works fine on this, but when I recompile it, it fails.
  70.  
  71. If this really is a compiler bug, how can I work around it?  Is there a fix?
  72.  
  73.                                    Thanks,
  74.  
  75.                                                 Jim Pritchett
  76.  
  77.  
  78. UUCP:  rwsys.lonestar.org!caleb!jdp
  79.  or    utacfd.uta.edu!rwsys!caleb!jdp
  80.