Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2005/1119/18

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


64-bit fixes.
 [jmk] --rw-rw-r-- M 107020 glenda sys 41032 Nov 19 21:00 sys/src/cmd/ms2html.c
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:25,30 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:25,32
	  };
	  
	  char *delim = "$$";
	+ char *basename;
	+ char *title;
	  int eqnmode;
	  
	  int 	quiet;
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:38,45 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:40,48
	  int ifwastrue[Maxif];
	  
	  int list, listnum, example;
	- int hangingau, hangingdt, hanginghead;
	+ int hangingau, hangingdt, hanginghead, hangingcenter;
	  int indirective, paragraph, sol, titleseen, ignore_nl, weBref;
	+ void dohangingcenter(void);
	  
	  typedef struct Goobie Goobie;
	  typedef struct Goobieif Goobieif;
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:1363,1369 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:1366,1372
	  static void
	  usage(void)
	  {
	- 	sysfatal("Usage: %s\n", argv0);
	+ 	sysfatal("usage: ms2html [-q] [-b basename] [-d '$$'] [-t title]\n");
	  }
	  
	  void
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:1371,1376 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:1374,1385
	  {
	  	quiet = 1;
	  	ARGBEGIN {
	+ 	case 't':
	+ 		title = EARGF(usage());
	+ 		break;
	+ 	case 'b':
	+ 		basename = EARGF(usage());
	+ 		break;
	  	case 'q':
	  		quiet = 0;
	  		break;
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:1580,1585 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:1589,1595
	  g_SH(int, char**)
	  {
	  	dohanginghead();
	+ 	dohangingcenter();
	  	closel();
	  	closefont();
	  	Bprint(&bout, "<H%d>", HH);
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:1594,1599 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:1604,1610
	  	closel();
	  	closefont();
	  
	+ 	dohangingcenter();
	  	if(argc == 1)
	  		level = 0;
	  	else {
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:1624,1655 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:1635,1679
	  	closefont();
	  
	  	if(!titleseen){
	- 		/* get base part of filename */
	- 		p = strrchr(ssp->filename, '/');
	- 		if(p == nil)
	- 			p = ssp->filename;
	- 		else
	- 			p++;
	- 		strncpy(name, p, sizeof(name));
	- 		name[sizeof(name)-1] = 0;
	- 	
	- 		/* dump any extensions */
	- 		np = strchr(name, '.');
	- 		if(np)
	- 			*np = 0;
	- 	
	+ 		if(!title){
	+ 			/* get base part of filename */
	+ 			p = strrchr(ssp->filename, '/');
	+ 			if(p == nil)
	+ 				p = ssp->filename;
	+ 			else
	+ 				p++;
	+ 			strncpy(name, p, sizeof(name));
	+ 			name[sizeof(name)-1] = 0;
	+ 		
	+ 			/* dump any extensions */
	+ 			np = strchr(name, '.');
	+ 			if(np)
	+ 				*np = 0;
	+ 			title = p;
	+ 		}
	  		Bprint(&bout, "<title>\n");
	- 		Bprint(&bout, "%s\n", p);
	+ 		Bprint(&bout, "%s\n", title);
	  		Bprint(&bout, "</title>\n");
	  		Bprint(&bout, "<body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\" LINK=\"#0000FF\" VLINK=\"#330088\" ALINK=\"#FF0044\">\n");
	  		titleseen = 1;
	  	}
	  
	+ 	Bprint(&bout, "<center>");
	+ 	hangingcenter = 1;
	  	Bprint(&bout, "<H%d>", 1);
	  	hanginghead = 1;
	  }
	  
	  void
	+ dohangingcenter(void)
	+ {
	+ 	if(hangingcenter){
	+ 		Bprint(&bout, "</center>");
	+ 		hangingcenter = 1;
	+ 	}
	+ }
	+ 
	+ void
	  g_AU(int, char**)
	  {
	  	closel();
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:1895,1901 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:1919,1926
	  g_AB(int, char**)
	  {
	  	closel();
	- 	Bprint(&bout, "<DL><DD><H4>ABSTRACT</H4>\n");
	+ 	dohangingcenter();
	+ 	Bprint(&bout, "<center><H4>ABSTRACT</H4></center><DL><DD>\n");
	  }
	  
	  void
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:2071,2082 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:2096,2111
	  	else
	  		return;
	  
	- 	p = strrchr(sstack[0].filename, '/');
	- 	if(p != nil)
	- 		p++;
	- 	else
	- 		p = sstack[0].filename;
	- 	snprint(name, sizeof(name), "%s.%d%d.gif", p, getpid(), gif++);
	+ 	if(basename)
	+ 		p = basename;
	+ 	else{
	+ 		p = strrchr(sstack[0].filename, '/');
	+ 		if(p != nil)
	+ 			p++;
	+ 		else
	+ 			p = sstack[0].filename;
	+ 	}
	+ 	snprint(name, sizeof(name), "%s.%d.gif", p, gif++);
	  	fd = create(name, OWRITE, 0664);
	  	if(fd < 0){
	  		fprint(2, "ms2html: can't create %s: %r\n", name);
	/n/sourcesdump/2005/1119/plan9/sys/src/cmd/ms2html.c:2106,2113 - 
	/n/sourcesdump/2005/1120/plan9/sys/src/cmd/ms2html.c:2135,2142
	  		close(fd);
	  		close(pfd[0]);
	  		fprint(pfd[1], ".ll 7i\n");
	- 		fprint(pfd[1], ".EQ\ndelim %s\n.EN\n", delim);
	- 		fprint(pfd[1], ".%s\n", argv[0]);
	+ 	/*	fprint(pfd[1], ".EQ\ndelim %s\n.EN\n", delim); */
	+ 	/*	fprint(pfd[1], ".%s\n", argv[0]); */
	  		for(;;){
	  			p = Brdline(&ssp->in, '\n');
	  			if(p == nil)


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.