home *** CD-ROM | disk | FTP | other *** search
- ;/* ListCom.c
- lc -tr ListCom.c
- blink with ListCom.lnk
- quit
- */
- /*************************************************************************/
- /* List Comment Version 0.2a Release 8.11 Created: August 11, 1991 */
- /* ©1991 John Bianchi Bianchi Computer Systems */
- /*************************************************************************/
-
- #include <proto/all.h>
- #include <libraries/dos.h>
- #include <string.h>
-
- UBYTE *prog = "ListCom";
- UBYTE *ver = "1.0";
- UBYTE *vers = "\0$VER: ListComment 1.0 (10.8.91)";
- UBYTE *CopyRight = "©1991 John Bianchi All Rights Reserved";
-
- struct DosLibrary *DOSBase = NULL;
- struct FileInfoBlock fi;
-
- main (argc, argv)
- int argc;
- char *argv[];
-
- {
- long lock;
- int error;
- char filepath[100],filecomment[80];
- int found=FALSE;
- unsigned int l;
-
- printf("%s %s %s\n",prog,ver,CopyRight);
-
- if(argc >=4)
- printf("Error: too many arguments\n");
-
- if(argc <= 1 || argc >= 4 || strcmp(argv[1],"?") == 0)
- {
- printf("TEMPLATE: %s <path> <comment>\n",prog);
- exit(FALSE);
- }
-
- strcpy(filepath, argv[1]);
- strcpy(filecomment, argv[2]);
-
- lock = Lock(filepath, ACCESS_READ);
-
- if(!lock)
- {
- printf("ERROR: Can't get a Lock on: %s\n",filepath);
- exit(FALSE);
- }
-
- l=strlen(filecomment);
-
- if(Examine(lock, &fi))
- do
- if(*fi.fib_Comment)
- {
- if(strnicmp(fi.fib_Comment,filecomment,l) == 0)
- {
- if(found == FALSE)
- {
- printf("\n%-30s %9s : %s\n","NAME","SIZE/DIR","COMMENT");
- found=TRUE;
- }
- printf("%-30s ",fi.fib_FileName);
-
- if(fi.fib_DirEntryType > 0)
- printf("directory");
- else
- printf("%9ld",fi.fib_Size);
-
- printf(" : %s\n",fi.fib_Comment);
- }
- }
- while(ExNext(lock, &fi));
-
- error = IoErr();
-
- if(error != ERROR_NO_MORE_ENTRIES)
- {
- printf("Error %d occurred!\n", error);
- exit(FALSE);
- }
- if(found == FALSE)
- printf("no files listed\n");
-
- exit(TRUE);
-
- }
-
-