
UNSHAR                                                          28-OCT-1988 12:14:56    VAX C      V2.3-024                 Page 1
V1.0                                                            28-OCT-1988 12:14:11    DUA7:[VMSNET.DEVEL.UNSHAR.SRC]UNSHAR.C;4 (1)



    1        	/*
    2        	 *			   ---   UNSHAR.C   ---
    3        	 *
    4        	 *		  ---   Copywrite 24 September, 1986   ---
    5        	 *		      ---    John Birchfield      ---
    6        	 *		      ---    411 Crane Ave.       ---
    7        	 *		      ---    Turlock, CA  95380   ---
    8        	 *		      ---      (209) 634-6243     ---
    9        	 *
   10        	 *	Program to decode files created by the shell archive { shar }
   11        	 *	utility on Un*x machines or pc's.  Current capabilities include
   12        	 *
   13        	 *	1.	Able to unshar into a user specified directory or subdirectory
   14        	 *		as specified by a command line option { -Ddirectory_name }
   15        	 *
   16        	 *	2.	Recognizes the following commands
   17        	 *			cat, sed, uudecode, mkdir, chdir, 
   18        	 *			{test -f, test -d, test <number -ne wc ... }
   19        	 *
   20        	 *	3.	Can handle shar scripts created with the
   21        	 *			Options { -a -v -p -b -c -d }
   22        	 *
   23        	 *	4.	Successfully traverses directories and sub-directories
   24        	 *		creating the necessary subdirectories as necessary.
   25        	 *
   26        	 *	CAVEATS:
   27        	 *		Word Counting between Un*x machines and pc's just isn't
   28        	 *		gonna work out too well.  The \r\n - \n thing is not
   29        	 *		an easy thing to work around - and to be quite frank
   30        	 *		I just ain't up to it.
   31        	 *
   32        	 *	Program written for the Desmet (C-Ware) C Compiler Version 2.61
   33        	 *	not all of the routines in DOS_C.C and DOS_A.A are used by this
   34        	 *	program.  The program consists of the following modules:
   35        	 *		UNSHAR.C
   36        	 *		SHAR_CMD.C
   37        	 *		DOS_C.C
   38        	 *		DOS_A.A
   39        	 *
   40        	 *	This program is hereby placed in the public domain for 
   41        	 *	non-commercial use.
   42        	 */
   43        	
   44        	# include stdio
  185        	# include "unshar.h"
  245        	
  246        	char	test_flag = '\0',
  247        		root_dir [65] = "";
  248        	
  249        	int	ignore_exit = FALSE,
  250        		immed_start = FALSE;
  251        	
  252        	extern	int	first_period;
  253        	
  254        	FILE *input;

UNSHAR                                                          28-OCT-1988 12:14:56    VAX C      V2.3-024                 Page 2
V1.0                                                            28-OCT-1988 12:14:11    DUA7:[VMSNET.DEVEL.UNSHAR.SRC]UNSHAR.C;4 (1)

  255        	
  256        	#ifdef	VMS
  257        	extern	void	cmd_init(void);
  258        	extern	void	do_echo(void);
  259        	extern	void	mk_dirs(char *s);
  260        	#endif
  261        	
  262        	/*
  263        	 *	MAIN ()	-	get the options and input filename and
  264        	 *		if possible go to it.
  265        	 */
  266        	 
  267        	main (argc, argv)
  268        	int argc;
  269        	char **argv;
  270        	{
  271    1   	#ifdef	VMS
  272    1   	# include time
  353    1   	
  354    1   		char		xyzzy[1024] = "Plover";	/* Hack around debug bug */
  355    1   	
  356    1   		char		dts[30];
  357    1   		time_t		timex;
  358    1   		struct tm	*tmx;
  359    1   	
  360    1   		(void) time(&timex);
  361    1   		tmx = localtime(&timex);
  362    1   		strcpy(dts," ");
  363    1   		strcat(dts,asctime(tmx));
  364    1   	#else
  365   X    		char dts [22];
  366   X    	
  367   X    		dates (dts);
  368   X    		strcat (&dts [8], " at ");
  369   X    		times (&dts [12]);
  370    1   	#endif
  371    1   	
  372    1   		get_options (argc, argv);
  373    1   		p_error (0, "\t\t--------------------------------------\n",
  374    1   			"\t\t      UNSHAR  Version 24 Sep '86\n",
  375    1   			"\t\t    Extracting to '", (root_dir [0])?root_dir:"Current",
  376    1   			"' Directory\n",
  377    1   			"\t\t       On", dts, "\n",
  378    1   			"\t\t--------------------------------------\n", "");
  379    1   		do_cmds (input);
  380    1   	}
  381        	
  382        	
  383        	
  384        	/*
  385        	 *	DO_CMDS ()	-	process the input file as a token stream
  386        	 *		and when a command is recognized, perform it.  The 
  387        	 *		cmd_flag array is used to determine the current state
  388        	 *		of { if then else } constructs within a shar script.
  389        	 *		as you can see, it allow four levels of nesting of 'em.
  390        	 *		the i/o to the token mechanism is explained somewhere
  391        	 *		around get_tok ().

UNSHAR                                                          28-OCT-1988 12:14:56    VAX C      V2.3-024                 Page 3
V1.0                                                            28-OCT-1988 12:14:11    DUA7:[VMSNET.DEVEL.UNSHAR.SRC]UNSHAR.C;4 (1)

  392        	 */
  393        	 
  394        	int do_cmds (fp)
  395        	FILE *fp;
  396        	{
  397    1   		static int  cmd_level = 0;
  398    1   		static char cmd_flag [5] = {'\1', '\0', '\0', '\0', '\0' },	
  399    1   		            cmd_tok [132] = "";
  400    1   	
  401    1   	/*
  402    1   	 * Skip everything prior to the first comment line
  403    1   	 */
  404    1   		if (!immed_start)
  405    1   			while ((fgets(cmd_tok,sizeof(cmd_tok),fp) != 0) &&
  406    1   				(cmd_tok[0] != '#'));
  407    1   	
  408    1   		while (get_tok (cmd_tok, fp)) {
  409    2   			switch (token_type (cmd_tok)) {
  410    3   				case IF_CMD:
  411    3   					++cmd_level;
  412    3   					break;				
  413    3   				case TEST_CMD:
  414    3   					cmd_flag [cmd_level] = ((char) (do_test ())
  415    3   						&& (cmd_flag [cmd_level-1]));
  416    3   					break;
  417    3   				case CAT_CMD:
  418    3   					if (cmd_flag [cmd_level])
  419    3   						do_cat (fp);
  420    3   					else
  421    3   						do_skip (fp);
  422    3   					cmd_init ();
  423    3   					break;
  424    3   				case SED_CMD:
  425    3   					if (cmd_flag [cmd_level])
  426    3   						do_sed (fp);
  427    3   					else
  428    3   						do_skip (fp);
  429    3   					cmd_init ();
  430    3   					break;
  431    3   				case ECHO_CMD:
  432    3   					if (cmd_flag [cmd_level])
  433    3   						do_echo ();
  434    3   					else
  435    3   						cmd_init ();
  436    3   					break;
  437    3   				case EXIT_CMD:
  438    3   					if (ignore_exit)
  439    3   						break;
  440    3   					if (cmd_flag [cmd_level])
  441    3   						do_exit (fp);
  442    3   					else
  443    3   						cmd_init ();
  444    3   				case FI_CMD:
  445    3   					cmd_flag [cmd_level--] = ((char) FALSE);
  446    3   					break;
  447    3   				case ELSE_CMD:
  448    3   					cmd_flag [cmd_level] = (!(cmd_flag [cmd_level])

UNSHAR                                                          28-OCT-1988 12:14:56    VAX C      V2.3-024                 Page 4
V1.0                                                            28-OCT-1988 12:14:11    DUA7:[VMSNET.DEVEL.UNSHAR.SRC]UNSHAR.C;4 (1)

  449    3   							&& (cmd_flag [cmd_level-1]));
  450    3   					break;
  451    3   				case THEN_CMD:
  452    3   					break;
  453    3   				case CD_CMD:
  454    3   					if (cmd_flag [cmd_level])
  455    3   						do_cd (fp);
  456    3   					else
  457    3   						cmd_init ();
  458    3   					break;
  459    3   				case MKDIR_CMD:
  460    3   					if (cmd_flag [cmd_level])
  461    3   						do_mkdir (fp);
  462    3   					else
  463    3   						cmd_init ();
  464    3   					break;
  465    3   				case UUDCD_CMD:
  466    3   					if (cmd_flag [cmd_level])
  467    3   						do_uudecode (fp);
  468    3   					else
  469    3   						cmd_init ();
  470    3   					break;
  471    3   				default:
  472    3   					if (cmd_flag [cmd_level])
  473    3   						p_error (0,
  474    3   						   "   Skipping command '",
  475    3   						   cmd_tok, "' ...\n", "");
  476    3   					cmd_init ();
  477    3   					break;
  478    3   			}
  479    2   		}
  480    1   	}
  481        	
  482        	
  483        	
  484        	
  485        	/*
  486        	 *	Data and Defines for token passing routines
  487        	 */
  488        	 
  489        	# define is_white(c)	((c==' ') || (c=='\t') || (c=='\n') ||\
  490        				 (c=='\r') || (c=='\0'))
  491        	# define not_back(c)	((c!='\0') && (c!='\`') && (c!='\n') && (c!='\r'))
  492        	# define not_single(c)	((c!='\0') && (c!='\'') && (c!='\n') && (c!='\r'))
  493        	# define not_double(c)	((c!='\0') && (c!='\"') && (c!='\n') && (c!='\r'))
  494        	char tok_buf [255] = "",
  495        	#ifdef	VMS
  496        	     *tbp=tok_buf;
  497        	#else
  498   X    	     *tbp=&tok_buf[0];
  499        	#endif
  500        	
  501        	
  502        	
  503        	
  504        	
  505        	/*

UNSHAR                                                          28-OCT-1988 12:14:56    VAX C      V2.3-024                 Page 5
V1.0                                                            28-OCT-1988 12:14:11    DUA7:[VMSNET.DEVEL.UNSHAR.SRC]UNSHAR.C;4 (1)

  506        	 *	GET_BUF ()	-	get_buf () is driven by get_tok ().
  507        	 *		Basically, get_buf () is called when tok_buf has been
  508        	 *		exhausted.
  509        	 */
  510        	 
  511        	int get_buf (fp)
  512        	FILE *fp;
  513        	{
  514    1   		int rval;
  515    1   		char *tp;
  516    1   		
  517    1   		tbp = &tok_buf [0];
  518    1   		do {
  519    2   			tp = &tok_buf [0];
  520    2   			if ((rval = fgets (tok_buf, 255, fp))==0)
  521    2   				return 0;
  522    2   			while (*tp) {
  523    3   				if (*tp=='#') {
  524    4   					*tp = '\0';
  525    4   					break;
  526    4   				}
  527    3   				else
  528    3   					tp++;
  529    3   			}
  530    2   		} while (tok_buf [0]==0);
  531    1   		return rval;
  532    1   	}
  533        	
  534        	
  535        	
  536        	
  537        	/*
  538        	 *	GET_TOK ()	-	get_tok () retrieves the next token
  539        	 *		available in the i/o stream being processed. The array
  540        	 *		tok_buf is the token passing buffer used. Tokens are
  541        	 *		of the form
  542        	 *			[a-z0-9special]
  543        	 *			'[a-z0-9special]' - '\'' are stripped
  544        	 *			"[a-z0-9special]" - '\"' are stripped
  545        	 *		get_tok () returns 0 on EOF
  546        	 */
  547        	 
  548        	int get_tok (tok, fp)
  549        	char *tok;
  550        	FILE *fp;
  551        	{
  552    1   		int rval = 1;
  553    1   		char *tp;
  554    1   	
  555    1   		tp = tok;
  556    1   		*tp = '\0';
  557    1   		while (*tok=='\0') {
  558    2   			if (*tbp=='\0')
  559    2   				if ((rval = get_buf (fp))==0)
  560    2   					return rval;
  561    2   			while (is_white(*tbp))
  562    2   				if (*tbp=='\0')

UNSHAR                                                          28-OCT-1988 12:14:56    VAX C      V2.3-024                 Page 6
V1.0                                                            28-OCT-1988 12:14:11    DUA7:[VMSNET.DEVEL.UNSHAR.SRC]UNSHAR.C;4 (1)

  563    2   					break;
  564    2   				else
  565    2   					tbp++;
  566    2   			if (*tbp=='\'') {
  567    3   				tbp++;
  568    3   				while (not_single(*tbp))
  569    3   	#ifdef	VMS
  570    3   					*tp++ = *tbp++;
  571    3   	#else
  572   X    					*tp++=*tbp++;
  573    3   	#endif
  574    3   				*tbp++='\0';
  575    3   			}
  576    2   			else if (*tbp=='\"') {
  577    3   				tbp++;
  578    3   				while (not_double(*tbp))
  579    3   	#ifdef	VMS
  580    3   					*tp++ = *tbp++;
  581    3   	#else
  582   X    					*tp++=*tbp++;
  583    3   	#endif
  584    3   				*tbp++='\0';
  585    3   			}
  586    2   			else if (*tbp=='\`') {
  587    3   				tbp++;
  588    3   				while (not_back(*tbp))
  589    3   	#ifdef	VMS
  590    3   					*tp++ = *tbp++;
  591    3   	#else
  592   X    					*tp++=*tbp++;
  593    3   	#endif
  594    3   				*tbp++='\0';
  595    3   			}
  596    2   			else if ((*tbp=='<') || (*tbp=='>')) {
  597    3   				do	{
  598    4   	#ifdef	VMS
  599    4   					*tp++ = *tbp++;
  600    4   	#else
  601   X    					*tp++=*tbp++;
  602    4   	#endif
  603    4   					} while ((*tbp == '<') || (*tbp == '>'));
  604    3   				/*
  605    3   				 * Do not terminate. Anyone who looks for these tokens
  606    3   				 * uses strncmp() anyway, so lack of termination gets
  607    3   				 * us out of a push back problem.
  608    3   				 */
  609    3   			}
  610    2   			else
  611    2   				while (!(is_white(*tbp))) {
  612    3   					if (*tbp != '\\')
  613    3   						{
  614    4   	#ifdef	VMS
  615    4   						*tp++ = *tbp;
  616    4   	#else
  617   X    						*tp++=*tbp;
  618    4   	#endif
  619    4   						}

UNSHAR                                                          28-OCT-1988 12:14:56    VAX C      V2.3-024                 Page 7
V1.0                                                            28-OCT-1988 12:14:11    DUA7:[VMSNET.DEVEL.UNSHAR.SRC]UNSHAR.C;4 (1)

  620    3   					tbp++;
  621    3   				}
  622    2   			*tp='\0';
  623    2   		}
  624    1   		return rval;
  625    1   	}
  626        	
  627        	
  628        	
  629        	/*
  630        	 *	TK_LIST	-	A list of the available commands to UNSHAR.
  631        	 *		their relative displacement in the list relates
  632        	 *		to a corresponding set of Defines in UNSHAR.H
  633        	 */
  634        	 
  635        	char *tk_list [] = {
  636        		"if", "echo", "test", "cat", "sed" , "exit", "else", "fi", "then",
  637        		"cd", "mkdir", "uudecode"
  638        	};
  639        	
  640        	
  641        	
  642        	
  643        	
  644        	/*
  645        	 *	TOKEN_TYPE ()	-	returns the relative index into the
  646        	 *		tk_list array for processing by do_cmds ().
  647        	 */
  648        	 
  649        	int token_type (tok)
  650        	char *tok;
  651        	{
  652    1   		int i;
  653    1   		for (i=0; i<TK_MAX; i++)
  654    1   			if (strcmp (tok, tk_list [i])==0)
  655    1   				break;
  656    1   		return i;
  657    1   	}
  658        	
  659        	
  660        	
  661        	/*
  662        	 *	CMD_INIT ()	-	cmd_init () is used to flush the
  663        	 *		buffer tok_buf.  This is necessary when a command is
  664        	 *		not processed for some reason, or upon the successful
  665        	 *		completion of a shar command.  This is necessary
  666        	 *		because the same input file is being processed thru
  667        	 *		multiple buffers.  After a cmd_init () call the next
  668        	 *		call to get_tok () will cause the immediate refilling
  669        	 *		of tok_buf by get_buf ().
  670        	 */
  671        	 
  672        	void cmd_init ()
  673        	{
  674    1   		tok_buf [0]= '\0';
  675    1   		tbp = &tok_buf [0];
  676    1   	}

UNSHAR                                                          28-OCT-1988 12:14:56    VAX C      V2.3-024                 Page 8
V1.0                                                            28-OCT-1988 12:14:11    DUA7:[VMSNET.DEVEL.UNSHAR.SRC]UNSHAR.C;4 (1)

  677        	
  678        	
  679        	
  680        	/*
  681        	 *	DO_ECHO ()	-	do_echo () is the only shar command
  682        	 *		contained in this module.  It would be nicer to have
  683        	 *		it with the other routines but it's so much easier here
  684        	 *		since it directly reads from the tok_buf...
  685        	 */
  686        	 
  687        	void do_echo ()
  688        	{
  689    1   		fputs (tbp, stdout);
  690    1   		cmd_init ();
  691    1   	}
  692        	
  693        	
  694        	
  695        	/*
  696        	 *	USAGE ()	-	Tell 'em what it's all about and
  697        	 *		go home to mamma.
  698        	 */
  699        	 
  700        	usage ()
  701        	{
  702    1   	  fputs ("Usage: UNSHAR [-T -D<directory name>] <shar file name>\n",
  703    1   	  	stdout);
  704    1   	  fputs ("\tWhere <directory name> specifies the root directory\n",
  705    1   	  	stdout);
  706    1   	  fputs ("\t   for UNSHAR to place extracted files\n\n", 
  707    1   		stdout);
  708    1   	  fputs ("\tand -T says to return TRUE from unknown 'test' commands\n\n",
  709    1   	  	stdout);
  710    1   	  fputs ("\t   Either Upper or lower case will work for the option flags\n\n",
  711    1   	  	stdout);
  712    1   	  exit (2);
  713    1   	}
  714        	
  715        	
  716        	
  717        	/*
  718        	 *	GET_OPTIONS ()	-	get_options () checks for proper options
  719        	 *		and if they're valid sets things up for do_cmds.
  720        	 *		the options available are...
  721        	 *
  722        	 *	-t			tell unshar to return true on an unknown
  723        	 *				test command
  724        	 *	-D<directoryname>	tell unshar to build the extracted files
  725        	 *				in the directory specified { if it doesn't
  726        	 *				exist make it } BeWare ... It will make
  727        	 *				ALL the sub-directories you specify along the
  728        	 *				way.
  729        	 *     (the following added by JEH)
  730        	 *	-c			continuous run -- ignore exit commands in input
  731        	 *	-i			start Immediately, do not skip until # found
  732        	 *      -f			the VMS version normally turns all but the
  733        	 *				the last period found in a filename into a 

UNSHAR                                                          28-OCT-1988 12:14:56    VAX C      V2.3-024                 Page 9
V1.0                                                            28-OCT-1988 12:14:11    DUA7:[VMSNET.DEVEL.UNSHAR.SRC]UNSHAR.C;4 (1)

  734        	 *				hyphen.  This option (-f) causes this action
  735        	 *				for all but the first period in the filename.
  736        	 */
  737        	
  738        	get_options (argc, argv)
  739        	int argc;
  740        	char **argv;
  741        	{
  742    1   		char got_dir = FALSE,
  743    1   		     got_name = FALSE,
  744    1   		     file_name [65],
  745    1   		     *cp;
  746    1   		
  747    1   		first_period = FALSE;
  748    1   	
  749    1   		if (argc < 2) {
  750    2   			usage ();
  751    2   		}
  752    1   		file_name [0] = '\0';
  753    1   		while (--argc) {
  754    2   			if ((*(cp=(*++argv)))=='-')
  755    2   				switch (toupper (*++cp)) {
  756    3   					case 'D':
  757    3   						if (got_dir)
  758    3   							usage ();
  759    3   						if (*++cp)
  760    3   							strcpy (root_dir, cp);
  761    3   						got_dir = TRUE;
  762    3   						break;
  763    3   					case 'F':
  764    3   						first_period = TRUE;
  765    3   						break;
  766    3   					case 'I':
  767    3   						immed_start = TRUE;
  768    3   						break;
  769    3   					case 'C':
  770    3   						ignore_exit = TRUE;
  771    3   						break;
  772    3   					case 'T':
  773    3   						test_flag = TRUE;
  774    3   						break;
  775    3   					default:
  776    3   						p_error (0, "Invalid Option ",
  777    3   							 cp, "\n", "");
  778    3   						usage ();
  779    3   						break;
  780    3   				}
  781    2   			else {
  782    3   				strcpy (file_name, *argv);
  783    3   				break;
  784    3   			}
  785    2   		}
  786    1   	#ifdef	VMS
  787    1   		if ((input = fopen (file_name, "r"))==NULL) {
  788    2   	#else
  789   X    		if ((input = open (file_name, 0))==-1) {
  790    2   	#endif

UNSHAR                                                          28-OCT-1988 12:14:56    VAX C      V2.3-024                 Page 10
V1.0                                                            28-OCT-1988 12:14:11    DUA7:[VMSNET.DEVEL.UNSHAR.SRC]UNSHAR.C;4 (1)

  791    2   			p_error (0, "UNSHAR: Error ... Can't Open '",
  792    2   				(file_name [0])?file_name:" ","'\n", "");
  793    2   			usage ();
  794    2   		}
  795    1   		if (root_dir [0] != '\0')
  796    1   			mk_dirs (root_dir);
  797    1   	}
  798        	
  799        	
  800        	
  801        	
  802        	/*
  803        	 *	MK_DIRS ()	-	mk_dirs () is passed a path of directories.
  804        	 *		It will traverse this list and make all the directories
  805        	 *		along the way to the end.  Like I said above, BeWare...
  806        	 */
  807        	 
  808        	void mk_dirs (s)
  809        	char *s;
  810        	{
  811    1   		char *p1, buf [65];
  812    1   		p1 = & buf [0];
  813    1   	
  814    1   		if ((*s=='\\' || *s=='/') && (*(s+1)=='\0'))
  815    1   			return;
  816    1   	
  817    1   		*p1++ = *s++;
  818    1   		do {
  819    2   			while (*s!='/' && *s!='\\' && *s!='\0')
  820    2   	#ifdef	VMS
  821    2   				*p1++ = *s++;
  822    2   	#else
  823   X    				*p1++=*s++;
  824    2   	#endif
  825    2   			*p1='\0';
  826    2   			mkdir (buf);
  827    2   			*p1++ = '/';
  828    2   			if (*s=='\\' || *s=='/')
  829    2   				s++;
  830    2   		} while (*s);
  831    1   		*p1='\0';
  832    1   		if (*(s-1) != '\\' && *(s-1) != '//') {
  833    2   			*s++='/';
  834    2   			*s++='\0';
  835    2   		}
  836    1   	}


UNSHAR                                                          28-OCT-1988 12:14:56    VAX C      V2.3-024                 Page 11
V1.0                                                            28-OCT-1988 12:14:11    DUA7:[VMSNET.DEVEL.UNSHAR.SRC]UNSHAR.C;4 (1)

                                       +-------------+
                                       | Storage Map |
                                       +-------------+
 
 

External Declarations
---------------------

 Identifier Name                 Line    Size            Class        Type
 ---------------                 ----    ----            -----        ----

<generated_name_0001>            123     8 bytes                      Structure tag
 /* No Name */                   123     32 bits                       Member (offset = 0), unsigned field
 /* No Name */                   123     32 bits                       Member (offset = 4 bytes), unsigned field
<generated_name_0002>            125     8 bytes                      Structure tag
 /* No Name */                   125     32 bits                       Member (offset = 0), unsigned field
 /* No Name */                   125     32 bits                       Member (offset = 4 bytes), unsigned field
c$v_ctypedefs                    199     1 longword      Globalvalue  Long int
cmd_init                         257                     Extern       Void function
cmd_init                         672                     Extern def.  Void function
do_cmds                          394                     Extern def.  Function returning long int
do_echo                          258                     Extern       Void function
do_echo                          687                     Extern def.  Void function
errno                            59      1 longword      Extern       Noshare volatile long int
fclose                           135                     Extern       Function returning long int
fdopen                           131                     Extern       Function returning pointer to pointer to struct _iobuf
fflush                           165                     Extern       Function returning long int
fgetc                            137                     Extern       Function returning long int
fgetname                         127                     Extern       Function returning pointer to char
fgetpos                          125                     Extern       Function returning long int
fgets                            140                     Extern       Function returning pointer to char
FILE                             88      1 longword                   Typedef:  pointer to struct _iobuf
first_period                     252     1 longword      Extern       Long int
fopen                            129                     Extern       Function returning pointer to pointer to struct _iobuf
fprintf                          158                     Extern       Function returning long int
fputc                            162                     Extern       Function returning long int
fputs                            143                     Extern       Function returning long int
fread                            146                     Extern       Function returning long int
freopen                          133                     Extern       Function returning pointer to pointer to struct _iobuf
fscanf                           152                     Extern       Function returning long int
fseek                            167                     Extern       Function returning long int
fsetpos                          123                     Extern       Function returning long int
ftell                            169                     Extern       Function returning long int
fwrite                           149                     Extern       Function returning long int
gets                             141                     Extern       Function returning pointer to char
getw                             138                     Extern       Function returning long int
get_buf                          511                     Extern def.  Function returning long int
get_options                      738                     Extern def.  Function returning long int
get_tok                          548                     Extern def.  Function returning long int
ignore_exit                      249     1 longword      Extern def.  Initialized long int
immed_start                      250     1 longword      Extern def.  Initialized long int
input                            254     1 longword      Extern def.  Pointer to pointer to struct _iobuf
main                             267                     Extern def.  Function returning long int
mk_dirs                          259                     Extern       Void function
mk_dirs                          808                     Extern def.  Void function
printf                           159                     Extern       Function returning long int

UNSHAR                                                          28-OCT-1988 12:14:56    VAX C      V2.3-024                 Page 12
V1.0                                                            28-OCT-1988 12:14:11    DUA7:[VMSNET.DEVEL.UNSHAR.SRC]UNSHAR.C;4 (1)

 Identifier Name                 Line    Size            Class        Type
 ---------------                 ----    ----            -----        ----

puts                             144                     Extern       Function returning long int
putw                             163                     Extern       Function returning long int
rewind                           171                     Extern       Function returning long int
root_dir                         244     byte            Extern       Array of char
root_dir                         247     65 bytes        Extern def.  Initialized array [65] of char
scanf                            153                     Extern       Function returning long int
setbuf                           177                     Extern       Void function
setvbuf                          178                     Extern       Function returning long int
sprintf                          160                     Extern       Function returning long int
sscanf                           154                     Extern       Function returning long int
stderr                           89      1 longword      Extern       Noshare pointer to pointer to struct _iobuf
stdin                            89      1 longword      Extern       Noshare pointer to pointer to struct _iobuf
stdout                           89      1 longword      Extern       Noshare pointer to pointer to struct _iobuf
tbp                              496     1 longword      Extern def.  Initialized pointer to char
test_flag                        243     1 byte          Extern       Char
test_flag                        246     1 byte          Extern def.  Initialized char
tk_list                          635     12 longwords    Extern def.  Initialized array [12] of pointer to char
tmpfile                          173                     Extern       Function returning pointer to pointer to struct _iobuf
tmpnam                           175                     Extern       Function returning pointer to char
token_type                       649                     Extern def.  Function returning long int
tok_buf                          494     255 bytes       Extern def.  Initialized array [255] of char
ungetc                           156                     Extern       Function returning long int
usage                            700                     Extern def.  Function returning long int
vfprintf                         180                     Extern       Function returning long int
vprintf                          181                     Extern       Function returning long int
vsprintf                         182                     Extern       Function returning long int
_ctype_                          201     byte            Extern       Const array of char
_iobuf                           68      14 bytes                     Structure tag
 _cnt                            70      1 longword                    Member (offset = 0), long int
 _ptr                            71      1 longword                    Member (offset = 4 bytes), pointer to char
 _base                           72      1 longword                    Member (offset = 8 bytes), pointer to char
 _flag                           73      1 byte                        Member (offset = 12 bytes), char
 _file                           84      1 byte                        Member (offset = 13 bytes), char
 
 

Function "main" defined at line 267
-----------------------------------

 Identifier Name                 Line    Size            Class        Type
 ---------------                 ----    ----            -----        ----

argc                             268     1 longword                   Parameter # 1, long int
argv                             269     1 longword                   Parameter # 2, pointer to pointer to char
asctime                          340                     Extern       Function returning pointer to char
clock                            332                     Extern       Function returning long int
clock_t                          278     1 longword                   Typedef:  long int
ctime                            342                     Extern       Function returning pointer to char
difftime                         334                     Extern       Function returning double
do_cmds                          379                     Extern       Function returning long int
dts                              356     30 bytes        Auto         Array [30] of char
ftime                            350                     Extern       Void function
get_options                      372                     Extern       Function returning long int
gmtime                           344                     Extern       Function returning pointer to struct tm

UNSHAR                                                          28-OCT-1988 12:14:56    VAX C      V2.3-024                 Page 13
V1.0                                                            28-OCT-1988 12:14:11    DUA7:[VMSNET.DEVEL.UNSHAR.SRC]UNSHAR.C;4 (1)

 Identifier Name                 Line    Size            Class        Type
 ---------------                 ----    ----            -----        ----

localtime                        346                     Extern       Function returning pointer to struct tm
mktime                           348                     Extern       Function returning long int
p_error                          373                     Extern       Function returning long int
strcat                           363                     Extern       Function returning long int
strcpy                           362                     Extern       Function returning long int
tbuffer                          289     16 bytes                     Structure tag
 proc_user_time                  291     1 longword                    Member (offset = 0), long int
 proc_system_time                291     1 longword                    Member (offset = 4 bytes), long int
 child_user_time                 292     1 longword                    Member (offset = 8 bytes), long int
 child_system_time               292     1 longword                    Member (offset = 12 bytes), long int
tbuffer_t                        295     16 bytes                     Typedef:  struct tbuffer
time                             336                     Extern       Function returning long int
timeb                            311     10 bytes                     Structure tag
 time                            313     1 longword                    Member (offset = 0), long int
 millitm                         314     1 word                        Member (offset = 4 bytes), unsigned short int
 timezone                        315     1 word                        Member (offset = 6 bytes), short int
 dstflag                         316     1 word                        Member (offset = 8 bytes), short int
timeb_t                          319     10 bytes                     Typedef:  struct timeb
times                            338                     Extern       Void function
timex                            357     1 longword      Auto         Long int
time_t                           284     1 longword                   Typedef:  long int
tm                               323     36 bytes                     Structure tag
 tm_sec                          325     1 longword                    Member (offset = 0), long int
 tm_min                          325     1 longword                    Member (offset = 4 bytes), long int
 tm_hour                         325     1 longword                    Member (offset = 8 bytes), long int
 tm_mday                         326     1 longword                    Member (offset = 12 bytes), long int
 tm_mon                          326     1 longword                    Member (offset = 16 bytes), long int
 tm_year                         326     1 longword                    Member (offset = 20 bytes), long int
 tm_wday                         327     1 longword                    Member (offset = 24 bytes), long int
 tm_yday                         327     1 longword                    Member (offset = 28 bytes), long int
 tm_isdst                        327     1 longword                    Member (offset = 32 bytes), long int
tmx                              358     1 longword      Not Alloc.   Pointer to struct tm
tm_t                             330     36 bytes                     Typedef:  struct tm
xyzzy                            354     1024 bytes      Auto         Initialized array [1024] of char
 
 

Function "do_cmds" defined at line 394
--------------------------------------

 Identifier Name                 Line    Size            Class        Type
 ---------------                 ----    ----            -----        ----

cmd_flag                         398     5 bytes         Static       Initialized array [5] of char
cmd_level                        397     1 longword      Static       Initialized long int
cmd_tok                          399     132 bytes       Static       Initialized array [132] of char
do_cat                           419                     Extern       Function returning long int
do_cd                            455                     Extern       Function returning long int
do_exit                          441                     Extern       Function returning long int
do_mkdir                         461                     Extern       Function returning long int
do_sed                           426                     Extern       Function returning long int
do_skip                          421                     Extern       Function returning long int
do_test                          414                     Extern       Function returning long int
do_uudecode                      467                     Extern       Function returning long int

UNSHAR                                                          28-OCT-1988 12:14:56    VAX C      V2.3-024                 Page 14
V1.0                                                            28-OCT-1988 12:14:11    DUA7:[VMSNET.DEVEL.UNSHAR.SRC]UNSHAR.C;4 (1)

 Identifier Name                 Line    Size            Class        Type
 ---------------                 ----    ----            -----        ----

fp                               395     1 longword                   Parameter # 1, pointer to pointer to struct _iobuf
get_tok                          408                     Extern       Function returning long int
p_error                          473                     Extern       Function returning long int
token_type                       409                     Extern       Function returning long int
 
 

Function "get_buf" defined at line 511
--------------------------------------

 Identifier Name                 Line    Size            Class        Type
 ---------------                 ----    ----            -----        ----

fp                               512     1 longword                   Parameter # 1, pointer to pointer to struct _iobuf
rval                             514     1 longword      Register     Long int
tp                               515     1 longword      Register     Pointer to char
 
 

Function "get_tok" defined at line 548
--------------------------------------

 Identifier Name                 Line    Size            Class        Type
 ---------------                 ----    ----            -----        ----

fp                               550     1 longword                   Parameter # 2, pointer to pointer to struct _iobuf
rval                             552     1 longword      Register     Initialized long int
tok                              549     1 longword                   Parameter # 1, pointer to char
tp                               553     1 longword      Register     Pointer to char
 
 

Function "token_type" defined at line 649
-----------------------------------------

 Identifier Name                 Line    Size            Class        Type
 ---------------                 ----    ----            -----        ----

i                                652     1 longword      Register     Long int
strcmp                           654                     Extern       Function returning long int
tok                              650     1 longword                   Parameter # 1, pointer to char
 
 

Function "cmd_init" defined at line 672
---------------------------------------

 Identifier Name                 Line    Size            Class        Type
 ---------------                 ----    ----            -----        ----

No names declared
 
 

UNSHAR                                                          28-OCT-1988 12:14:56    VAX C      V2.3-024                 Page 15
V1.0                                                            28-OCT-1988 12:14:11    DUA7:[VMSNET.DEVEL.UNSHAR.SRC]UNSHAR.C;4 (1)


Function "do_echo" defined at line 687
--------------------------------------

 Identifier Name                 Line    Size            Class        Type
 ---------------                 ----    ----            -----        ----

No names declared
 
 

Function "usage" defined at line 700
------------------------------------

 Identifier Name                 Line    Size            Class        Type
 ---------------                 ----    ----            -----        ----

exit                             712                     Extern       Function returning long int
 
 

Function "get_options" defined at line 738
------------------------------------------

 Identifier Name                 Line    Size            Class        Type
 ---------------                 ----    ----            -----        ----

argc                             739     1 longword                   Parameter # 1, long int
argv                             740     1 longword                   Parameter # 2, pointer to pointer to char
cp                               745     1 longword      Register     Pointer to char
file_name                        744     65 bytes        Auto         Array [65] of char
got_dir                          742     1 byte          Register     Initialized char
got_name                         743     1 byte          Not Alloc.   Initialized char
p_error                          776                     Extern       Function returning long int
strcpy                           760                     Extern       Function returning long int
toupper                          755                     Extern       Function returning long int
 
 

Function "mk_dirs" defined at line 808
--------------------------------------

 Identifier Name                 Line    Size            Class        Type
 ---------------                 ----    ----            -----        ----

buf                              811     65 bytes        Auto         Array [65] of char
mkdir                            826                     Extern       Function returning long int
p1                               811     1 longword      Register     Pointer to char
s                                809     1 longword                   Parameter # 1, pointer to char
 
 

UNSHAR                                                          28-OCT-1988 12:14:56    VAX C      V2.3-024                 Page 16
V1.0                                                            28-OCT-1988 12:14:11    DUA7:[VMSNET.DEVEL.UNSHAR.SRC]UNSHAR.C;4 (1)


Psect Synopsis
--------------

 Psect Name                     Allocation  Attributes
 ----------                     ----------  ----------

$CODE                           2044 bytes  Position-independent, relocatable, shareable, executable, readable
$DATA                           141 bytes   Position-independent, relocatable, readable, writeable
ERRNO                           4 bytes     Position-independent, overlay, relocatable, global, readable, writeable
STDIN                           4 bytes     Position-independent, overlay, relocatable, global, readable, writeable
STDOUT                          4 bytes     Position-independent, overlay, relocatable, global, readable, writeable
STDERR                          4 bytes     Position-independent, overlay, relocatable, global, readable, writeable
_CTYPE_                         0           Position-independent, overlay, relocatable, global, shareable, readable
TEST_FLAG                       1 byte      Position-independent, overlay, relocatable, global, shareable, readable, writeable
ROOT_DIR                        65 bytes    Position-independent, overlay, relocatable, global, shareable, readable, writeable
IGNORE_EXIT                     4 bytes     Position-independent, overlay, relocatable, global, shareable, readable, writeable
IMMED_START                     4 bytes     Position-independent, overlay, relocatable, global, shareable, readable, writeable
FIRST_PERIOD                    4 bytes     Position-independent, overlay, relocatable, global, shareable, readable, writeable
INPUT                           4 bytes     Position-independent, overlay, relocatable, global, shareable, readable, writeable
$CHAR_STRING_CONSTANTS          607 bytes   Position-independent, relocatable, readable, writeable
TOK_BUF                         255 bytes   Position-independent, overlay, relocatable, global, shareable, readable, writeable
TBP                             4 bytes     Position-independent, overlay, relocatable, global, shareable, readable, writeable
TK_LIST                         48 bytes    Position-independent, overlay, relocatable, global, shareable, readable, writeable
 
 

Function Definition Map
-----------------------

 Line   Name
 ----   ----

267     main
394     do_cmds
511     get_buf
548     get_tok
649     token_type
672     cmd_init
687     do_echo
700     usage
738     get_options
808     mk_dirs
 
 
Command Line
------------
 
CC/LIST=[-.BLD]/OBJE=[-.BLD]/SHOW=(SOURCE,SYMBOLS)/DEFINE=LOG UNSHAR

