--- YDEC.C Wed Nov 14 11:30:52 2001 +++ ydec.c Sat Feb 9 19:28:14 2002 @@ -23,22 +23,35 @@ // Includes for Windows-version. Only used to create a MessageBox +/* #include #include +*/ #include #include +/* #include +*/ #include #include // For SOPEN +/* #include +*/ #include -#include +#include +/* #include #include +*/ +#include +#include +off_t filelength(int fd); +/* #pragma warn -pro +*/ int errors,errparts,errfiles; @@ -980,7 +993,7 @@ int main(int ac, char * av[]) { - struct ffblk fblk; + // struct ffblk fblk; int id; char mask[260]; char * cp; @@ -999,6 +1012,15 @@ print("\r\n"); print("yDec-v1 (14.Nov.2001) - Public Domain - by Juergen Helbing - www.yenc.org\r\n\r\n"); + + if (ac < 2) + goto usage; // so much for "goto considered harmful..." + for (id=1; id=1) print("[0]: %s\r\n",av[0]); // if (ac>=2) print("[1]: %s\r\n",av[1]); // if (ac>=3) print("[2]: %s\r\n",av[2]); @@ -1037,7 +1059,8 @@ // For drag and drop support ! if (errors==0) { - MessageBox(NULL,"End of decoder","yDecode",MB_OK | MB_ICONINFORMATION); + // MessageBox(NULL,"End of decoder","yDecode",MB_OK | MB_ICONINFORMATION); + print("Decode ended without errors.\n"); } goto done; @@ -1062,6 +1085,7 @@ next: id=findnext(&fblk); if (id==0) goto loop; +*/ done: @@ -1073,7 +1097,7 @@ if (errfiles) print("%d file(s) with errors stored to disk\r\n",errfiles); if (errparts) print("%d corrupt part(s) detected.\r\n",errparts); - MessageBox(NULL,"Decoder terminated. \r\n\r\n Errors found !","yDecode",MB_OK|MB_ICONSTOP); + // MessageBox(NULL,"Decoder terminated. \r\n\r\n Errors found !","yDecode",MB_OK|MB_ICONSTOP); } return(0); @@ -1083,8 +1107,10 @@ print("Usage: yDecoder v-1.0\r\n\r\n"); print("ydec filename (for normal operation) \r\n"); print("ydec *.txt (for operation on multiple files)\r\n"); +/* print("ydec filename /a (for all debug output) \r\n"); print("ydec filename /a | more (for all debug output with paging) \r\n"); +*/ return(1); @@ -1093,3 +1119,12 @@ +/* cheap filelength() knockoff :) */ +off_t filelength(int fd) +{ + off_t offset = lseek(fd, 0, SEEK_CUR); + off_t answer = lseek(fd, 0, SEEK_END); + lseek(fd, offset, SEEK_SET); + return answer; +} +