Exemple #1
0
goods_t generate_goods()
{
  goods_t a;

  
  printf("\n\n\n\tWhat is the name of the item? _");
  char *name = readstring();
  strcpy(a.name, name);
  free(name);

  printf("\tGive the description of the item. _");
  char *desc = readstring();
  strcpy(a.description, desc);
  free(desc);
  
  printf("\tWhat does the item cost? _");
  a.price = read_int();
  
  printf("\tChoose shelf for the item _");
  char *shelf = readstring();
  strcpy(a.shelf, shelf);
  free(shelf); 

  printf("\tHow many are there of the item? _");
  a.quantity = read_int();

  return a;      
}
Exemple #2
0
main()
{
	char str1[64], str2[64], str3[64], str4[64], str5[64], str6[64];
	char ch;

	/*
	 *string comparison
         *printf("\nString Compare:\nstr1: "); readString(str1);
	 *printf("str2: "); readString(str2);
	 *printf("Are equal? %d\n\n", compareStrings(str1, str2));
	 *
	 *[>//substring check<]
	 *printf("Substring Check:\nstr1: "); readString(str1);
	 *printf("str2: "); readString(str2);
	 *printf("Is Substring? %d\n\n", searchSubString(str1, str2));
	 *
	 *printf("Search for char:\nstr1: "); readString(str1);
	 *printf("char: "); ch = getchar();
	 *printf("Found char? %d", searchForChar(str1, ch)); 
	 */

	//bottom section needs to be run in a seprate excecutable!!	
	printf("\n\ncount words: "); readstring(str3);
	printf("word count: %d", countwords(str3));

	printf("\n\nfind longest word: "); readstring(str4);
	printf("longest word: %d", longestword(str4));

	printf("\n\nfind most vowels: "); readstring(str5);
	printf("most vowels: %d", mostvowels(str5));
	return 0;
}
Exemple #3
0
int msgneed (void)
{
	int x;
	if (server) {
		char *name;
		int update;
		TREE *t;
		x = readmsg (MSGNEED);
		if (x == SCMOK)  x = readstring (&name);
		while (x == SCMOK) {
			if (name == NULL)  break;
			x = readint (&update);
			if (x != SCMOK)  break;
			t = Tinsert (&needT,name,TRUE);
			free (name);
			if (update)  t->Tflags |= FUPDATE;
			x = readstring (&name);
		}
		if (x == SCMOK)  x = readmend ();
	} else {
		x = writemsg (MSGNEED);
		if (x == SCMOK)  x = Tprocess (needT,needone);
		if (x == SCMOK)  x = writestring ((char *)NULL);
		if (x == SCMOK)  x = writemend ();
	}
	return (x);
}
Exemple #4
0
int msglist (void)
{
	int x;
	if (server) {
		x = writemsg (MSGLIST);
		if (x == SCMOK)  x = Tprocess (listT,listone);
		if (x == SCMOK)  x = writestring ((char *)NULL);
		if (x == SCMOK)  x = writeint ((int)scantime);
		if (x == SCMOK)  x = writemend ();
	} else {
		char *name;
		int mode,flags,mtime;
		TREE *t;
		x = readmsg (MSGLIST);
		if (x == SCMOK)  x = readstring (&name);
		while (x == SCMOK) {
			if (name == NULL)  break;
			x = readint (&mode);
			if (x == SCMOK)  x = readint (&flags);
			if (x == SCMOK)  x = readint (&mtime);
			if (x != SCMOK)  break;
			t = Tinsert (&listT,name,TRUE);
			free (name);
			t->Tmode = mode;
			t->Tflags = flags;
			t->Tmtime = mtime;
			x = readstring (&name);
		}
		if (x == SCMOK)  x = readint ((int *)&scantime);
		if (x == SCMOK)  x = readmend ();
	}
	return (x);
}
Exemple #5
0
/**
 * Executes a command and returns a result string and an info/error string.
 *
 * A database command is sent to BaseX server connected on sfd.
 * The result is a \0 terminated, dynamically allocated string, which is placed
 * at the given result address or NULL.  The same holds for the processing
 * information stored at info.
 *
 * In either case it is the responsibility of the caller to free(3) those
 * strings.
 *
 * The returned int is 0 if the command could be processed successfully, in that
 * case the result contains the result string of the command and info holds
 * the processing information.
 * If a value >0 is returned, the command could not be processed successfully,
 * result contains NULL and info contains the database error message.
 * If -1 is interned, an error occurred, result and info are set to NULL.
 *
 *  int | result* | info* |
 * -----+---------+-------|
 *  -1  |  NULL   | NULL  |
 *   0  | result  | info  |
 *  >0  |  NULL   | error |
 *
 *  * strings shall be free(3)'ed by caller
 *
 * BaseX C/S protocol:
 *
 * client sends: {command} \0
 * server sends: {result}  \0 {info}  \0 \0
 *            or           \0 {error} \0 \1
 *
 * @param sfd socket file descriptor connected to BaseX server
 * @param command to be processed by BaseX server
 * @param result address at which result from BaseX server is placed
 * @param info address at which info/error message from BaseX server is placed
 * @return int 0 for success (result and info contain strings sent from BaseX)
 * -1 in case of failure (result and info are set to NULL), >0 an error occurred
 * while processing the command (result contains NULL, info contains error
 * message)
 */
int
basex_execute(int sfd, const char *command, char **result, char **info)
{
	int rc;

	/* Send {command}\0 to server. */
	rc = send_db(sfd, command, strlen(command) + 1);
	if (rc == -1) {
		warnx("Can not send command '%s' to server.", command);	
		goto err;
	}

	/* --- Receive from server:  {result} \0 {info}  \0 \0
	 *                                    \0 {error} \0 \1 */
	/* Receive {result} \0 */
	rc = readstring(sfd, result);
	if (rc == -1) {
		warnx("Can not retrieve result for command '%s' from server.", command);
		goto err;
	}
#if DEBUG
	warnx("[execute] result: '%s'\n", *result);
#endif

	/* Receive {info/error} \0 .*/
	rc = readstring(sfd, info);
	if (rc == -1) {
		warnx("Can not retrieve info for command '%s' from server.", *info);
		goto err;
	}
#if DEBUG
	warnx("[execute] info/error: '%s'\n", *info);
#endif

	/* Receive terminating \0 for success or \1 for error .*/
	rc = basex_status(sfd);
#if DEBUG
	warnx("[execute] status: '%d'\n", rc);
#endif
	if (rc == -1) {
		warnx("Can not retrieve status.");
		goto err;
	}
	if (rc == 1) {
		warnx("BaseX error message : %s", *info);
		free(*result);
		*result = NULL;
	}

	assert(rc == 0 || rc == 1);
	return rc;

err:
	*result = NULL;
	*info = NULL;
	return -1;
}
Exemple #6
0
/*copy a file*/
void docopy()
{
	char sname[7];
	char dname[7];
	char line[80];
	char file[12800];
	char dirsector[512];
	int index,i;

	/*prompt for the first file name*/
	printstring("Name of the source file? \0");
	readstring(line);
	for (i=0; i<6; i++)
	{
		sname[i]=line[i];
		if (line[i]==0xd)
			break;
	}
	sname[i]=0x0;

	/*make sure it exists - find the directory entry*/
	readsector(2,dirsector);
	index=findname(sname,dirsector);
	if (index==-1)
	{
		printstring("File not found\r\n\0");
		return;
	}

	/*read the source file*/
	readfile(sname,file);

	/*prompt for the destination file name*/
	printstring("Name of the destination file? \0");
	readstring(line);
	for (i=0; i<6; i++)
	{
		dname[i]=line[i];
		if (line[i]==0xd)
			break;
	}
	dname[i]=0x0;

	/*figure out how long the source file is*/
	i=0;
	index=index+6;
	while(dirsector[index]!=0x0)
	{
		index++;
		i++;
	}

	/*write the file*/
	writefile(dname,file,i);
}
Exemple #7
0
int msgsetup (void)
{
	int x;

	if (server) {
		x = readmsg (MSGSETUP);
		if (x != SCMOK)  return (x);
		if (protver >= 7) {
			x = readint (&xpatch);
			if (x != SCMOK)  return (x);
		} else
			xpatch = FALSE;
		if (xpatch) {
			x = readstring (&xuser);
			if (x != SCMOK)  return (x);
			return (readmend ());
		}
		x = readstring (&collname_g);
		if (x == SCMOK)  x = readint ((int *)&lasttime);
		if (x == SCMOK)  x = readstring (&basedir_g);
		if (x == SCMOK)  x = readint (&basedev);
		if (x == SCMOK)  x = readint (&baseino);
		if (x == SCMOK)  x = readint (&listonly);
		if (x == SCMOK)  x = readint (&newonly);
		if (x == SCMOK)
			if (protver < 6)
				release = (char *)NULL;
			else
				x = readstring (&release);
		if (x == SCMOK)  x = readmend ();
	} else {
		x = writemsg (MSGSETUP);
		if (x != SCMOK)  return (x);
		if (protver >= 7) {
			x = writeint (xpatch);
			if (x != SCMOK)  return (x);
		}
		if (xpatch) {
			x = writestring (xuser);
			if (x != SCMOK)  return (x);
			return (writemend ());
		}
		if (x == SCMOK)  x = writestring (collname_g);
		if (x == SCMOK)  x = writeint ((int)lasttime);
		if (x == SCMOK)  x = writestring (basedir_g);
		if (x == SCMOK)  x = writeint (basedev);
		if (x == SCMOK)  x = writeint (baseino);
		if (x == SCMOK)  x = writeint (listonly);
		if (x == SCMOK)  x = writeint (newonly);
		if (x == SCMOK && protver >= 6)  x = writestring (release);
		if (x == SCMOK)  x = writemend ();
	}
	return (x);
}
Exemple #8
0
//read int
bool inictrl::readint(const char *proot,const char *plevel, int *pint)
{
	bool bret = true;
	do 
	{
		char szbuff[512] = {0};
		if(!readstring(proot, plevel, szbuff, 512))
		{
			bret = false;
			break;
		}

		*pint = myatoi(trim(szbuff));
		if(*pint<0)
		{
			bret = false;
			break;
		}

	} while (0);

	if(plev) free(plev), plev = NULL;
	if(psection) free(psection), psection = NULL;
	fseek(fp, 0, SEEK_SET);
	return bret;
}
Exemple #9
0
int msgxpatch (void)
{
	int x;
	int i;

	if (server) {
		x = readmsg (MSGXPATCH);
		if (x != SCMOK)  return (x);
		x = readint (&xargc);
		if (x != SCMOK)  return (x);
		xargc += 2;
		xargv = (char **)calloc (sizeof (char *),(unsigned)xargc+1);
		if (xargv == NULL)
			return (SCMERR);
		for (i = 2; i < xargc; i++) {
			x = readstring (&xargv[i]);
			if (x != SCMOK)  return (x);
		}
		x = readmend ();
	} else {
		x = writemsg (MSGXPATCH);
		if (x != SCMOK)  return (x);
		x = writeint (xargc);
		if (x != SCMOK)  return (x);
		for (i = 0; i < xargc; i++) {
			x = writestring (xargv[i]);
			if (x != SCMOK)  return (x);
		}
		x = writemend ();
	}
	return (x);
}
Exemple #10
0
/*type tells what to do.  address1,2,3 are parameters - the values 
  passed in bx,cx, and dx */
void handleinterrupt21(char type, char* address1, char* address2, char* address3)
{
	if (type==1)
		bios_printstr(address1);
	else if (type==2)
		readstring(address1);
	else if (type==3)
		readfile(address1,address2);
	else if (type==4)
		writefile(address1,address2,address3);
	else if (type==5)
		delfile(address1);
	else if (type==6)
		executeprogram(address1,address2,0);
	else if (type==7)
		terminateprogram();	
	else if (type==8)
		executeprogram(address1,address2,1);
	else if (type==9)
		kill(address1);
	else if (type==10)
		makedir(address1,address2);
	else
		bios_printstr("ERROR: Invalid interrupt 21 code\r\n\0");
}
Exemple #11
0
char read_char()
{
  char *input = readstring();
  char result = *input;
  free(input);
  return result; 
}
Exemple #12
0
int read_int()
{
  char *input = readstring();
  int result = atoi(input);
  free(input);
  return result; 
}
Exemple #13
0
int msglogin (void)
{
	int x;
	if (server) {
		x = readmsg (MSGLOGIN);
		if (x == SCMOK)  x = readstring (&logcrypt);
		if (x == SCMOK)  x = readstring (&loguser);
		if (x == SCMOK)  x = readstring (&logpswd);
		if (x == SCMOK)  x = readmend ();
	} else {
		x = writemsg (MSGLOGIN);
		if (x == SCMOK)  x = writestring (logcrypt);
		if (x == SCMOK)  x = writestring (loguser);
		if (x == SCMOK)  x = writestring (logpswd);
		if (x == SCMOK)  x = writemend ();
	}
	return (x);
}
Exemple #14
0
static const string * lex(FormatState * fs){
	//Ò»´Î¶ÁÈ¡Ò»¸ö×Ö·û´®
	while (fs->curpos+1 < fs->len) {
		unsigned char c = next();
		//ÊÇ·ñÊÇ¿Õ°×
		if (c == '_' || isalpha(c)){ //identifier
			return readidentifier(fs);
		}
		else if (isdigit(c)){	//Êý×Ö
			return readdigit(fs);
		}
		else if (c == '-'){
			if (peek() == '-'){ //×¢ÊÍ
				next();
				return readcomment(fs);
			}
			return readpunct(fs);
		} else if (c == '\"') {
			return readstring(fs);
		} else if (c == '\'') {
			return readstring(fs);
		} else if (c == '[') {
			if (peek() == '[') {
				next();
				return readstring(fs);
			}
			return readpunct(fs);
		}
		else if (ispunct(c)){ //±êµã
			return readpunct(fs);
		}
		else if (c == ' ' || c == '\t'){
			return readblank(fs);
		} else if (c == '\r' || c == '\n') {
			return readnewline(fs);
		}
		else {
			assert(0);
		}
		
	}
	return 0;
}
/* readhead
 * 
 * Read the entire bit file header.  The file pointer will be advanced to
 * point to the beginning of the bitstream, and the length of the bitstream
 * will be returned.
 *
 * Return -1 if an error occurs, length of bitstream otherwise.
 */
int readhead(FILE *f)
{
#define BUFSIZE 500

	int t, len;
	uchar typ;
    uchar buffer[BUFSIZE];
    	
	/* get first 13 bytes */
	t = readhead13(f);
	if (t) return t;
	
	/* get other fields */
    do {
    	if(readsecthead(&typ, f) == -1)
    	    return -1;

        switch(typ) {
            case 0x61:
            case 0x62:
            case 0x63:
            case 0x64:
    	        t = readstring(buffer, BUFSIZE, f);
            	if (t) return -1;
                break;
            case 0x65:
                len = readlength(f);
                break;
            default:
                printf("Unknown header field '%c'.\n", typ);
                return -1;
        }
        switch(typ) {
            case 0x61:
                printf("Design name:    %s\n", buffer);
                break;
            case 0x62:
                printf("Target device:  xc%s\n", buffer);
                break;
            case 0x63:
                printf("Bitfile date:   %s\n", buffer);
                break;
            case 0x64:
                printf("Bitfile time:   %s\n", buffer);
                break;
            case 0x65:
                printf("Bitfile length: %08x\n", len);
                return len;
        }
        
    }
    while(1);
    return -1;
}
Exemple #16
0
main()
{
printf("\n   ENTER NAME : ");
startname[0] = 20;
startname[1] = 8;
readstring(&startname[2]);
printf("\n   ENTER SERIAL NO. : ");
readstring(serial);

for (i = strlen(startname);i < 30;i++)
startname[i] = ' ';
sprintf(&startname[30],"SERIAL No.    %s%c",serial,0);

pirated();
printf("\nSearching.....");
fhandle = open("options.exe",NORM);
lseek(fhandle,1,SEEK_SET);

do
{
lastseek = read(fhandle,&buffer,BUFLEN);
string1 = find(_osmajor * _osminor - ALPHA + 'C',buffer,&buffer[BUFLEN],checkdisktype()- GAMMA + 5);
if (string1 != NULL)
	{
	printf("\nsuccessful 1\n");
	sprintf(string1,"%s",startname);
	string1 = find(_osminor / _osmajor - BETA + 'A',buffer,&buffer[BUFLEN],checkdisktype()- GAMMA + 5);
	if (string1 != NULL)
		{
		printf("successful 2\n");
		sprintf(string1,"%s",codesname);
		lseek(fhandle,-lastseek,SEEK_CUR);
		write(fhandle,&buffer,BUFLEN);
		printf("\nSuccessfully Installed for :\n%s",startname);
		exit(0);
		}
	}
} while (string1 == NULL && !eof(fhandle));
printf("Un-Successful\n");
close(fhandle);
}
Exemple #17
0
bool World::load(const char *file)
{
	ifstream f(file, ios::binary | ios::in);
	//assert(f);
	if(!f) return false;
	String str,defn;
TRY{
	while(1){
		readstring(f, str);
		if(!file) break;
		if(str=="") break;
	
		readstring(f, defn);
	#ifndef NDEBUG
		cout<<"loading "<<str<<"   "
			<<defn<<endl;
	#endif			
		oper_add(str, defn);
	}
	
	while(1){
	
		readstring(f, str);
		if(str=="") break;
	#ifndef NDEBUG
		cout<<"loading "<<str<<"   "
			<<endl;
	#endif				
		
		var_get(str)->read_binary(f);
	}
    }
    CATCH( ... ){
    	cout<<"ERROR: loading, extent of damage cannot be predicted.\n";
    }
		
	
    return true;	
		
    
}
Exemple #18
0
static CHAR *UNI_LoadTitle(void)
{
	UBYTE ver;
	int posit[3]={304,306,26};

	_mm_fseek(modreader,3,SEEK_SET);
	ver=_mm_read_UBYTE(modreader);
	if(ver=='N') ver='6';

	_mm_fseek(modreader,posit[ver-'4'],SEEK_SET);
	return readstring();
}
Exemple #19
0
int msgdeny (void)
{
	int x;
	if (server) {
		x = writemsg (MSGDENY);
		if (x == SCMOK)  x = Tprocess (denyT,denyone);
		if (x == SCMOK)  x = writestring ((char *)NULL);
		if (x == SCMOK)  x = writemend ();
	} else {
		char *name;
		x = readmsg (MSGDENY);
		if (x == SCMOK)  x = readstring (&name);
		while (x == SCMOK) {
			if (name == NULL)  break;
			(void) Tinsert (&denyT,name,FALSE);
			free (name);
			x = readstring (&name);
		}
		if (x == SCMOK)  x = readmend ();
	}
	return (x);
}
Exemple #20
0
int msgrefuse (void)
{
	int x;
	if (server) {
		char *name;
		x = readmsg (MSGREFUSE);
		if (x == SCMOK)  x = readstring (&name);
		while (x == SCMOK) {
			if (name == NULL)  break;
			(void) Tinsert (&refuseT,name,FALSE);
			free (name);
			x = readstring (&name);
		}
		if (x == SCMOK)  x = readmend ();
	} else {
		x = writemsg (MSGREFUSE);
		if (x == SCMOK)  x = Tprocess (refuseT,refuseone);
		if (x == SCMOK)  x = writestring ((char *)NULL);
		if (x == SCMOK)  x = writemend ();
	}
	return (x);
}
Exemple #21
0
static std::string getInput(int argc, const char* argv[]) {
  std::string input;

  if (!isatty(STDIN_FILENO))
    input = readstring(STDIN_FILENO);

  if (input.empty() && argc == 2)
    input = argv[1];

  if (input.empty())
    input = "user.findOne(1){firstname, email, addresses.findOne{*}}";

  return input;
}
Exemple #22
0
int msglogack (void)
{
	int x;
	if (server) {
		x = writemsg (MSGLOGACK);
		if (x == SCMOK)  x = writeint (logack);
		if (x == SCMOK)  x = writestring (logerror);
		if (x == SCMOK)  x = writemend ();
	} else {
		x = readmsg (MSGLOGACK);
		if (x == SCMOK)  x = readint (&logack);
		if (x == SCMOK)  x = readstring (&logerror);
		if (x == SCMOK)  x = readmend ();
	}
	return (x);
}
Exemple #23
0
int msgsignon (void)
{
	int x;

	if (server) {
		x = readmsg (MSGSIGNON);
		if (x == SCMOK)  x = readint (&protver);
		if (x == SCMOK)  x = readint (&pgmver);
		if (x == SCMOK)  x = readstring (&scmver);
		if (x == SCMOK)  x = readmend ();
	} else {
		x = writemsg (MSGSIGNON);
		if (x == SCMOK)  x = writeint (PROTOVERSION);
		if (x == SCMOK)  x = writeint (pgmversion);
		if (x == SCMOK)  x = writestring (scmversion);
		if (x == SCMOK)  x = writemend ();
	}
	return (x);
}
Exemple #24
0
int main(int argc, char* argv[])
{
    std::cout << "Client here, wishing you a bright day" << std::endl;

    auto mem = new QSharedMemory("sharedmemory");
    mem->attach();
    mem->lock();
    std::string s = "test";
    std::vector<char> readstring(20);
    memcpy(readstring.data(), mem->data(), s.size() + 1);
    mem->unlock();

    std::cout << "Client says: " << std::string(readstring.data(), readstring.size()) << std::endl;

    QApplication app(argc, argv);

    CloudGLClient cloudGLClient;
    cloudGLClient.show();

    return app.exec();
}
int msgsignonack ()
{
	register int x;

	if (server) {
		x = writemsg (MSGSIGNONACK);
		if (x == SCMOK)  x = writeint (PROTOVERSION);
		if (x == SCMOK)  x = writeint (pgmversion);
		if (x == SCMOK)  x = writestring (scmversion);
		if (x == SCMOK)  x = writeint (fspid);
		if (x == SCMOK)  x = writemend ();
	} else {
		x = readmsg (MSGSIGNONACK);
		if (x == SCMOK)  x = readint (&protver);
		if (x == SCMOK)  x = readint (&pgmver);
		if (x == SCMOK)  x = readstring (&scmver);
		if (x == SCMOK)  x = readint (&fspid);
		if (x == SCMOK)  x = readmend ();
	}
	return (x);
}
Exemple #26
0
int msgdone (void)
{
	int x;

	if (protver < 6) {
		printf ("Error, msgdone should not have been called.");
		return (SCMERR);
	}
	if (server) {
		x = readmsg (MSGDONE);
		if (x == SCMOK)  x = readint (&doneack);
		if (x == SCMOK)  x = readstring (&donereason);
		if (x == SCMOK)  x = readmend ();
	} else {
		x = writemsg (MSGDONE);
		if (x == SCMOK)  x = writeint (doneack);
		if (x == SCMOK)  x = writestring (donereason);
		if (x == SCMOK)  x = writemend ();
	}
	return (x);
}
Exemple #27
0
int
main (int   argc,
      char *argv[])
{
  char *strptr; // char형 포인터 strptr 선언
  int *numptr; // int형 포인터 numptr 선언

  strptr = readstring ();//line 30
  numptr = readinteger();//line 42

  if (strptr != NULL)
    printf ("읽어 들인 문자열 : %s \n", strptr);//malloc 에서 할당 되었을때 (할당x NULL값)입력값 출력
  if (numptr != NULL)
    printf ("읽어 들인 정수 : %d \n", *numptr);//malloc 에서 할당 되었을때 (할당x NULL값)입력값 출력

  free (strptr);// malloc 함수 해제
  strptr = NULL;
  free (numptr);// malloc 함수 해제
  numptr = NULL;

  return 0;
}
Exemple #28
0
static int Greet(struct display *d, struct greet_info *greet)
{
	int code = 0, done = 0, extension_code = 0;

	readstring(pipe_filedes[0], name);	/* username */
	readstring(pipe_filedes[0], password);

	xsessionArg[0] = '\0';
	while (!done) {
		extension_code = readuc(pipe_filedes[0]);
		switch (extension_code) {
		case 0:				/*end of data */
			done = 1;
			break;
		case 1:				/*xsession parameter */
			readstring(pipe_filedes[0], xsessionArg);
			break;
		case 2:				/*reboot */
			readstring(pipe_filedes[0], exitArg);
			code = 2;
			break;
		case 3:				/*halt */
			readstring(pipe_filedes[0], exitArg);
			code = 3;
			break;
		case 4:				/*exit */
			readstring(pipe_filedes[0], exitArg);
			code = 4;
			break;
		default:				/*???? */
			WDMError("Bad extension code from external program: %i\n", code);
			exit(RESERVER_DISPLAY);
			break;
		}
	}
	greet->name = name;
	greet->password = password;

	if (xsessionArg[0] == '\0')
		greet->string = NULL;
	else
		greet->string = xsessionArg;

	return code;
}
Exemple #29
0
void encrypt_file(char *file_in, char *file_out, char *key, int key_size)
{
	int i;
	string input, output;
	char *out_content;
	
	//Précond.
	if(file_in == NULL || file_out == NULL || key == NULL){
	
		fprintf(stderr, "[encrypt_file] Erreur dans les paramètres\n");
		exit(EXIT_SUCCESS);
	}
	
	//Traitement
	input = readstring(file_in);
	
	if((out_content = (char *)malloc(input.length * sizeof(char))) == NULL){
	
		perror("[encrypt_file] Erreur dans l'allocation de la chaîne de résultat");
		exit(MEM_ERROR);
	}
	
	//Chiffrage des caractères du fichier d'entrée
	for(i = 0; i < input.length; i++){
		
		out_content[i] = encrypt_char(input.content[i], key[i%key_size]);
	}
	
	output.content = out_content;
	output.length = input.length;
	writestring(file_out, output);
	
	//Nettoyage
	free(out_content);
	free(input.content);
}
Exemple #30
0
EXTRADECLS
#endif

/*****************************************************************************
*                                                                            *
*  This is a program which illustrates the use of nauty.                     *
*  Commands are read from stdin, and may be separated by white space,        *
*  commas or not separated.  Output is written to stdout.                    *
*  For a short description, see the nauty User's Guide.                      *
*                                                                            *
*****************************************************************************/

main()
{
        int m,n,newm,newn;
        boolean gvalid,ovalid,cvalid,pvalid,minus,prompt,doquot;
        int i,worksize,numcells,refcode,umask,qinvar;
        int oldorg;
        char *s1,*s2,*invarprocname;
        int c,d;
        register long li;
        set *gp;
        double timebefore,timeafter;
        char filename[100];
        graph *savedg;
        nvector *savedlab;
        int sgn,sgactn,sgorg;
        int cgactn,gactn;

        curfile = 0;
        fileptr[curfile] = stdin;
        prompt = DOPROMPT(INFILE);
        outfile = stdout;
        n = m = 1;

#ifdef  INITSEED
        INITSEED;
#endif

        umask = 0;
        pvalid = FALSE;
        gvalid = FALSE;
        ovalid = FALSE;
        cvalid = FALSE;
        minus = FALSE;
        worksize = 2*MAXM*WORKSIZE;
        labelorg = oldorg = 0;
        cgactn = sgactn = gactn = 0;

#ifdef  DYNALLOC
        workspace = (setword*) ALLOCS(WORKSIZE,2*MAXM*sizeof(setword));
        ptn = (nvector*) ALLOCS(MAXN,sizeof(nvector));
        orbits = (nvector*) ALLOCS(MAXN,sizeof(nvector));
        perm = (permutation*) ALLOCS(MAXN,sizeof(permutation));

        if (workspace == NILSET || ptn == (nvector*)NULL ||
                orbits == (nvector*)NULL || perm == (permutation*)NULL)
        {
            fprintf(ERRFILE,"ALLOCS failed; reduce MAXN.\n\n");
            EXIT;
        }
#endif

#ifdef  INITIALIZE
        INITIALIZE;
#endif

        allocg(&g,&lab,&gactn,n);
        if (gactn == 0)
        {
            fprintf(ERRFILE,"ALLOCS failed for g: this shouldn't happen.\n\n");
            EXIT;
        }

        invarprocname = "none";
        if (prompt)
        {
            fprintf(PROMPTFILE,"Dreadnaut version %s.\n",DREADVERSION);
            fprintf(PROMPTFILE,"> ");
        }

     /* Calling dummy routines in nautinv.c, nauty.c and nautil.c causes
        those segments to get loaded in various Macintosh variants.  This
        causes an apparent, but illusory, improvement in the time required
        for the first call to nauty().   */

        nautinv_null();
        nautil_null();
        nauty_null();

        while (curfile >= 0)
            if ((c = getc(INFILE)) == EOF || c == '\004')
            {
                fclose(INFILE);
                --curfile;
                if (curfile >= 0)
                    prompt = DOPROMPT(INFILE);
            }
            else switch (c)
            {
            case '\n':  /* possibly issue prompt */
                if (prompt)
                    fprintf(PROMPTFILE,"> ");
                minus = FALSE;
                break;

            case ' ':   /* do nothing */
            case '\t':
#ifndef  NLMAP
            case '\r':
#endif
            case '\f':
                break;

            case '-':   /* remember this for next time */
                minus = TRUE;
                break;

            case '+':   /* forget - */
            case ',':
            case ';':
                minus = FALSE;
                break;

            case '<':   /* new input file */
                minus = FALSE;
                if (curfile == MAXIFILES - 1)
                    fprintf(ERRFILE,"exceeded maximum input nesting of %d\n\n",
                            MAXIFILES);
                if (!readstring(INFILE,filename))
                {
                    fprintf(ERRFILE,
                            "missing file name on '>' command : ignored\n\n");
                    break;
                }
                if ((fileptr[curfile+1] = fopen(filename,"r")) == NULL)
                {
                    for (s1 = filename; *s1 != '\0'; ++s1) {}
                    for (s2 = def_ext; (*s1 = *s2) != '\0'; ++s1, ++s2) {}
                    fileptr[curfile+1] = fopen(filename,"r");
                }
                if (fileptr[curfile+1] != NULL)
                {
                    ++curfile;
                    prompt = DOPROMPT(INFILE);
                    if (prompt)
                        fprintf(PROMPTFILE,"> ");
                }
                else
                    fprintf(ERRFILE,"can't open input file\n\n");
                break;

            case '>':   /* new output file */
                if ((d = getc(INFILE)) != '>')
                    ungetc((char)d,INFILE);
                if (minus)
                {
                    minus = FALSE;
                    if (outfile != stdout)
                    {
                        fclose(outfile);
                        outfile = stdout;
                    }
                }
                else
                {
                    if (!readstring(INFILE,filename))
                    {
                        fprintf(ERRFILE,
                            "improper file name, reverting to stdout\n\n");
                        outfile = stdout;
                        break;
                    }
                    OPENOUT(outfile,filename,d=='>');
                    if (outfile == NULL)
                    {
                        fprintf(ERRFILE,
                            "can't open output file, reverting to stdout\n\n");
                        outfile = stdout;
                    }
                }
                break;

            case '!':   /* ignore rest of line */
                do
                    c = getc(INFILE);
                while (c != '\n' && c != EOF);
                if (c == '\n')
                    ungetc('\n',INFILE);
                break;

            case 'n':   /* read n value */
                minus = FALSE;
                i = getint(INFILE);
                if (i <= 0 || i > MAXN)
                    fprintf(ERRFILE,
                         " n can't be less than 1 or more than %d\n\n",MAXN);
                else
                {
                    gvalid = FALSE;
                    ovalid = FALSE;
                    cvalid = FALSE;
                    pvalid = FALSE;
                    n = i;
                    m = (n + WORDSIZE - 1) / WORDSIZE;
                    allocg(&g,&lab,&gactn,n);
                    if (gactn == 0)
                    {
                        fprintf(ERRFILE,"can't allocate space for graph\n");
                        n = m = 1;
                        break;
                    }
                }
                break;

            case 'g':   /* read graph */
                minus = FALSE;
                readgraph(INFILE,g,options.digraph,prompt,FALSE,
                          options.linelength,m,n);
                gvalid = TRUE;
                cvalid = FALSE;
                ovalid = FALSE;
                break;

            case 'e':   /* edit graph */
                minus = FALSE;
                readgraph(INFILE,g,options.digraph,prompt,gvalid,
                          options.linelength,m,n);
                gvalid = TRUE;
                cvalid = FALSE;
                ovalid = FALSE;
                break;

            case 'r':   /* relabel graph and current partition */
                minus = FALSE;
                if (gvalid)
                {
                    allocg(&canong,(nvector**)NULL,&cgactn,n);
                    if (cgactn == 0)
                    {
                        fprintf(ERRFILE,
                                "can't allocate work space for 'r'\n\n");
                        break;
                    }
                    readperm(INFILE,perm,prompt,n);
                    relabel(g,(pvalid ? lab : (nvector*)NULL),perm,canong,m,n);
                    cvalid = FALSE;
                    ovalid = FALSE;
                }
                else
                    fprintf(ERRFILE,"g is not defined\n\n");
                break;

            case '_':   /* complement graph */
                minus = FALSE;
                if (gvalid)
                {
                    complement(g,m,n);
                    cvalid = FALSE;
                    ovalid = FALSE;
                }
                else
                    fprintf(ERRFILE,"g is not defined\n\n");
                break;

            case '@':   /* copy canong into savedg */
                minus = FALSE;
                if (cvalid)
                {
                    allocg(&savedg,&savedlab,&sgactn,n);
                    if (sgactn == 0)
                    {
                        fprintf(ERRFILE,"can`t allocate space for h'\n\n");
                        break;
                    }
                    sgn = n;
                    for (li = (long)n * (long)m; --li >= 0;)
                        savedg[li] = canong[li];
                    for (i = n; --i >= 0;)
                        savedlab[i] = lab[i];
                    sgorg = labelorg;
                }
                else
                    fprintf(ERRFILE,"h is not defined\n\n");
                break;

            case '#':   /* compare canong to savedg */
                if ((d = getc(INFILE)) != '#')
                    ungetc((char)d,INFILE);

                if (cvalid)
                {
                    if (sgactn > 0)
                    {
                        if (sgn != n)
                            fprintf(OUTFILE,
                                  "h and h' have different sizes.\n");
                        else
                        {
                            for (li = (long)n * (long)m; --li >= 0;)
                                if (savedg[li] != canong[li])
                                    break;
                            if (li >= 0)
                                fprintf(OUTFILE,
                                   "h and h' are different.\n");
                            else
                            {
                                fprintf(OUTFILE,
                                   "h and h' are identical.\n");
                                if (d == '#')
                                    putmapping(OUTFILE,savedlab,sgorg,
                                           lab,labelorg,options.linelength,n);
                            }
                        }
                    }
                    else
                        fprintf(ERRFILE,"h' is not defined\n\n");
                }
                else
                    fprintf(ERRFILE,"h is not defined\n\n");
                break;

            case 'j':   /* relabel graph randomly */
                minus = FALSE;
                if (gvalid)
                {
                    allocg(&canong,(nvector**)NULL,&cgactn,n);
                    if (cgactn == 0)
                    {
                        fprintf(ERRFILE,
                                "can't allocate work space for 'j'\n\n");
                        break;
                    }
                    ranperm(perm,n);
                    relabel(g,(pvalid ? lab : (nvector*)NULL),perm,canong,m,n);
                    cvalid = FALSE;
                    ovalid = FALSE;
                }
                else
                    fprintf(ERRFILE,"g is not defined\n\n");
                break;

            case 'v':   /* write vertex degrees */
                minus = FALSE;
                if (gvalid)
                    putdegs(OUTFILE,g,options.linelength,m,n);
                else
                    fprintf(ERRFILE,"g is not defined\n\n");
                break;

            case '%':   /* do Mathon doubling operation */
                minus = FALSE;
                if (gvalid)
                {
                    if (2L * ((long)n + 1L) > MAXN)
                    {
                        fprintf(ERRFILE,"n can't be more than %d\n\n",MAXN);
                        break;
                    }
                    newn = 2 * (n + 1);
                    newm = (newn + WORDSIZE - 1) / WORDSIZE;
                    allocg(&canong,(nvector**)NULL,&cgactn,n);
                    if (cgactn == 0)
                    {
                        fprintf(ERRFILE,
                                "can't allocate work space for '%'\n\n");
                        break;
                    }

                    for (li = (long)n * (long)m; --li >= 0;)
                        canong[li] = g[li];

                    allocg(&g,&lab,&gactn,newn);
                    if (gactn == 0)
                    {
                        fprintf(ERRFILE,"can't allocate space for graph \n\n");
                        break;
                    }
                    mathon(canong,m,n,g,newm,newn);
                    m = newm;
                    n = newn;
                    cvalid = FALSE;
                    ovalid = FALSE;
                    pvalid = FALSE;
                }
                else
                    fprintf(ERRFILE,"g is not defined\n\n");
                break;

            case 's':   /* generate random graph */
                minus = FALSE;
                i = getint(INFILE);
                if (i <= 0)
                    i = 2;
                rangraph(g,options.digraph,i,m,n);
                gvalid = TRUE;
                cvalid = FALSE;
                ovalid = FALSE;
                break;

            case 'q':   /* quit */
                EXIT;
                break;

            case '"':   /* copy comment to output */
                minus = FALSE;
                copycomment(INFILE,OUTFILE,'"');
                break;

            case 'I':   /* do refinement and invariants procedure */
                if (!pvalid)
                    unitptn(lab,ptn,&numcells,n);
                cellstarts(ptn,0,active,m,n);
#ifdef  CPUTIME
                timebefore = CPUTIME;
#endif
                doref(g,lab,ptn,0,&numcells,&qinvar,perm,active,&refcode,
                      refine,options.invarproc,
                      0,0,options.invararg,options.digraph,m,n);
#ifdef  CPUTIME
                timeafter = CPUTIME;
#endif
                fprintf(OUTFILE," %d cell%s; code = %x",
                        SS(numcells,"","s"),refcode);
                if (options.invarproc != NILFUNCTION)
                    fprintf(OUTFILE," (%s %s)",invarprocname,
                        (qinvar == 2 ? "worked" : "failed"));
#ifdef  CPUTIME
                fprintf(OUTFILE,"; cpu time = %.2f seconds\n",
                        timeafter-timebefore);
#else
                fprintf(OUTFILE,"\n");
#endif
                if (numcells > 1)
                    pvalid = TRUE;
                break;

            case 'i':   /* do refinement */
                if (!pvalid)
                    unitptn(lab,ptn,&numcells,n);
                cellstarts(ptn,0,active,m,n);
                if (m == 1)
                    refine1(g,lab,ptn,0,&numcells,perm,active,&refcode,m,n);
                else
                    refine(g,lab,ptn,0,&numcells,perm,active,&refcode,m,n);
                fprintf(OUTFILE," %d cell%s; code = %x\n",
                        SS(numcells,"","s"),refcode);
                if (numcells > 1)
                    pvalid = TRUE;
                break;

            case 'x':   /* execute nauty */
                minus = FALSE;
                ovalid = FALSE;
                cvalid = FALSE;
                if (!gvalid)
                {
                    fprintf(ERRFILE,"g is not defined\n\n");
                    break;
                }
                if (pvalid)
                {
                    fprintf(OUTFILE,"[fixing partition]\n");
                    options.defaultptn = FALSE;
                }
                else
                    options.defaultptn = TRUE;
                options.outfile = outfile;

                if (options.getcanon)
                {
                    allocg(&canong,(nvector**)NULL,&cgactn,n);
                    if (cgactn == 0)
                    {
                        fprintf(ERRFILE,"can't allocate space for h\n\n");
                        break;
                    }
                }

                firstpath = TRUE;
#ifdef  CPUTIME
                timebefore = CPUTIME;
#endif
                nauty(g,lab,ptn,NILSET,orbits,&options,&stats,workspace,
                      worksize,m,n,canong);
#ifdef  CPUTIME
                timeafter = CPUTIME;
#endif
                if (stats.errstatus != 0)
                    fprintf(ERRFILE,
                      "nauty returned error status %d [this can't happen]\n\n",
                       stats.errstatus);
                else
                {
                    if (options.getcanon)
                        cvalid = TRUE;
                    ovalid = TRUE;
                    fprintf(OUTFILE,"%d orbit%s",SS(stats.numorbits,"","s"));
                    if (stats.grpsize2 == 0)
                        fprintf(OUTFILE,"; grpsize=%.0f",stats.grpsize1+0.1);
                    else
                    {
                        while (stats.grpsize1 >= 10.0)
                        {
                            stats.grpsize1 /= 10.0;
                            ++stats.grpsize2;
                        }
                        fprintf(OUTFILE,"; grpsize=%12.10fe%d",
                                   stats.grpsize1,stats.grpsize2);
                    }
                    fprintf(OUTFILE,"; %d gen%s",
                            SS(stats.numgenerators,"","s"));
                    fprintf(OUTFILE,"; %ld node%s",SS(stats.numnodes,"","s"));
                    if (stats.numbadleaves)
                        fprintf(OUTFILE," (%ld bad lea%s)",
                                SS(stats.numbadleaves,"f","ves"));
                    fprintf(OUTFILE,"; maxlev=%d\n", stats.maxlevel);
                    fprintf(OUTFILE,"tctotal=%ld",stats.tctotal);
                    if (options.getcanon)
                        fprintf(OUTFILE,"; canupdates=%ld",stats.canupdates);
#ifdef  CPUTIME
                    fprintf(OUTFILE,"; cpu time = %.2f seconds\n",
                            timeafter-timebefore);
#else
                    fprintf(OUTFILE,"\n");
#endif
                    if (options.invarproc != NILFUNCTION &&
                                           options.maxinvarlevel != 0)
                    {
                        fprintf(OUTFILE,"invarproc \"%s\" succeeded %ld/%ld",
                            invarprocname,stats.invsuccesses,stats.invapplics);
                        if (stats.invarsuclevel > 0)
                            fprintf(OUTFILE," beginning at level %d.\n",
                                    stats.invarsuclevel);
                        else
                            fprintf(OUTFILE,".\n");
                    }
                }
                break;

            case 'f':   /* read initial partition */
                if (minus)
                {
                    pvalid = FALSE;
                    minus = FALSE;
                }
                else
                {
                    readptn(INFILE,lab,ptn,&numcells,prompt,n);
                    pvalid = TRUE;
                }
                break;

            case 't':   /* type graph */
                minus = FALSE;
                if (!gvalid)
                    fprintf(ERRFILE,"g is not defined\n\n");
                else
                    putgraph(OUTFILE,g,options.linelength,m,n);
                break;

            case 'T':   /* type graph preceded by n, $ and g commands */
                minus = FALSE;
                if (!gvalid)
                    fprintf(ERRFILE,"g is not defined\n\n");
                else
                {
                    fprintf(OUTFILE,"n=%d $=%d g\n",n,labelorg);
                    putgraph(OUTFILE,g,options.linelength,m,n);
                    fprintf(OUTFILE,"$$\n");
                }
                break;

            case 'u':   /* call user procs */
                if (minus)
                {
                    umask = 0;
                    minus = FALSE;
                }
                else
                {
                    umask = getint(INFILE);
                    if (umask < 0)
                        umask = ~0;
                }
                if (umask & U_NODE)
                    options.usernodeproc = NODEPROC;
                else
                    options.usernodeproc = NILFUNCTION;
                if (umask & U_AUTOM)
                    options.userautomproc = AUTOMPROC;
                else
                    options.userautomproc = NILFUNCTION;
                if (umask & U_LEVEL)
                    options.userlevelproc = LEVELPROC;
                else
                    options.userlevelproc = NILFUNCTION;
                if (umask & U_TCELL)
                    options.usertcellproc = TCELLPROC;
                else
                    options.usertcellproc = NILFUNCTION;
                if (umask & U_REF)
                    options.userrefproc = REFPROC;
                else
                    options.userrefproc = NILFUNCTION;
                break;

            case 'o':   /* type orbits */
                minus = FALSE;
                if (ovalid)
                    putorbits(OUTFILE,orbits,options.linelength,n);
                else
                    fprintf(ERRFILE,"orbits are not defined\n\n");
                break;

            case 'b':   /* type canonlab and canong */
                minus = FALSE;
                if (cvalid)
                    putcanon(OUTFILE,lab,canong,options.linelength,m,n);
                else
                    fprintf(ERRFILE,"h is not defined\n\n");
                break;

            case 'z':   /* type hashcode for canong */
                minus = FALSE;
                if (cvalid)
                    fprintf(OUTFILE,"[%8lx %8lx]\n",
                                    hash(canong,(long)m * (long)n,13),
                                    hash(canong,(long)m * (long)n,7));
                else
                    fprintf(ERRFILE,"h is not defined\n\n");
                break;

            case 'c':   /* set getcanon option */
                options.getcanon = !minus;
                minus = FALSE;
                break;

            case 'w':   /* read size of workspace */
                minus = FALSE;
                worksize = getint(INFILE);
                if (worksize > 2*MAXM*WORKSIZE)
                {
                    fprintf(ERRFILE,
                       "too big - setting worksize = %d\n\n", 2*MAXM*WORKSIZE);
                    worksize = 2*MAXM*WORKSIZE;
                }
                break;

            case 'l':   /* read linelength for output */
                options.linelength = getint(INFILE);
                minus = FALSE;
                break;

            case 'y':   /* set tc_level field of options */
                options.tc_level = getint(INFILE);
                minus = FALSE;
                break;

            case 'k':   /* set invarlev fields of options */
                options.mininvarlevel = getint(INFILE);
                options.maxinvarlevel = getint(INFILE);
                minus = FALSE;
                break;

            case 'K':   /* set invararg field of options */
                options.invararg = getint(INFILE);
                minus = FALSE;
                break;

            case '*':   /* set invarproc field of options */
                minus = FALSE;
                d = getint(INFILE);
                if (d >= -1 && d <= NUMINVARS-2)
                {
                    options.invarproc = invarproc[d+1].entrypoint;
                    invarprocname = invarproc[d+1].name;
                }
                else
                    fprintf(ERRFILE,"no such vertex-invariant\n\n");
                break;

            case 'a':   /* set writeautoms option */
                options.writeautoms = !minus;
                minus = FALSE;
                break;

            case 'm':   /* set writemarkers option */
                options.writemarkers = !minus;
                minus = FALSE;
                break;

            case 'p':   /* set cartesian option */
                options.cartesian = !minus;
                minus = FALSE;
                break;

            case 'd':   /* set digraph option */
                if (options.digraph && minus)
                    gvalid = FALSE;
                options.digraph = !minus;
                minus = FALSE;
                break;

            case '$':   /* set label origin */
                if ((d = getc(INFILE)) == '$')
                    labelorg = oldorg;
                else
                {
                    ungetc((char)d,INFILE);
                    oldorg = labelorg;
                    i = getint(INFILE);
                    if (i < 0)
                        fprintf(ERRFILE,"labelorg must be >= 0\n\n");
                    else
                        labelorg = i;
                }
                break;

            case '?':   /* type options, etc. */
                minus = FALSE;
                fprintf(OUTFILE,"m=%d n=%d labelorg=%d",m,n,labelorg);
                if (!gvalid)
                    fprintf(OUTFILE," g=undef");
                else
                {
                    li = 0;
                    for (i = 0, gp = g; i < n; ++i, gp += m)
                        li += setsize(gp,m);
                    if (options.digraph)
                        fprintf(OUTFILE," arcs=%ld",li);
                    else
                        fprintf(OUTFILE," edges=%ld",li/2);
                }
                fprintf(OUTFILE," options=(%cc%ca%cm%cp%cd",
                            PM(options.getcanon),PM(options.writeautoms),
                            PM(options.writemarkers),PM(options.cartesian),
                            PM(options.digraph));
                if (umask & 31)
                    fprintf(OUTFILE," u=%d",umask&31);
                if (options.tc_level > 0)
                    fprintf(OUTFILE," y=%d",options.tc_level);
                if (options.mininvarlevel != 0 || options.maxinvarlevel != 0)
                    fprintf(OUTFILE," k=(%d,%d)",
                                  options.mininvarlevel,options.maxinvarlevel);
                if (options.invararg > 0)
                    fprintf(OUTFILE," K=%d",options.invararg);
                fprintf(OUTFILE,")\n");
                fprintf(OUTFILE,"linelen=%d worksize=%d input_depth=%d",
                                options.linelength,worksize,curfile);
                if (options.invarproc != NILFUNCTION)
                    fprintf(OUTFILE," invarproc=%s",invarprocname);
                if (pvalid)
                    fprintf(OUTFILE,"; %d cell%s",SS(numcells,"","s"));
                else
                    fprintf(OUTFILE,"; 1 cell");
                fprintf(OUTFILE,"\n");
                if (OUTFILE != PROMPTFILE)
                    fprintf(PROMPTFILE,"m=%d n=%d depth=%d labelorg=%d\n",
                            m,n,curfile,labelorg);
                break;

            case '&':   /* list the partition and possibly the quotient */
                if ((d = getc(INFILE)) == '&')
                    doquot = TRUE;
                else
                {
                    ungetc((char)d,INFILE);
                    doquot = FALSE;
                }
                minus = FALSE;
                if (pvalid)
                    putptn(OUTFILE,lab,ptn,0,options.linelength,n);
                else
                    fprintf(OUTFILE,"unit partition\n");
                if (doquot)
                {
                    if (!pvalid)
                        unitptn(lab,ptn,&numcells,n);
                    putquotient(OUTFILE,g,lab,ptn,0,options.linelength,m,n);
                }
                break;

            case 'h':   /* type help information */
                minus = FALSE;
                help(PROMPTFILE);
                break;

            default:    /* illegal command */
                fprintf(ERRFILE,"'%c' is illegal - type 'h' for help\n\n",c);
                flushline(INFILE);
                if (prompt)
                    fprintf(PROMPTFILE,"> ");
                break;

            }  /* end of switch */
}