aura.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* esoteric.voxelperfect.net archive note:
  2. this was at http://nhi.netfirms.com/aura.html previously */
  3. /* Aura revision 0.03 */
  4. /* send comments to temperanza@softhome.net */
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <ctype.h>
  8. #include <string.h>
  9. unsigned short int c, i = 1, q, x;
  10. short int n = 1;
  11. char a[5000], f[5000], b, o, *s=f;
  12. int main(int argc,char *argv[])
  13. {
  14. FILE *z;
  15. q=argc;
  16. if((z=fopen(argv[1],"r"))) {
  17. while( (b=getc(z))>0 )
  18. *s++=b;
  19. *s=0;
  20. }
  21. x = strlen(f);
  22. while (f[i]) {
  23. /* x = (unsigned short int) f[i] % 8; */
  24. for (c = 0; c <= strlen(f); c++)
  25. {
  26. if (!isgraph(f[c]) && (f[c] != ' '))
  27. {
  28. a[c] = (f[c] % 8) + 48;
  29. }
  30. else a[c] = f[c];
  31. }
  32. printf("%s %d %d \n",a,n,i);
  33. if ((i == x) || (i == 0)) i = abs(i - x);
  34. i += n;
  35. switch(o=1,((unsigned short int) f[i] % 8)) {
  36. case 0:
  37. if (f[i] == 0) exit(EXIT_SUCCESS);
  38. f[i+n] /= f[i]; break;
  39. case 1: f[i+n] -= f[i]; break;
  40. case 2: f[i+n]--; break;
  41. case 3: f[i+n] += getchar(); break;
  42. case 4: n -= (n*2); break;
  43. case 5:
  44. b = (char) f[i-n];
  45. if (isgraph(b) || (b == ' '))
  46. printf("%c",b);
  47. f[i+n]++; break;
  48. case 6: f[i+n] += f[i]; break;
  49. case 7: f[i+n] *= f[i]; break;
  50. default: o=0;
  51. }
  52. printf("\n");
  53. }
  54. return 0;
  55. }