Exemplo n.º 1
0
static void startHttpServer() {
	char *currentDir = (char*)malloc(65536);
	char *exe, *configFile, *wwwRoot;
	httpdPID = fork();
	switch (httpdPID) {
		case -1:
			perror("Unable to start HTTP server");
			exit(1);
		case 0:
			exe = "./http.pl";

			// chdir to HTTP server base directory
			chdir(wumpusDir);
			chdir("http/");
			if (getcwd(currentDir, sizeof(65535)) == NULL)
				currentDir = getcwd(NULL, 0);
			configFile = evaluateRelativePathName(currentDir, "../wumpus.cfg");
			configFile = concatenateStringsAndFree(duplicateString("--WumpusCFG="), configFile);
			wwwRoot = evaluateRelativePathName(currentDir, "www");
			wwwRoot = concatenateStringsAndFree(duplicateString("--HTTPRoot="), wwwRoot);
			signal(SIGINT, SIG_IGN);
			execl(exe, exe, configFile, wwwRoot, NULL);
			perror("startHttpServer()");
			exit(1);
	}
} // end of startHttpServer()
Exemplo n.º 2
0
void
add_replace_mobprog_data (CHAR_DATA * ch, CHAR_DATA * mob,
						  char *trigger_name, char *prog_data)
{
	MOBPROG_DATA *prog;
	MOBPROG_DATA *last_prog = NULL;

	for (prog = mob->prog; prog; prog = prog->next)
	{

		last_prog = prog;

		if (!str_cmp (prog->trigger_name, trigger_name))
			break;
	}

	if (!prog)
	{
		prog = new MOBPROG_DATA;

		if (last_prog)
			last_prog->next = prog;
		else
			mob->prog = prog;

		prog->trigger_name = duplicateString (trigger_name);
		prog->next = NULL;

	}
	else
		free_mem (prog->prog);

	prog->prog = duplicateString (prog_data);
	prog->busy = 0;
}
Exemplo n.º 3
0
static void XMLCALL startElementCallback (void *userData, const char *name, const char **atts)
{

    char attribute[100];
    char value[100];

    const char **att;

    // _debug ("InstantMessaging: StartElement Callback: %s", name);

    if (strcmp (name, "entry") == 0) {

        sfl::InstantMessaging::UriList *list = static_cast<sfl::InstantMessaging::UriList *> (userData);
        sfl::InstantMessaging::UriEntry entry = sfl::InstantMessaging::UriEntry();

        for (att = atts; *att; att += 2) {

            const char **val = att+1;

            duplicateString (attribute, *att, strlen (*att));
            duplicateString (value, *val, strlen (*val));

            // _debug ("InstantMessaging: attribute: %s, value: %s", attribute, value);

            entry.insert (std::pair<std::string, std::string> (std::string (attribute), std::string (value)));
        }

        list->push_back (entry);
    }

}
Exemplo n.º 4
0
void OfficeInputStream::initialize(const char *fileName, DocumentCache *cache) {
	PDFInputStream::initialize(NULL, cache);

	if (statusCode != 0) {
		int convTime = currentTimeMillis();

		pid_t child = fork();
		char *oldPath, *newPath;
		switch (child) {
			case -1:
				statusCode = 1;
				break;
			case 0:
#if 0
				oldPath = getenv("PATH");
				if (oldPath == NULL)
					newPath = duplicateString(getenv("HOME"));
				else
					newPath = concatenateStrings(getenv("HOME"), ":", oldPath);
				setenv("PATH", newPath, 1);
				setenv("WUMPUS_CONVERSION_TARGET", tempFileName, 1);
				statusCode = executeCommand(OOFFICE, "-headless", "-p", fileName, NULL, INPUT_CONVERSION_TIMEOUT);
#else
				oldPath = concatenateStrings(tempFileName, ".ps");
				statusCode = executeCommand(
						"abiword", "--disable-crash-dialog", "-p", oldPath, fileName, INPUT_CONVERSION_TIMEOUT);
				if (statusCode == 0)
					statusCode = executeCommand(
							"ps2pdf", oldPath, tempFileName, INPUT_CONVERSION_TIMEOUT);
				if (statusCode == 0)
					statusCode = executeCommand(
							"rm", oldPath, NULL, INPUT_CONVERSION_TIMEOUT);
				free(oldPath);
#endif
				exit(statusCode);
			default:
				waitpid(child, &statusCode, 0);
				break;
		} // end switch (child)

		if (statusCode == 0) {
			char *tempFile = duplicateString(tempFileName);
			PDFInputStream::initialize(tempFile, NULL);
			unlink(tempFile);
			free(tempFile);
			if ((statusCode == 0) && (cache != NULL)) {
				convTime = currentTimeMillis() - convTime;
				if (convTime < 0)
					convTime += 24 * 3600 * 1000;
				cache->addDocumentTextFromFile(originalFileName, tempFileName, convTime);
			}
		}
	} // end if (statusCode != 0)

	if (statusCode != 0) {
		inputFile = -1;
		unlink(tempFileName);
	}

} // end of initialize(char*, DocumentCache*)
Exemplo n.º 5
0
void Command::add(
		const char	*command_name,
		const char	*desc,
		bool		(* func_ptr)(u32, char **)
	)
{
	Command_t *e, *p, *n;
	u32 h;

	h = calculateStringHash(command_name) % RC_COMMAND_HASH_SIZE;

	e = command_hash[h];

	while (e) {

		if (strcmp(e->name, command_name) == 0) {
			remove(command_name);
			break;
		}

		e = (Command_t *) e->hash_next;
	}

	n = new Command_t;

	n->name = duplicateString(command_name);
	n->desc = duplicateString(desc);
	n->funcptr = func_ptr;
	n->hash_next = command_hash[h];
	n->list_next = 0;
	command_hash[h] = n;

	e = command_head;
	p = 0;

	while (e) {

		if (strcmp(e->name, command_name) > 0) {
			n->list_next = e;

			if (p) {
				p->list_next = n;
			} else {
				command_head = n;
			}

			return;
		}

		p = e;
		e = (Command_t *) e->list_next;
	}

	if (p) {
		p->list_next = n;
	} else {
		command_head = n;
	}

}
/** Initialize a row
 * @param row the row
 * @warning an initialized row must be finalized by DocumentRow_finalize() to free all resources
 */
void DocumentRow_init(DocumentRow * row) {
    row->code = duplicateString("");
    row->designation = duplicateString("");
    row->quantity = 0;
    row->unity = duplicateString("");
    row->basePrice = 0;
    row->sellingPrice = 0;
    row->discount = 0;
    row->rateOfVAT = 0;
    row->next = NULL;
    /*provided_DocumentRow_init(row);*/
}
Exemplo n.º 7
0
char *getSubstring(const char *s, int start, int end) {
	int sLen = strlen(s);
	if (start >= sLen)
		return duplicateString("");
	s = &s[start];
	end -= start;
	sLen -= start;
	char *result = duplicateString(s);
	if (sLen >= end)
		result[end] = 0;
	return result;
} // end of getSubstring(char*, int, int)
Exemplo n.º 8
0
struct plotRec *readPlot ( FILE *stream, long offset ) 
{
  int state = MV_STATE ;
  char line [ MXLINELEN ] ;
  struct plotRec *rec ;
  struct outlineRec *oline, *optr = NULL ;

  rec = newPlotRec ( ) ;
  rec -> outline = NULL ;
  rec -> RV = NULL ;

  (void) fseek ( stream, offset, SEEK_SET ) ;
  (void) fgets ( line, MXLINELEN, stream ) ;

  while ( fgets ( line, MXLINELEN, stream ) != NULL )
    if ( line [ 0 ] != '\n' && line [ 0 ] != '-' )
      if ( line [ 2 ] != ':' )
        return ( NULL ) ;
      else
      {
        if ( strncmp ( line, TITLE_KEY, 2 ) == 0 )
          break ;
        else if ( strncmp ( line, PLOT_KEY, 2 ) == 0 )
        {
          if ( state != PL_STATE )
          {
             oline = newOutlineRec ( ) ;
             if ( optr == NULL )
               rec -> outline = oline ;
             else 
                optr -> next = oline ;
             optr = oline ;
             optr -> PL = duplicateString ( line + 4 ) ;
             optr -> BY = NULL ;
             optr -> next = NULL ;
             state = PL_STATE ;
          }
          else
            optr -> PL = appendString ( optr -> PL, line + 4 ) ;
        }
        else if ( strncmp ( line, BY_KEY, 2 ) == 0 )
        {
          if ( state != PL_STATE )
            return ( NULL ) ;
          optr -> BY = duplicateString ( line + 4 ) ;
          state = MV_STATE ;
        }
        else if ( strncmp ( line, REVIEW_KEY, 2 ) == 0 )
	  rec -> RV = duplicateString ( line + 4 ) ;
     }
     return ( rec ) ;
}
Exemplo n.º 9
0
void
assignment (CHAR_DATA * mob, MOBPROG_DATA * program, char *target_name,
			char **p)
{
	char buf[MAX_STRING_LENGTH];
	VAR_DATA *target;

	if (!(target = getvar (mob, target_name)))
	{
		sprintf (buf, "Assignment to unknown variable: %s", target_name);
		system_log (buf, true);
		sprintf (buf, "trigger %s, mob %d", program->trigger_name,
			mob->mob->nVirtual);
		system_log (buf, true);
		program->line = duplicateString (current_line);
		program->flags  |= MPF_BROKEN;
		return;
	}

	if (!mob_get_token (p, buf, MT_EQUAL))
	{
		system_log ("Assignment needs equal.", true);
		program->line = duplicateString (current_line);
		program->flags |= MPF_BROKEN;
		return;
	}

	if (target->type == MP_TYPE_INTEGER)
	{
		target->value = mp_eval_eq (mob, p);
		return;
	}

	if (target->type == MP_TYPE_CHAR_DATA ||
		target->type == MP_TYPE_OBJ_DATA || target->type == MP_TYPE_ROOM_DATA)
	{
		target->value = mp_eval_eq (mob, p);
		return;
	}

	else if (target->type == MP_TYPE_STRING)
	{

		mob_string (mob, p, buf);

		if (target->value)
			free_mem ((char *) target->value);

		target->value = (long int) duplicateString (buf);
	}
}
Exemplo n.º 10
0
void PSInputStream::initialize(const char *fileName, DocumentCache *cache) {
	PDFInputStream::initialize(NULL, cache);

	if (statusCode != 0) {
		int convTime = currentTimeMillis();
		statusCode = executeCommand((char*)PS2PDF, fileName, tempFileName,
				INPUT_CONVERSION_TIMEOUT);
		if (statusCode == 0) {
			char *tempFile = duplicateString(tempFileName);
			PDFInputStream::initialize(tempFile, NULL);
			unlink(tempFile);
			free(tempFile);
			if ((statusCode == 0) && (cache != NULL)) {
				convTime = currentTimeMillis() - convTime;
				if (convTime < 0)
					convTime += 24 * 3600 * 1000;
				cache->addDocumentTextFromFile(originalFileName, tempFileName, convTime);
			}
		}
	} // end if (statusCode != 0)

	if (statusCode != 0) {
		inputFile = -1;
		unlink(tempFileName);
	}
} // end of initialize(char*, DocumentCache*)
Exemplo n.º 11
0
char * DesktopQuery::getText(offset start, offset end, bool removeNewLines) {
	if (end < start)
		return duplicateString("");
	char params[64];
	sprintf(params, OFFSET_FORMAT " " OFFSET_FORMAT, start, end);
	GetQuery *gq = new GetQuery(index, "get", EMPTY_MODIFIERS, params, visibleExtents, -1);
	gq->parse();
	char miscBuffer[FilteredInputStream::MAX_FILTERED_RANGE_SIZE + 32];
	int len = 0;
	miscBuffer[0] = 0;
	while (gq->getNextLine(&miscBuffer[len])) {
		if (len >= MIN(FilteredInputStream::MAX_FILTERED_RANGE_SIZE/2, 8192))
			break;
		char *p = miscBuffer;
		if (removeNewLines) {
			while ((p = strstr(p, "\n")) != NULL) {
				*p = ' ';
				p = &p[1];
			}
		}
		len += strlen(&miscBuffer[len]);
	}
	miscBuffer[len] = 0;
	return sanitize(miscBuffer);
} // end of getText(offset, offset, bool)
Exemplo n.º 12
0
VAR_DATA *
setvar (CHAR_DATA * mob, char *var_name, int value, int type)
{
	VAR_DATA *var;

	if (!(var = getvar (mob, var_name)))
	{

		var = new VAR_DATA;

		var->name = duplicateString (var_name);

		if (*var_name == '_')
		{
			var->next = global_vars;
			global_vars = var;
		}
		else
		{
			var->next = mob->vartab;
			mob->vartab = var;
		}
	}

	var->type = type;
	var->value = value;

	return var;
}
Exemplo n.º 13
0
void mob_data::deep_copy (mob_data *copy_from)
{
	memcpy(this, copy_from, sizeof(mob_data));

	if (copy_from->owner)
	{
		this->owner = duplicateString(copy_from->owner);
	}
}
Exemplo n.º 14
0
static void startWumpus() {
	char *exe = evaluateRelativePathName(wumpusDir, "bin/wumpus");
	char *configFile = evaluateRelativePathName(wumpusDir, "wumpus.cfg");
	configFile = concatenateStringsAndFree(duplicateString("--config="), configFile);
	char *passwordFile = evaluateRelativePathName(wumpusDir, "wumpus.passwd");
	passwordFile = concatenateStringsAndFree(duplicateString("PASSWORD_FILE="), passwordFile);
	char *baseDir = concatenateStrings("BASE_DIRECTORY=", homeDir);
	char *databaseDir = evaluateRelativePathName(homeDir, ".wumpusdb");
	databaseDir = concatenateStringsAndFree(duplicateString("DIRECTORY="), databaseDir);
	int fd = open("/dev/null", O_RDWR);
	if (fd > 0)
		dup2(fd, fileno(stdout));
	signal(SIGINT, SIG_IGN);
	execl(exe, exe, configFile, passwordFile, baseDir, databaseDir,
			"MONITOR_FILESYSTEM=false", "FSCHANGE_FILE=/dev/null", NULL);
	perror("startWumpus()");
	exit(1);
} // end of startWumpus()
Exemplo n.º 15
0
void CDRQuery::initialize(Index *index, const char *command, const char **modifiers, const char *body,
		VisibleExtents *visibleExtents, int memoryLimit) {
	this->index = index;
	this->visibleExtents = visibleExtents;
	this->memoryLimit = memoryLimit;
	processModifiers(modifiers);
	queryString = duplicateString(body);
	actualQuery = this;
	ok = false;
} // end of initialize(Index*, char*, char**, char*, VisibleExtents*, int)
Exemplo n.º 16
0
int QueryTokenizer::getTokenCount() {
	int oldInputPosition = inputPosition;
	char *oldSequence = duplicateString(sequence);
	int result = 0;
	while (getNext() != NULL)
		result++;
	inputPosition = oldInputPosition;
	free(sequence);
	sequence = oldSequence;
	return result;
} // end of getTokenCount()
Exemplo n.º 17
0
CompactIndex::CompactIndex(Index *owner, const char *fileName) {
	this->owner = owner;
	this->fileName = duplicateString(fileName);
	this->compressor = compressorForID[indexCompressionMode];
	this->use_O_DIRECT = use_O_DIRECT;
	baseFile = NULL;
	inMemoryIndex = NULL;

	initializeForQuerying();
	loadIndexIntoMemory();
} // end of CompactIndex(Index*, char*)
Exemplo n.º 18
0
char *chop(char *s) {
	if (s == NULL)
		return NULL;
	while ((*s > 0) && (*s <= ' '))
		s = &s[1];
	s = duplicateString(s);
	int len = strlen(s);
	while ((len > 1) && (s[len - 1] > 0) && (s[len - 1] <= ' '))
		len = len - 1;
	s[len] = 0;
	return s;
} // end of chop(char*)
Exemplo n.º 19
0
void appendString( char **aString, char *aAddString )
{
	char *string;

	if( *aString == NULL ) {
		*aString = duplicateString( aAddString );
	} else {
		string = concatenateStrings( *aString, aAddString );
		freeString( aString );
		*aString = string;
	}
}
Exemplo n.º 20
0
void pc_data::deep_copy (pc_data *copy_from)
{
	memcpy(this, copy_from, sizeof(pc_data));

	if (copy_from->creation_comment)
	{
		this->creation_comment = duplicateString(copy_from->creation_comment);
	}

	if (copy_from->imm_enter)
	{
		this->imm_enter = duplicateString(copy_from->imm_enter);
	}

	if (copy_from->imm_leave)
	{
		this->imm_leave = duplicateString(copy_from->imm_leave);
	}

	if (copy_from->site_lie)
	{
		this->site_lie = duplicateString(copy_from->site_lie);
	}

	if (copy_from->account_name)
	{
		this->account_name = duplicateString(copy_from->account_name);
	}

	if (copy_from->msg)
	{
		this->msg = duplicateString(copy_from->msg);
	}
}
Exemplo n.º 21
0
void
define_variable (CHAR_DATA * mob, MOBPROG_DATA * program, char *argument)
{
	char var_type[MAX_STRING_LENGTH];
	char var_name[MAX_STRING_LENGTH];
	int type = 0;

	argument = one_argument (argument, var_type);

	if (!str_cmp (var_type, "integer"))
		type = MP_TYPE_INTEGER;
	else if (!str_cmp (var_type, "char_data"))
		type = MP_TYPE_CHAR_DATA;
	else if (!str_cmp (var_type, "obj_data"))
		type = MP_TYPE_OBJ_DATA;
	else if (!str_cmp (var_type, "room_data"))
		type = MP_TYPE_ROOM_DATA;
	else if (!str_cmp (var_type, "string"))
		type = MP_TYPE_STRING;
	else
	{
		system_log ("Mob program with a variable problem.", true);
		program->line = duplicateString (current_line);
		program->flags |= MPF_BROKEN;
	}

	argument = one_argument (argument, var_name);

	if (!*var_name)
	{
		system_log ("Variable name problem; no var_name.", true);
		program->line = duplicateString (current_line);
		program->flags |= MPF_BROKEN;
	}

	if (!getvar (mob, var_name))
		setvar (mob, var_name, 0, type);
}
Exemplo n.º 22
0
void BM25Query::initialize(Index *index, const char *command, const char **modifiers,
		const char *body, VisibleExtents *visibleExtents, int memoryLimit) {
	this->index = index;
	this->visibleExtents = visibleExtents;
	this->memoryLimit = memoryLimit;

	getConfigurationDouble("OKAPI_K1", &k1, DEFAULT_K1);
	getConfigurationDouble("OKAPI_B", &b, DEFAULT_B);
	processModifiers(modifiers);

	queryString = duplicateString(body);
	actualQuery = this;
	ok = false;
} // end of initialize(...)
Exemplo n.º 23
0
int main(int argc, char **argv) {
	// Extract Wumpus base directory from path name of executable. We need this
	// to find the config file and all the executables.
	wumpusDir = duplicateString(argv[0]);
	int len = strlen(wumpusDir);
	if (len > 0) {
		while (wumpusDir[len - 1] != '/')
			wumpusDir[--len] = 0;
		if (endsWith(wumpusDir, "bin/"))
			wumpusDir = concatenateStringsAndFree(wumpusDir, duplicateString(".."));
	}
	homeDir = getenv("HOME");

	// Now, we need to do 4 things:
	//  1. start inotifyd
	//  2. start Wumpus
	//  3. start HTTP server
	//  4. make sure the output of inotifyd is fed into Wumpus

	startWumpusAndInotifyd();

	startHttpServer();

	// install new signal handler for SIGINT
	signal(SIGINT, sigintHandler);
	signal(SIGTERM, sigintHandler);
	while (inotifydPID != 0)
		sleep(1);
	fprintf(stderr, "Wumpus is shutting down. Please wait...\n");
	
	kill(httpdPID, SIGKILL);
	waitpid(httpdPID, NULL, 0);
	waitpid(transformPID, NULL, 0);
	waitpid(wumpusPID, NULL, 0);

	return 0;
} // end of main(int, char**)
Exemplo n.º 24
0
bool Command::bindKey(
		char		*keyn,
		char		*line
	)
{
	u32 i, j;

	if (!line || *line == 0) {
		REPORT_WARNING("No string given");
		return false;
	}

	for (i = 0; i < RC_KEY_LAST; i++) {
		if (key_name[i] && strcmp(keyn, key_name[i]) == 0) {
			break;
		}
	}

	if (i == RC_KEY_LAST) {
		REPORT_WARNING("Couldn't bind key - key name \"%s\"not found", keyn);
		return false;
	}

	for (j = 0; j < n_bindings; j++) {
		if (binding[j].key == i) {
			free(binding[j].line);

			binding[j].line = duplicateString(line);
			return true;
		}
	}

	binding[n_bindings].line = duplicateString(line);
	binding[n_bindings].key = i;
	n_bindings++;
	return true;
}
Exemplo n.º 25
0
/**
* Allocates a new email.
*
* Creates a new email. This function receives the email address, retrieves the
* new email element pointer in the out pointer parameter.
*
* @param address the email address.
* @param result pointer to save the result email in
*
* @return
*
* 	EMAIL_NULL_PARAMETERS - if email address or pointer are NULL.
*
* 	EMAIL_INVALID_PARAMETERS - address contains no AT_SIGN character.
*
* 	EMAIL_OUT_OF_MEMORY - if allocations failed.
*
* 	EMAIL_SUCCESS - in case of success.  A new email is saved in the result.
*/
EmailResult emailCreate(char* address, Email* result) {
	if (address == NULL || result == NULL) return EMAIL_NULL_PARAMETERS;
	if (countSign(address, AT_SIGN) != 1) return EMAIL_INVALID_PARAMETERS;
	char* adress_copy = duplicateString(address);
	if (adress_copy == NULL) return EMAIL_OUT_OF_MEMORY;
	Email mail = malloc(sizeof(*mail));
	if (mail == NULL) {
		free(adress_copy);
		return EMAIL_OUT_OF_MEMORY;
	} else {
		mail->address = adress_copy;
		*result = mail;
		return EMAIL_SUCCESS;
	}
}
Exemplo n.º 26
0
char * LanguageModel::normalizeTerm(char *term) {
	LocalLock lock(this);
	if (term == NULL)
		return NULL;
	if (term[0] == 0)
		return duplicateString(term);
	if (term[0] == '$')
		term++;
	int len = strlen(term);
	if ((stemmed) && (strchr(term, '$') == NULL)) {
		char temp[MAX_TOKEN_LENGTH + 1];
		snprintf(temp, MAX_TOKEN_LENGTH - 1, "%s", term);
		temp[MAX_TOKEN_LENGTH] = temp[MAX_TOKEN_LENGTH - 1] = 0;
		Stemmer::stem(temp, LANGUAGE_ENGLISH, useStemmingCache);
		if (temp[0] == 0) {
			snprintf(temp, MAX_TOKEN_LENGTH, "%s$", term);
			temp[MAX_TOKEN_LENGTH] = 0;
		}
		else
			strcat(temp, "$");
		return duplicateString(temp);
	}
	return duplicateString(term);
} // end of normalizeTerm(char*)
Exemplo n.º 27
0
STDMETHODIMP CAna2Xml::put_LogFileName(BSTR newVal)
{
  if (newVal == NULL)
	{
	  return E_INVALIDARG;
	}
  char * pszTemp;
  HRESULT hr = ConvertBstrToString(newVal, CP_ACP, &pszTemp);
  if (FAILED(hr))
	{
	  return hr;
	}
  m_AnaData.pszLogFile = duplicateString(pszTemp);
  free(pszTemp);
  return S_OK;
}
Exemplo n.º 28
0
QueryTokenizer::QueryTokenizer(const char *arguments) {
	sequence = duplicateString(arguments);
	inputPosition = 0;
	if (sequence == NULL)
		inputLength = 0;
	else {
		byte *b = (byte*)sequence;
		inputLength = strlen(sequence);
		if ((inputLength == 1) && (b[0] <= 32))
			inputLength = 0;
		else {
			while ((inputLength > 1) && (b[inputLength - 1] <= 32))
				inputLength--;
			while ((sequence[inputPosition] > 0) && (sequence[inputPosition] <= 32))
				inputPosition++;
		}
	}
} // end of QueryTokenizer(char*)
Exemplo n.º 29
0
ConversionInputStream::ConversionInputStream(
		const char *fileName, const char *conversionTool) {
	assert(fileName != NULL);
	originalFileName = duplicateString(fileName);
	sprintf(tempFileName, "%s/%s", TEMP_DIRECTORY, "index-conversion-XXXXXXXX.txt");
	randomTempFileName(tempFileName);
	char command[1024];
	sprintf(command, "%s < %s > %s", conversionTool, originalFileName, tempFileName);
	statusCode = MIN(0, system(command));
	if (statusCode != 0) {
		inputFile = -1;
		unlink(tempFileName);
	}
	else {
		inputFile = open(tempFileName, O_RDONLY);
		initialize();
	}
}
Exemplo n.º 30
0
char *
fread_action (FILE * fl)
{
	char buf[MAX_STRING_LENGTH] = { '\0' };

	fgets (buf, MAX_STRING_LENGTH, fl);
	if (feof (fl))
	{
		system_log ("Fread_action() - unexpected EOF!", true);
		abort ();
	}

	if (*buf == '#')
		return 0;

	buf[strlen (buf) - 1] = '\0';

	return duplicateString (buf);
}