Changeset - a04225d4bde8
[Not reviewed]
default
0 2 0
Nathan Brink (binki) - 16 years ago 2009-08-02 01:22:08
ohnobinki@ohnopublishing.net
removed all int_to_str()
2 files changed with 15 insertions and 17 deletions:
0 comments (0 inline, 0 general)
src/server/slavefuncs.c
Show inline comments
 
@@ -19,12 +19,13 @@
 

	
 
 /*
 
  * Registration on server. Needs attention. Prevent account spamming.
 
  * distrenslave -c username email@example.com
 
 */
 

	
 
#include "asprintf.h"
 
#include "slavefuncs.h"
 
#include "blendjob.h"
 
#include "execio.h"
 

	
 
#include <curl/curl.h>
 
#include <curl/types.h>
 
@@ -106,18 +107,12 @@ int curlpost(char *filename, char *url){
 
    curl_formfree(formpost);
 
    curl_slist_free_all (headerlist);
 
  }
 
  return 0;
 
}
 

	
 
/** Converts an integer to a string, currently a stub. */
 
char *int_to_str(int nbr)
 
{
 
 return(NULL);
 
}
 

	
 
/** Generates a SSH key with ssh-keygen */
 
int ssh_keygen(){
 
	/* Checks to see if the keys are already present. */
 
	int status;
 
	struct stat buffer;
 
	status = stat(SYSCONFDIR "/distren.id_rsa", &buffer);
 
@@ -315,24 +310,28 @@ return 1; // Success
 
  It seems that the client will need to know the job number. fixme.
 
*/
 

	
 
/** Executor function for Blender operations */
 
void exec_blender(struct blendjob* blendjob, char *input, char *output, int frame)
 
{
 
	char *frame_str = int_to_str(frame); // Converts the int frame to a string, so it can be in the cmd array.
 
  int ret;
 
  char *frame_str;
 
  
 
  /* start execio code */
 
  	char *command = "blender"; // @TODO: append .exe if win32?
 
  	int ret;
 
    char *cmd[] = { command, "-b", "-o", output, input, "-f", frame_str, (char *)NULL };
 
  char *command = "blender"; // @TODO: append .exe if win32?
 
  char *cmd[] = { command, "-b", "-o", output, input, "-f", frame_str, (char *)NULL };
 
  
 
  char buf[10];
 
  struct execio *testrem;
 
  size_t readlen;
 

	
 
  	char buf[10];
 
  	struct execio *testrem;
 
  	size_t readlen;
 
  	ret = execio_open(&testrem, command, cmd); // This path will be absolute for testing, should be relative to install on production
 
  	buf[9] = '\0'; // null-terminating the array...
 
  	while(!execio_read(testrem, buf, 9, &readlen))
 
  _distren_asprintf(&frame_str, "%i", frame);
 

	
 
  ret = execio_open(&testrem, command, cmd); // This path will be absolute for testing, should be relative to install on production
 
  buf[9] = '\0'; // null-terminating the array...
 
  while(!execio_read(testrem, buf, 9, &readlen))
 
  	    {
 
  	      if(readlen > 9) {
 
  		fprintf(stderr, "Something is terribly wrong!\n");
 
  	      }
 
  	      buf[readlen] = '\0';
 
  	      fprintf(stderr, "read \"%s\"\n", buf);
src/server/slavefuncs.h
Show inline comments
 
@@ -23,13 +23,12 @@
 
#include <stdio.h>
 

	
 

	
 
size_t curl_writetodisk(void *ptr, size_t size, size_t nmemb, FILE *stream);
 
int curlget(char *url, char *out);
 
int curlpost(char *filename, char *url);
 
char *int_to_str(int nbr);
 
int ssh_keygen();
 
int register_user(char *username, char *email);
 
int login_user(char *username);
 
int conf_replace(char *username);
 
void exec_blender(struct blendjob* blendjob, char *input, char *output, int frame);
 

	
0 comments (0 inline, 0 general)