home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 2: PC / frozenfish_august_1995.bin / bbs / d09xx / d0902.lha / Error / error.c < prev    next >
C/C++ Source or Header  |  1993-08-26  |  14KB  |  346 lines

  1. /*
  2.     error.c for AmigaDOS 3.0
  3.     Print Message text for AmigaDOS errors along with probable causes
  4.     and suggestions for recovery.
  5.  
  6.     N Fisketj°n
  7. */
  8.  
  9. #include "stdio.h"
  10. #include "stdlib.h"
  11.  
  12. void version(void)
  13. {
  14.     printf("$VER: Error 1.0 2.7.93");
  15. }
  16.  
  17. void cause(void)
  18. {
  19.     printf("\n\033[3m  Probable cause:\033[0m\n");
  20. }
  21.  
  22. void recovery(void)
  23. {
  24.     printf("\n\033[3m  Recovery suggestion:\033[0m\n");
  25. }
  26.  
  27. void verify(void)
  28. {
  29.     printf("  Verify the correct command format.\n");
  30. }
  31.  
  32. void incorrect(void)
  33. {
  34.     printf("  Incorrect command line.\n");
  35. }
  36.  
  37. void main(argc,argv)
  38. int argc;
  39. char *argv[];
  40.  
  41. {  
  42.     int code;
  43.       
  44.     if (argc != 2) {
  45.         printf("Usage: error \033[3merrorcode\033[0m\n");
  46.         exit(0);
  47.     }
  48.     else {
  49.         code = atoi(argv[1]);
  50.         switch(code) {
  51.             case 103: {
  52.                 printf("\033[3m  103: Not enough memory\033[0m\n");
  53.                 cause();
  54.                 printf("  Not enough memory in your Amiga to carry out the operation.\n");
  55.                 recovery();
  56.                 printf("  Close any unnecessary windows and applications, then re-issue the command. If it still doesn't work, reboot. Memory may be sufficient, but fragmented. It is possible that you may need to add more RAM to your system.\n");
  57.                 break;
  58.             }
  59.             case 104: {
  60.                 printf("\033[3m  104: Process table full\033[0m\n");
  61.                 cause();
  62.                 printf("  There is a limit to the number of possible processes.\n");
  63.                 recovery();
  64.                 printf("  Stop one or more tasks.\n");
  65.                 break;
  66.             }
  67.             case 114: {
  68.                 printf("\033[3m  114: Bad template\033[0\n");
  69.                 cause();
  70.                 incorrect();
  71.                 recovery();
  72.                 verify();
  73.                 break;
  74.             }
  75.             case 115: {
  76.                 printf("\033[3m  115: Bad number\033[0\n");
  77.                 cause();
  78.                 printf("  The program was expecting a numerical argument.\n");
  79.                 recovery();
  80.                 verify();
  81.                 break;
  82.             }
  83.             case 116: {
  84.                 printf("\033[3m  116: Required argument missing\033[0\n");
  85.                 cause();
  86.                 incorrect();
  87.                 recovery();
  88.                 verify();
  89.                 break;
  90.             }
  91.             case 117: {
  92.                 printf("\033[3m  117: Argument after '=' missing\033[0\n");
  93.                 cause();
  94.                 incorrect();
  95.                 recovery();
  96.                 verify();
  97.                 break;
  98.             }
  99.             case 118: {
  100.                 printf("\033[3m  118: Too many arguments\033[0\n");
  101.                 cause();
  102.                 incorrect();
  103.                 recovery();
  104.                 verify();
  105.                 break;
  106.             }
  107.             case 119: {
  108.                 printf("\033[3m  119: Unmatched quotes\033[0\n");
  109.                 cause();
  110.                 incorrect();
  111.                 recovery();
  112.                 verify();
  113.                 break;
  114.             }
  115.             case 120: {
  116.                 printf("\033[3m  120: Argument line invalid or too long\033[0m\n");
  117.                 cause();
  118.                 printf("  Your command line is incorrect or contains too many arguments.\n");
  119.                 recovery();
  120.                 verify();
  121.                 break;
  122.             }    
  123.             case 121: {
  124.                 printf("\033[3m  121: File is not executable\033[0m\n");
  125.                 cause();
  126.                 printf("  You misspelled the command name, or the file may not be a loadable (program or script) file.\n");
  127.                 recovery();
  128.                 printf("  Retype the filename and make sure that the file is a program file. In order to execute a sqript, either the s bit must be set or the EXECUTE command must be used.\n");
  129.                 break;
  130.             }
  131.             case 122: {
  132.                 printf("\033[3m  122: Invalid resident library\033[0m\n");
  133.                 cause();
  134.                 printf("  You are trying to use commands with a previous version.\n");
  135.                 recovery();
  136.                 printf("  Reboot with the current version of AmigaDOS.\n"); 
  137.                 break;
  138.             }
  139.             case 202: {
  140.                 printf("\033[3m  202: Object in use\033[0m\n");
  141.                 cause();
  142.                 printf("  The specified file or directory is already being used by another application. If an application is reading a file, no other program can write to it, and vice versa.\n");
  143.                 recovery();
  144.                 printf("  Stop the other application that is using the file or directory, and re-issue the command.\n");
  145.                 break;
  146.             }
  147.             case 203: {
  148.                 printf("\033[3m  203: Object already exists\033[0m\n");
  149.                 cause();
  150.                 printf("  The name that you specified already belongs to another file or directory.\n");
  151.                 recovery();
  152.                 printf("  Use another name, or delete the existing file or directory, and replace it.\n");
  153.                 break;
  154.             }
  155.             case 204: {
  156.                 printf("\033[3m  204: Directory not found\033[0m\n");
  157.                 cause();
  158.                 printf("  AmigaDOS cannot find the directory you specified. You may have made a typing or spelling error.\n");
  159.                 recovery();
  160.                 printf("  Check the directory name (use DIR if necessary). Re-issue the command.\n");
  161.                 break;
  162.             }
  163.             case 205: {
  164.                 printf("\033[3m  205: Object not found\033[0m\n");
  165.                 cause();
  166.                 printf("  AmigaDOS cannot find the file or device you specified. You may have made a typing or spelling error.\n");
  167.                 recovery();
  168.                 printf("  Check the filename (use DIR) or the device name (use INFO). Re-issue the command.\n");
  169.                 break;
  170.             }
  171.             case 206: {
  172.                 printf("\033[3m  206: Invalid window description\033[0m\n");
  173.                 cause();
  174.                 printf("  This occurs when specifying a window size for a Shell, ED, or ICONX window. You may have made the window too big or too small, or you may have omitted an argument. This error also occurs with the NEWSHELL command, if you supply a device name that is not a window.\n");
  175.                 recovery();
  176.                 printf("  Re-issue the window specification.\n");
  177.                 break;
  178.             }
  179.             case 209: {
  180.                 printf("\033[3m  209: Packet request type unknown\033[0m\n");
  181.                 cause();
  182.                 printf("  You have asked a device handler to attempt an operation it cannot do. For example, the console handler cannot rename anything.\n");
  183.                 recovery();
  184.                 printf("  Check the request code passed to device handlers for the appropriate request.\n");
  185.                 break;
  186.             }
  187.             case 210: {
  188.                 printf("\033[3m  210: Object name invalid\033[0m\n");
  189.                 cause();
  190.                 printf("  There is an invalid character in the filename or the filename is too long.\n");
  191.                 recovery();
  192.                 printf("  Re-type the name, being sure not to use any invalid characters or exceed the maximum length.\n");
  193.                 break;
  194.             }
  195.             case 211: {
  196.                 printf("\033[3m  211: Invalid object lock\033[0m\n");
  197.                 cause();
  198.                 printf("  You have used something that is not a valid lock.\n");
  199.                 recovery();
  200.                 printf("  Check that your only passes valid locks to AmigaDOS calls that expect locks.\n");
  201.                 break;
  202.             }
  203.             case 212: {
  204.                 printf("\033[3m  212: Object not of required type\033[0m\n");
  205.                 cause();
  206.                 printf("  You may have specified a filename for an operation that requires a directory name, or vice versa.\n");
  207.                 recovery();
  208.                 verify();
  209.                 break;
  210.             }
  211.             case 213: {
  212.                 printf("\033[3m  213: Disk not validated\033[0m\n");
  213.                 cause();
  214.                 printf("  If you have just inserted a disk, the disk validation process may be in progress. It is also possible that the disk is corrupt.\n");
  215.                 recovery();
  216.                 printf("  If you've just inserted the disk, wait for the validation process to finish. This may take less than a minute for a floppy disk or up to several minutes for a hard disk. If the disk is corrupt, it cannot be validated. In this case, try to retrieve the disk's files and copy them to another disk.\n");
  217.                 break;
  218.             }
  219.             case 214: {
  220.                 printf("\033[3m  214: Disk is write-protected\033[0m\n");
  221.                 cause();
  222.                 printf("  The plastic tab is in the write-protect position.\n");
  223.                 recovery();
  224.                 printf("  Remove the disk, move the tab, and re-insert the disk. Or use a different disk.\n");
  225.                 break;
  226.             }
  227.             case 215: {
  228.                 printf("\033[3m  215: Rename across devices attempted\033[0m\n");
  229.                 cause();
  230.                 printf("  RENAME only changes a filename on the same volume. You can use RENAME to move a file from one directory to another, but you cannot move files from one volume to another.\n");
  231.                 recovery();
  232.                 printf("  Use COPY to copy the file to the destination volume. Delete it from the source volume, if desired. Then use RENAME.\n");
  233.                 break;
  234.             }
  235.             case 216: {
  236.                 printf("\033[3m  216: Directory not empty\033[0m\n");
  237.                 cause();
  238.                 printf("  This error occurs if you attempt to delete a directory that contains files or sudirectories.\n");
  239.                 recovery();
  240.                 printf("  If you are sure you want to delete the complete directory, use the ALL option of DELETE.\n");
  241.                 break;
  242.             }
  243.             case 217: {
  244.                 printf("\033[3m  217: Too many levels\033[0m\n");
  245.                 cause();
  246.                 printf("  You've exceeded the limit of 15 soft links.\n");
  247.                 recovery();
  248.                 printf("  Reduce the number of soft links.\n");
  249.                 break;
  250.             }
  251.             case 218: {
  252.                 printf("\033[3m  218: Device (or volume) not mounted\033[0m\n");
  253.                 cause();
  254.                 printf("  If the device is a floppy disk, it has not been inserted in a drive. If it is another type of device, it has not been mounted with MOUNT or the name is misspelled.\n");
  255.                 recovery();
  256.                 printf("  Insert the correct floppy disk, mount the device, check the spelling of the device name, or revise your MountList file.\n");
  257.                 break;
  258.             }
  259.             case 219: {
  260.                 printf("\033[3m  219: Seek error\033[0m\n");
  261.                 cause();
  262.                 printf("  You have attempted to call SEEK with invalid arguments.\n");
  263.                 recovery();
  264.                 printf("  Make sure that you only SEEK within the file. You cannot SEEK outside the bounds of the file.\n");
  265.                 break;
  266.             }
  267.             case 220: {
  268.                 printf("\033[3m  220: Comment is too long\033[0m\n");
  269.                 cause();
  270.                 printf("  Your filenote has exceeded the maximum number of characters (79).\n");
  271.                 recovery();
  272.                 printf("  Use a shorter filenote.\n");
  273.                 break;
  274.             }
  275.             case 221: {
  276.                 printf("\033[3m  221: Disk is full\033[0m\n");
  277.                 cause();
  278.                 printf("  There is not enough room on the disk to perform the requested operation.\n");
  279.                 recovery();
  280.                 printf("  Delete some unnecessary files or directories, or use a different disk.\n");
  281.                 break;
  282.             }
  283.             case 222: {
  284.                 printf("\033[3m  222: Object is protected from deletion\033[0m\n");
  285.                 cause();
  286.                 printf("  The d (deletable) protection bit of the file or directory is clear.\n");
  287.                 recovery();
  288.                 printf("  If you are certain that you want to delete the file or directory, use PROTECT to set the d bit or use the FORCE option of DELETE.\n");
  289.                 break;
  290.             }
  291.             case 223: { 
  292.                 printf("\033[3m  223: File is write protected\033[0m\n");
  293.                 cause();
  294.                 printf("  The w (writable) protection bit of the file is clear.\n");
  295.                 recovery();
  296.                 printf("  If you are certain that you want to overwrite the file, use PROTECT to set the w bit.\n");
  297.                 break;
  298.             }
  299.             case 224: { 
  300.                 printf("\033[3m  224: File is read protected\033[0m\n");
  301.                 cause();
  302.                 printf("  The r (readable) protection bit of the file is clear.\n");
  303.                 recovery();
  304.                 printf("  Use PROTECT to set the r bit of the file.\n");
  305.                 break;
  306.             }
  307.             case 225: {
  308.                 printf("\033[3m  225: Not a valid DOS disk\033[0m\n");
  309.                 cause();
  310.                 printf("  The disk in the drive is not an AmigaDOS disk, it has not been formatted, or it is corrupt.\n");
  311.                 recovery();
  312.                 printf("  Check to make sure you are using the correct disk. If you know the disk worked before, use a disk recovery program to salvage its files. If the disk has not been formatted, use FORMAT to do so.\n");
  313.                 break;
  314.             }
  315.             case 226: {
  316.                 printf("\033[3m  226: No disk in drive\033[0m\n");
  317.                 cause();
  318.                 printf("  The disk is not properly inserted in the specified drive.\n");
  319.                 recovery();
  320.                 printf("  Insert the appropriate disk in the specified drive.\n");
  321.                 break;
  322.             }
  323.             case 232: {
  324.                 printf("\033[3m  232: No more entries in directory\033[0m\n");
  325.                 cause();
  326.                 printf("  This indicates that the AmigaDOS call EXNEXT has no more entries in the directory you are examining.\n");
  327.                 recovery();
  328.                 printf("  Stop calling EXNEXT.\n");
  329.                 break;
  330.             }
  331.             case 233: {
  332.                 printf("\033[3m  233: Object is soft link\033[0m\n");
  333.                 cause();
  334.                 printf("  You tried to perform an operation on a soft link that should only be performed on a file or directory.\n");
  335.                 recovery();
  336.                 printf("  AmigaDOS uses Action_Read_Link to resolve the soft link and retries the operation.\n");
  337.                 break;
  338.             }
  339.             default: {
  340.                 printf("%s is an unrecognized error code.\n",argv[1]);
  341.                 break;
  342.             }
  343.         }
  344.     }
  345. }
  346.