tr@madeleine (tom reingold) (07/26/89)
Could someone please give me hints on using Russ Nelson's face2ps suite of programs? I compiled it on a Sun 3 running SunOS 4.0.3 using gcc version 1.35 and it just says "Memory fault". What are the command line args etc. anyway? Tom Reingold |INTERNET: tr@bellcore.com Bell Communications Research |UUCP: bellcore!tr 444 Hoes La room 1H217 |PHONE: (201) 699-7058 [work], Piscataway, NJ 08854 | (201) 287-2345 [home]
nelson@sun.soe.clarkson.edu (Russ Nelson) (07/26/89)
In article <17286@bellcore.bellcore.com> tr@madeleine (tom reingold) writes:
Could someone please give me hints on using Russ Nelson's face2ps suite
of programs? I compiled it on a Sun 3 running SunOS 4.0.3 using gcc
version 1.35 and it just says "Memory fault". What are the command
line args etc. anyway?
Hmmmm... I suspect that the code to find the program name doesn't
work. The command line args are given in the README file. Try the
following patch:
*** orig/face2ps.c Wed Jul 26 09:40:06 1989
--- face2ps.c Wed Jul 26 09:42:56 1989
***************
*** 19,24 ****
--- 19,26 ----
char absolute_format[] = "./%s.ps"; /* full pathname to the prologs */
#endif
+ char version[] = "Version 1, patchlevel 1";
+
#ifdef __TURBOC__
#include <stdlib.h>
#else
***************
*** 102,111 ****
progend = strchr(program, '.');
if (progend)
*progend = '\0';
#else
program = strrchr(argv[0], '/');
#endif
- program++;
if (setvbuf(stdout, 0, _IOFBF, 4096)) {
fprintf(stderr, "%s: ran out of memory on setvbuf to stdout\n",
--- 104,117 ----
progend = strchr(program, '.');
if (progend)
*progend = '\0';
+ program++;
#else
program = strrchr(argv[0], '/');
+ if (program)
+ program++;
+ else
+ program = argv[0];
#endif
if (setvbuf(stdout, 0, _IOFBF, 4096)) {
fprintf(stderr, "%s: ran out of memory on setvbuf to stdout\n",
--
--russ (nelson@clutx [.bitnet | .clarkson.edu])|(70441.205@compuserve.com)
roskos@IDA.ORG (Eric Roskos) (08/02/89)
> it dumps core on a Sun
That's because the person who wrote it, alas, is suffering from a
DOS-induced coding disorder. He assumes that when you invoke it,
argv[0] contains slashes in it, since that's what DOS does (it puts the
full path name in there and you have to take it off yourself), and if it
doesn't, he doesn't detect the NULL coming back from strrchr properly.
Notice he remembered that Unix uses forward slashes instead of backwards
slashes, but forgot that it doesn't always stick in the full path name
for argv[0] the way DOS (or, more accurately, that C compiler) does.
The corrected code segment for the Sun should look like this (I compiled under
gcc to avoid having to remove the ANSI additions):
main(argc,argv)
int argc;
char *argv[];
{
int option; /* the option letter */
#ifdef __MSDOS__
char *progend;
program = max(strrchr(argv[0], '\\'),strrchr(argv[0], '/'));
progend = strchr(program, '.');
if (progend)
*progend = '\0';
#else
program = strrchr(argv[0], '/');
if (program == NULL)
program = argv[0];
else
#endif
program++;
--
Eric Roskos (roskos@CS.IDA.ORG or Roskos@DOCKMASTER.NCSC.MIL)
--
Eric Roskos (roskos@CS.IDA.ORG or Roskos@DOCKMASTER.NCSC.MIL)
allbery@nc386.UUCP (Brandon S. Allbery) (08/05/89)
In article <1989Aug2.132936.8919@IDA.ORG>, roskos@IDA (Eric Roskos) writes: +--------------- | Notice he remembered that Unix uses forward slashes instead of backwards | slashes, but forgot that it doesn't always stick in the full path name | for argv[0] the way DOS (or, more accurately, that C compiler) does. +--------------- MiSDOS is right. The full name of the program (complete with drive and path) is stashed after the end of the environment by MiSDOS 3.x/4.x; the compiler simply points argv[0] to it. Note that the command line passed to a program under DOS has the command name stripped, so under MiSDOS 2.x one has *no* way to determine the name of the program. And people wonder why I call it Mis-DOS! ++Brandon -- Brandon S. Allbery, moderator of comp.sources.misc allbery@NCoast.ORG uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery@hal.cwru.edu * This message brought to you courtesy the "Watcher" for the 4th NCoast * "ncoast #4 regenerates into ncoast #5 on 8/6/89!" -- the Watcher (aka nc386)
nelson@sun.soe.clarkson.edu (Russ Nelson) (11/22/89)
Forgot to say that letrhead.ps is a prolog for printing a letterhead. It may not be too useful for other people, as it's aligned in x and y with the standard Clarkson letterhead. Your mileage may vary... -- --russ (nelson@clutx [.bitnet | .clarkson.edu]) Live up to the light thou hast, and more will be granted thee. A recession now appears more than 2 years away -- John D. Mathon, 4 Oct 1989. I think killing is value-neutral in and of itself. -- Gary Strand, 8 Nov 1989. Liberals run this country, by and large. -- Clayton Cramer, 20 Nov 1989.