~gnaservicesinc/vanquita/trunk

« back to all changes in this revision

Viewing changes to src/vaq_spawn.c

  • Committer: GNAServicesInc
  • Date: 2014-01-13 23:29:31 UTC
  • Revision ID: andrew@gnaservicesinc.com-20140113232931-09mmd3502b3xxpk0
Initial Release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*-  */
 
2
/********************************************************************************* 
 
3
 *     COPYRIGHT NOTICE:
 
4
 *     Copyright © 2014  Andrew Smith (GNA SERVICES INC)<Andrew@GNAServicesInc.com>
 
5
 *     All Rights Reserved.
 
6
 *
 
7
 *   This file, vaq_spawn.c, is part of Vaquita.
 
8
 *
 
9
 *   Vaquita is free software: you can redistribute it and/or modify
 
10
 *   it under the terms of the GNU General Public License as published by
 
11
 *   the Free Software Foundation, either version 3 of the License, or
 
12
 *  (at your option) any later version.
 
13
 *
 
14
 *   Vaquita is distributed in the hope that it will be useful,
 
15
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 *   GNU General Public License for more details.
 
18
 *
 
19
 *  You should have received a copy of the GNU General Public License
 
20
 *  along with tpad.  If not, see <http://www.gnu.org/licenses/>.
 
21
 ********************************************************************************/
 
22
#include "inc.h"
 
23
#include "vaq_head.h"
 
24
 
 
25
 
 
26
extern gchar* SelfPath;
 
27
gchar* SelfPath;
 
28
 
 
29
void *vaq_spawn_command(void *ptr){
 
30
        gchar *file_open_new_path=NULL;
 
31
        file_open_new_path = (gchar *) g_strdup((gchar*)ptr);
 
32
        if(fork() == 0)exit(execl("/bin/sh","sh","-c", (gchar*) g_strconcat(SelfPath," ",file_open_new_path,NULL), (gchar*) NULL));
 
33
        return(0);
 
34
}
 
35
gint new_thread_vaq (gchar *file){
 
36
        pthread_t thread;
 
37
        gint  iThreadReturn;
 
38
        iThreadReturn = pthread_create(&thread,
 
39
                                       NULL,
 
40
                                       vaq_spawn_command,
 
41
                                       (void*) file);
 
42
        pthread_join(thread, NULL);
 
43
        return(iThreadReturn);
 
44
}
 
 
b'\\ No newline at end of file'