ftp.nice.ch/pub/next/text/tex/apps/TeXview-kp0.25.s.tar.gz#/TeXview-grey/TeXview_main.m

This is TeXview_main.m in view mode; [Download] [Up]

/* Generated by the NeXT Project Builder 
   NOTE: Do NOT change this file -- Project Builder maintains it.
*/

#import <stdlib.h>
#import <sys/param.h>
#import <objc/NXBundle.h>

#include <kpathsea/progname.h>
#import "TeXviewApp.h"


void main(int argc, char *argv[]) {
    char	path[MAXPATHLEN+1];
	string sdir;
	FILE *f;
	char buf[256];
	int n;
	
    kpse_set_progname(argv[0]);

/* GH: To override teTeX's SELFAUTO*, we have to set the 
 *     environment variable TETEXDIR.
 *     - If TETEXDIR is already set (by the user), don't change.
 *     - Run "kpsexpand '$TETEXDIR'" and set TETEXDIR to its output.
 *     - If there was no output, finally set TETEXDIR hardcoded.
 */

	sdir = getenv("TETEXDIR");
	if (!sdir) {
		f=popen("csh -c \"kpsexpand '\\$TETEXDIR'\"","r");
		n=fread(buf,1,256,f);
		if (n>0) {
			buf[n-1]=0;
			sdir=xstrdup(buf);
		} else {
			sdir=xstrdup("/usr/local/tex");
		}
	}
//	fprintf(stderr,"TeXview-kp: SELFAUTODIR was set to %s\n",sdir);
	xputenv("TETEXDIR", sdir);

    
    NXApp = [TeXviewApp new];
    if ([[NXBundle mainBundle] getPath:path forResource:"TeXview" ofType:"nib"])
	if ([NXApp loadNibFile:path owner:NXApp withNames:NO fromZone:[NXApp zone]])
	    [NXApp run];
    [NXApp free];
    exit(0);
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.