void NDAClose(void) { int i; if (gCalcActive) { CloseWindow(gCalcWinPtr); gCalcWinPtr = NULL; gCalcActive = FALSE; } if (gBuffer != NULL) { free(gBuffer); gBuffer = NULL; } if (gOpList != NULL) { free(gOpList); gOpList = NULL; } for (i = 0; i < AB_CALC_STACK_DEPTH; i++) { if (gStackList[i].memPtr != NULL) { free(gStackList[i].memPtr); gStackList[i].memPtr = NULL; } } CloseResourceFile(gResourceId); ResourceShutDown(); }
int main(int argc, char *argv[]) { int ch; char *fn; /* Report stack usage at end if compile option is set */ __REPORT_STACK(); /* Parse the command-line options */ while ((ch = getopt(argc, argv, "bc")) != -1) switch (ch) { case 'c': cflag = 1; break; case 'b': bflag = 1; break; case '?': default: usage(); } argc -= optind; argv = argv + optind; if (!*argv) usage(); else { /* Start up the resource manager */ ResourceStartUp(userid()); /* Parse the command-line filenames */ while (*argv) { fn = *argv++; ReadResources(fn); if (*argv && !bflag) (void)printf("\n"); } /* Shut down the resource manager */ /* (which closes open resource files) */ ResourceShutDown(); } exit(rval); }