static const char * xfe_netcaster_path(void) /* * description: * Determine a path to tab.htm, which is * loaded into a browser window to start * Netcaster by checking * the following locations in order: * $HOME/.netscape/netcast/tab.htm * $MOZILLA_HOME/netcast/tab.htm * Version Registry via VR_GetPath() * fe_GetProgramDirectory()/netcast/tab.htm * * The reason for precedence is as follows: * $HOME first. Preferences set in a user's * $HOME override everything else. * This allows users some chance of running in * the case where the system admin won't install * Netcaster in globally accessible location. * This can also be useful for debugging purposes. * * $MOZILLA_HOME is now recommended as the standard * for finding Communicator and related components. * It comes next. * * The registry should get set correctly during ASD install. * However the registry's role in tracking versions has * been emphasized over its role in tracking location. * (although you can't have the former without the latter). * Rumor also has it that some people are in the habit * of deleting the registry to fix problems, so it * may not always be available. * * Last resort is to do our best effort at determining * where Communicator was invoked by getting the program directory * by looking at the invocation path. * * returns: * On success returns a path to tab.htm * On failure returns NULL * ****************************************/ { const char * result = 0; char * home; REGERR code; if (!private_xfe_netcaster_path) { private_xfe_netcaster_path = (char*)XP_ALLOC(MAXPATHLEN); if (private_xfe_netcaster_path) private_xfe_netcaster_path[0] = '\0'; else return result; } if (private_xfe_netcaster_path[0]) { result = private_xfe_netcaster_path; #ifdef DEBUG_rodt printf("DEBUG_rodt: Netcaster path a %s\n",result); #endif return result; } // // CHECK $HOME/.netscape // home = getenv("HOME"); if (home) { XP_STRCPY(private_xfe_netcaster_path, home); if (xfe_last_character(private_xfe_netcaster_path) != '/') XP_STRCAT(private_xfe_netcaster_path,"/"); XP_STRCAT(private_xfe_netcaster_path,".netscape/"); XP_STRCAT(private_xfe_netcaster_path,netcasterTabHtmlPath); if (xfe_path_exists(private_xfe_netcaster_path)) { result = private_xfe_netcaster_path; #ifdef DEBUG_rodt printf("DEBUG_rodt: Netcaster path b %s\n",result); #endif return result; } } // // CHECK $MOZILLA_HOME // home = getenv("MOZILLA_HOME"); if (home) { XP_STRCPY(private_xfe_netcaster_path, home); if (xfe_last_character(private_xfe_netcaster_path) != '/') XP_STRCAT(private_xfe_netcaster_path,"/"); XP_STRCAT(private_xfe_netcaster_path,netcasterTabHtmlPath); if (xfe_path_exists(private_xfe_netcaster_path)) { result = private_xfe_netcaster_path; #ifdef DEBUG_rodt printf("DEBUG_rodt: Netcaster path c %s\n",result); #endif return result; } } // // CHECK THE REGISTRY // // Could also call VR_InRegistry("Netcaster") but it would be redundant // Note that VR_ValidateComponent also calls VR_GetPath() but it doesn't // return any path information // code = VR_GetPath(netcasterTabHtmlRegistryNode, sizeof(private_xfe_netcaster_path)-1, private_xfe_netcaster_path); if (code == REGERR_OK) { code = VR_ValidateComponent(netcasterTabHtmlRegistryNode); if (code == REGERR_OK && xfe_path_exists(private_xfe_netcaster_path)) // extra check { result = private_xfe_netcaster_path; #ifdef DEBUG_rodt printf("DEBUG_rodt: Netcaster path d %s\n",result); #endif return result; } } private_xfe_netcaster_path[0] = '\0'; // // CHECK THE PROGRAM DIRECTORY // fe_GetProgramDirectory(private_xfe_netcaster_path, MAXPATHLEN - 1); if (private_xfe_netcaster_path[0]) { if (xfe_last_character(private_xfe_netcaster_path) != '/') XP_STRCAT(private_xfe_netcaster_path,"/"); XP_STRCAT(private_xfe_netcaster_path,netcasterTabHtmlPath); if (xfe_path_exists(private_xfe_netcaster_path)) { result = private_xfe_netcaster_path; #ifdef DEBUG_rodt printf("DEBUG_rodt: Netcaster path e %s\n",result); #endif return result; } } private_xfe_netcaster_path[0] = '\0'; #ifdef DEBUG_rodt printf("DEBUG_rodt: Netcaster path not found\n"); #endif return result; }
void interp(void) { char line[256]; char *p; while(1) { putchar('>'); putchar(' '); fflush(stdin); fflush(stdout); fflush(stderr); gets(line); /* p points to next word after verb on command line */ p = line; while (*p && *p!=' ') p++; if (!*p) p = 0; else { while(*p && *p==' ') p++; } switch(toupper(line[0])) { case 'N': vCreate(p); break; case 'A': error("VR_SetRegDirectory", VR_SetRegDirectory(p)); break; case 'C': error("VR_Close", VR_Close()); break; case 'I': vInstall(p); break; case 'R': error("VR_Remove", VR_Remove(p)); break; case 'X': error("VR_InRegistry", VR_InRegistry(p)); break; case 'T': error("VR_ValidateComponent", VR_ValidateComponent(p)); break; #if LATER case 'E': vEnum(p); break; case 'V': vVersion(p); break; case 'P': vPath(p); break; case 'F': vGetRefCount(p); break; case 'D': vGetDir(p); break; case 'S': puts("--Unsupported--"); #endif case 'H': default: vHelp(line); break; case 'Q': return; } /* switch */ } /* while */ assert(0); return; /* shouldn't get here */ } /* interp */