#!/usr/local/bin/icmake -qi

#define VER             "1.00"

int main (int argc, list argv)
{
    list
        stamps;
    string
        stampfile,
	incremental;
    int
        i;
	
    echo (0);
	
    if (argc != 2)
    {
        printf ("\n"
	        "ICCE Backup Stamp Lister  V" VER "\n"
	        "Copyright (c) ICCE 1994. All rights reserved.\n"
		"\n"
		"liststamps by Karel Kubat.\n"
		"\n"
		"Usage: liststamps stamp-directory\n"
		"where:\n"
                "       stamp-directory : the directory where the "
		                                "full backup stamps are kept\n"
                "\n");
        exit (1);
    }
    
    chdir (element (1, argv));
    if (! (stamps = makelist ("*.full")) )
        printf ("No stamps of full backups are present.\n");
    else for (i = 0; i < sizeof (stamps); i++)
    {
        stampfile = element (i, stamps);
	printf ("Full backup \"", change_ext (stampfile, ""), "\": \t");
        exec ("cat", stampfile);
        incremental = change_ext (stampfile, ".incremental");
	if (exists (incremental))
	{
	     printf ("Last incremental backup of this volume: ");
	     exec ("cat", incremental);
	}
    }
    
    exit (0);
}
