当前位置: 首页>>代码示例>>C++>>正文


C++ smbc_init函数代码示例

本文整理汇总了C++中smbc_init函数的典型用法代码示例。如果您正苦于以下问题:C++ smbc_init函数的具体用法?C++ smbc_init怎么用?C++ smbc_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了smbc_init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: open_f

static int open_f (stream_t *stream, int mode, void *opts, int* file_format) {
  struct stream_priv_s *p = (struct stream_priv_s*)opts;
  char *filename;
  mode_t m = 0;
  off_t len;
  int fd, err;

  filename = stream->url;

  if(mode == STREAM_READ)
    m = O_RDONLY;
  else if (mode == STREAM_WRITE) //who's gonna do that ?
    m = O_RDWR|O_CREAT|O_TRUNC;
  else {
    mp_msg(MSGT_OPEN, MSGL_ERR, "[smb] Unknown open mode %d\n", mode);
    m_struct_free (&stream_opts, opts);
    return STREAM_UNSUPPORTED;
  }

  if(!filename) {
    mp_msg(MSGT_OPEN,MSGL_ERR, "[smb] Bad url\n");
    m_struct_free(&stream_opts, opts);
    return STREAM_ERROR;
  }

  err = smbc_init(smb_auth_fn, 1);
  if (err < 0) {
    mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_SMBInitError,err);
    m_struct_free(&stream_opts, opts);
    return STREAM_ERROR;
  }

  fd = smbc_open(filename, m,0644);
  if (fd < 0) {
    mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_SMBFileNotFound, filename);
    m_struct_free(&stream_opts, opts);
    return STREAM_ERROR;
  }

  stream->flags = mode;
  len = 0;
  if(mode == STREAM_READ) {
    len = smbc_lseek(fd,0,SEEK_END);
    smbc_lseek (fd, 0, SEEK_SET);
  }
  if(len > 0 || mode == STREAM_WRITE) {
    stream->flags |= MP_STREAM_SEEK;
    stream->seek = seek;
    if(mode == STREAM_READ) stream->end_pos = len;
  }
  stream->type = STREAMTYPE_SMB;
  stream->fd = fd;
  stream->fill_buffer = fill_buffer;
  stream->write_buffer = write_buffer;
  stream->close = close_f;
  stream->control = control;

  m_struct_free(&stream_opts, opts);
  return STREAM_OK;
}
开发者ID:NeeMeese,项目名称:mplayer-ce,代码行数:60,代码来源:stream_smb.c

示例2: main

int main(int argc, char** argv)
{
	int err = -1;
	int fd = 0;
	char url[MAX_BUFF_SIZE];
	struct stat st;

	memset(g_workgroup, '\0', MAX_BUFF_SIZE);
	memset(url, '\0', MAX_BUFF_SIZE);

	if ( argc == 5 )
	{
		
		strncpy(g_workgroup,argv[1],strlen(argv[1]));
		strncpy(g_username,argv[2],strlen(argv[2]));
		strncpy(g_password,argv[3],strlen(argv[3]));
		strncpy(url,argv[4],strlen(argv[4]));

		smbc_init(auth_fn, 0);
		fd = smbc_open(url,O_RDWR | O_CREAT, 0666);
		smbc_close(fd);

		smbc_stat(url, &st);

		err = errno;

		
	}

	return err;

}
开发者ID:sprymak,项目名称:samba,代码行数:32,代码来源:stat_4.c

示例3: get_smb_server_fd

int get_smb_server_fd(struct SMB_DS *ds, char* filename)
{
	int ret, fd, i;
	char buf[256+1];
	ret = smbc_init(smb_auth_fn, 0);NE_ERR(ret, 0);
	for(i=0;i<strlen(ds->path);i++)
	{
		if(ds->path[i]=='\\')
			ds->path[i] = '/';
	}
	sprintf(buf, "smb://%s/%s/%s", ds->server, ds->path, filename);
	buf[256]='\0';
	//fprintf(stderr, "%s\n", buf);
	if(ds->user[0]!='\0')
		strcpy(smb_username, ds->user);
	else
		strcpy(smb_username, "dummy");
	strcpy(smb_password, ds->passwd);
	
	//fprintf(stderr, "%s %s\n", smb_username, smb_password);

	fd = smbc_open(buf, O_RDWR | O_CREAT | O_TRUNC, 0666);EQ_ERR(fd, -1);
	return fd;
errout:
        if(fd != -1)
		smbc_close(fd);
	return -1;
}
开发者ID:niubl,项目名称:camera_project,代码行数:28,代码来源:smbc_put.c

示例4: main

int main(int argc, char** argv)
{
	int err = -1;
	char url[MAX_BUFF_SIZE];

	bzero(g_workgroup,MAX_BUFF_SIZE);
	bzero(url,MAX_BUFF_SIZE);

	if ( argc == 5 )
	{
		strncpy( g_workgroup, argv[1], strlen(argv[1]) );
		strncpy( g_username, argv[2], strlen(argv[2]) );
		strncpy( g_password, argv[3], strlen(argv[3]) );
		strncpy( url, argv[4], strlen(argv[4]) );

		smbc_init( auth_fn, 0 );
		smbc_rmdir( url );

		smbc_mkdir( url, 0666 );
		smbc_mkdir( url, 0666 );

		err = errno;	


	}

	return err;

}
开发者ID:0x24bin,项目名称:winexe-1,代码行数:29,代码来源:mkdir_3.c

示例5: main

int main(int argc, char** argv)
{
	int err = -1;
	int fd = 0;
	char url[MAX_BUFF_SIZE];

	bzero(g_workgroup,MAX_BUFF_SIZE);
	bzero(url,MAX_BUFF_SIZE);

	if ( argc == 5 )
	{

		strncpy(g_workgroup,argv[1],strlen(argv[1]));
		strncpy(g_username,argv[2],strlen(argv[2]));
		strncpy(g_password,argv[3],strlen(argv[3]));
		strncpy(url,argv[4],strlen(argv[4]));
	
		smbc_init(auth_fn, 0);
		smbc_unlink(url);
		fd = smbc_open(url,O_RDWR|O_CREAT,0666);
		smbc_close(fd);

		smbc_opendir(url);

		err = errno;


	}

	return err;

}
开发者ID:0x24bin,项目名称:winexe-1,代码行数:32,代码来源:opendir_4.c

示例6: main

int main(int argc, char* argv[])
{
        int             fd;
        struct stat     st1;
        struct stat     st2;
        char *          pUrl = argv[1];

        if(argc != 2)
        {
                printf("usage: %s <file_url>\n", argv[0]);
                return 1;
        }

        
        smbc_init(get_auth_data_fn, 0);
        
        if (smbc_stat(pUrl, &st1) < 0)
        {
                perror("smbc_stat");
                return 1;
        }
        
        if ((fd = smbc_open(pUrl, O_RDONLY, 0)) < 0)
        {
                perror("smbc_open");
                return 1;
        }

        if (smbc_fstat(fd, &st2) < 0)
        {
                perror("smbc_fstat");
                return 1;
        }
        
        smbc_close(fd);

#define COMPARE(name, field)                                            \
        if (st1.field != st2.field)                                     \
        {                                                               \
                printf("Field " name " MISMATCH: st1=%lu, st2=%lu\n",   \
                       (unsigned long) st1.field,                       \
                       (unsigned long) st2.field);                      \
        }

        COMPARE("st_dev", st_dev);
        COMPARE("st_ino", st_ino);
        COMPARE("st_mode", st_mode);
        COMPARE("st_nlink", st_nlink);
        COMPARE("st_uid", st_uid);
        COMPARE("st_gid", st_gid);
        COMPARE("st_rdev", st_rdev);
        COMPARE("st_size", st_size);
        COMPARE("st_blksize", st_blksize);
        COMPARE("st_blocks", st_blocks);
        COMPARE("st_atime", st_atime);
        COMPARE("st_mtime", st_mtime);
        COMPARE("st_ctime", st_ctime);

        return 0;
}
开发者ID:AIdrifter,项目名称:samba,代码行数:60,代码来源:teststat3.c

示例7: main

int main(int argc, char** argv)
{
	int err = -1;
	char url[MAX_BUFF_SIZE];

	memset(g_workgroup, '\0', MAX_BUFF_SIZE);
	memset(url, '\0', MAX_BUFF_SIZE);

	if ( argc == 5 )
	{

		strncpy(g_workgroup,argv[1],strlen(argv[1]));
		strncpy(g_username,argv[2],strlen(argv[2]));
		strncpy(g_password,argv[3],strlen(argv[3]));
		strncpy(url,argv[4],strlen(argv[4]));

		smbc_init(auth_fn, 0);
		err = smbc_unlink(url);

		if ( err < 0 )
			err = 1;


	}

	return 1;

}
开发者ID:sprymak,项目名称:samba,代码行数:28,代码来源:unlink_9.c

示例8: main

int main(int argc, char** argv)
{
	int err = -1;
	char url[MAX_BUFF_SIZE];

	memset(g_workgroup, '\0', MAX_BUFF_SIZE);
	memset(url, '\0', MAX_BUFF_SIZE);

	if ( argc == 6 )
	{
		strncpy(g_workgroup,argv[1],strlen(argv[1]));
		strncpy(g_username,argv[2],strlen(argv[2]));
		strncpy(g_password,argv[3],strlen(argv[3]));
		strncpy(url,argv[4],strlen(argv[4]));

		smbc_init(auth_fn, 0);
		smbc_rename( url, argv[5] );

		err = errno;

	}

	return err;

}
开发者ID:sprymak,项目名称:samba,代码行数:25,代码来源:rename_2.c

示例9: main

int main(int argc, char** argv)
{
	int err = -1;
	int fd = 0;
	char* message = "Testing";

	memset(g_workgroup, '\0', MAX_BUFF_SIZE);

	if ( argc == 4 )
	{
		
		strncpy(g_workgroup,argv[1],strlen(argv[1]));
		strncpy(g_username,argv[2],strlen(argv[2]));
		strncpy(g_password,argv[3],strlen(argv[3]));

		fd = 10345; /* Random value for File Descriptor */
		smbc_init(auth_fn, 0);
		err = smbc_read(fd, message, sizeof(message));

		if ( err < 0 )
			err = 1;

		else
			err = 0;

	}

	return err;

}
开发者ID:sprymak,项目名称:samba,代码行数:30,代码来源:read_7.c

示例10: main

int main(int argc, char** argv)
{
	int err = -1;
	int fd1 = 0;
	char url[MAX_BUFF_SIZE];

	memset(g_workgroup, '\0', MAX_BUFF_SIZE);
	memset(url, '\0', MAX_BUFF_SIZE);

	if ( argc == 5 )
	{
		strncpy( g_workgroup, argv[1], strlen(argv[1]) );
		strncpy( g_username, argv[2], strlen(argv[2]) );
		strncpy( g_password, argv[3], strlen(argv[3]) );
		strncpy( url, argv[4], strlen(argv[4]) );

		smbc_init( auth_fn, 0 );
		fd1 = smbc_open( url, O_RDWR | O_CREAT, 0666 );
		smbc_close( fd1 );

		err = smbc_rmdir( url );

		if ( err < 0 )
			err = 1;

		else
			err = 0;	


	}

	return err;

}
开发者ID:sprymak,项目名称:samba,代码行数:34,代码来源:rmdir_5.c

示例11: main

int main(int argc, char** argv)
{
	int err = -1;
	int fd = 0;

	bzero(g_workgroup,MAX_BUFF_SIZE);

	if ( argc == 4 )
	{
		
		strncpy(g_workgroup,argv[1],strlen(argv[1]));
		strncpy(g_username,argv[2],strlen(argv[2]));
		strncpy(g_password,argv[3],strlen(argv[3]));

		smbc_init(auth_fn, 0);

		fd = -1;
		err = smbc_lseek(fd, 0, SEEK_SET);

		if ( err < 0 )
			err = 1;

		else
			err = 0;

		
	}

	return err;

}
开发者ID:0x24bin,项目名称:winexe-1,代码行数:31,代码来源:lseek_1.c

示例12: main

int main(int argc, char** argv)
{
	int err = -1;
	int fd = 0;

	memset(g_workgroup, '\0', MAX_BUFF_SIZE);

	if ( argc == 4 )
	{
		
		strncpy(g_workgroup,argv[1],strlen(argv[1]));
		strncpy(g_username,argv[2],strlen(argv[2]));
		strncpy(g_password,argv[3],strlen(argv[3]));

		smbc_init(auth_fn, 0);

		fd = -1;
		smbc_lseek(fd, 0, SEEK_SET);

		err = errno;

		
	}

	return err;

}
开发者ID:sprymak,项目名称:samba,代码行数:27,代码来源:lseek_2.c

示例13: main

int main(int argc, char** argv)
{
	int err = -1;
	int dh = 0; 
	char url[MAX_BUFF_SIZE];

	bzero(g_workgroup,MAX_BUFF_SIZE);
	bzero(url,MAX_BUFF_SIZE);

	if ( argc == 5 )
	{

		strncpy(g_workgroup,argv[1],strlen(argv[1]));
		strncpy(g_username,argv[2],strlen(argv[2]));
		strncpy(g_password,argv[3],strlen(argv[3]));
		strncpy(url,argv[4],strlen(argv[4]));

		smbc_init(auth_fn, 0);
		dh = smbc_opendir(url);
		/* printf("directory handle: %i\n",dh); */
		smbc_closedir(dh);

		err = errno;


	}

	return err;

}
开发者ID:0x24bin,项目名称:winexe-1,代码行数:30,代码来源:closedir_4.c

示例14: main

int main(int argc, char** argv)
{
	int err = -1;
	int fd = 0; 
	char url[MAX_BUFF_SIZE];

	memset(g_workgroup, '\0', MAX_BUFF_SIZE);
	memset(url, '\0', MAX_BUFF_SIZE);

	if ( argc == 5 )
	{

		strncpy(g_workgroup,argv[1],strlen(argv[1]));
		strncpy(g_username,argv[2],strlen(argv[2]));
		strncpy(g_password,argv[3],strlen(argv[3]));
		strncpy(url,argv[4],strlen(argv[4]));

		fd = smbc_init(auth_fn, 0);

		if ( fd < 0 )
			err = 1;

		else
			err = 0;

	}

	return err;

}
开发者ID:sprymak,项目名称:samba,代码行数:30,代码来源:chown_1.c

示例15: main

int main(int argc, char** argv)
{
	int err = -1;

	char url[MAX_BUFF_SIZE];
	bzero(g_workgroup,MAX_BUFF_SIZE);
	bzero(url,MAX_BUFF_SIZE);

	if ( argc == 6 )
	{
		
		strncpy(g_workgroup,argv[1],strlen(argv[1]));
		strncpy(g_username,argv[2],strlen(argv[2]));
		strncpy(g_password,argv[3],strlen(argv[3]));
		strncpy(url,argv[4],strlen(argv[4]));

		smbc_init(auth_fn, 0);
		err = smbc_print_file(url,argv[6]);

		if ( err < 0 )
			err = 1;

		else
			err = 0;

	}

	return err;

}
开发者ID:srimalik,项目名称:samba,代码行数:30,代码来源:print_file_3.c


注:本文中的smbc_init函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。