Patch #: 17 Type: operational change Priority: none Modification: make getzones more useful in shell scripts Submitted: Maarten Carels Archived: munnari.OZ.AU mac/cap.patches/cap60.patch017 Summary: default getzones too verbose, add -v flag File: cap60/samples/getzones.c *** samples/getzones.c.orig Sat May 18 19:52:11 1991 --- samples/getzones.c Sat May 18 19:32:32 1991 *************** *** 1,6 **** ! static char rcsid[] = "$Author: djh $ $Date: 91/02/15 23:03:54 $"; ! static char rcsident[] = "$Header: getzones.c,v 2.1 91/02/15 23:03:54 djh Rel $"; ! static char revision[] = "$Revision: 2.1 $"; /* * getzones - retrieves the zone list from our bridge --- 1,6 ---- ! static char rcsid[] = "$Author: djh $ $Date: 1991/05/18 09:32:07 $"; ! static char rcsident[] = "$Header: /mac/src/cap60/samples/RCS/getzones.c,v 2.2 1991/05/18 09:32:07 djh Exp djh $"; ! static char revision[] = "$Revision: 2.2 $"; /* * getzones - retrieves the zone list from our bridge *************** *** 40,48 **** OSErr err; char *zones[NUMZONES]; /* room for pointers to zone names */ char *myzone; ! abInit(TRUE); if ((err = GetZoneList(zones, NUMZONES, &cnt)) != noErr) { fprintf(stderr, "error %d getting zone list\n", err); exit(1); --- 40,52 ---- OSErr err; char *zones[NUMZONES]; /* room for pointers to zone names */ char *myzone; + int verbose = 0; ! if (argc > 1 && strcmp(argv[1], "-v") == 0) ! verbose++; + abInit(verbose ? TRUE : FALSE); + if ((err = GetZoneList(zones, NUMZONES, &cnt)) != noErr) { fprintf(stderr, "error %d getting zone list\n", err); exit(1); *************** *** 52,62 **** NUMZONES,cnt); cnt = NUMZONES; } ! printf("Count is %d\n", cnt); myzone = GetMyZone(); for (i = 0; i < cnt ; i++) { ! printf("ZONE %s", zones[i]); ! if (strcmp(zones[i],myzone) == 0) putchar('*'); putchar('\n'); } --- 56,70 ---- NUMZONES,cnt); cnt = NUMZONES; } ! if (verbose) ! printf("Count is %d\n", cnt); myzone = GetMyZone(); for (i = 0; i < cnt ; i++) { ! if (verbose) ! printf("ZONE %s", zones[i]); ! else ! printf("%s", zones[i]); ! if (verbose && strcmp(zones[i],myzone) == 0) putchar('*'); putchar('\n'); } *** README.orig Sat May 18 19:34:30 1991 --- README Sat May 18 19:34:55 1991 *************** *** 3,9 **** (For use with AppleTalk/Ethernet bridge) o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 16, May 1991 Introduction ------------ --- 3,9 ---- (For use with AppleTalk/Ethernet bridge) o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 17, May 1991 Introduction ------------