Beispiel #1
0
/* event_whois_host: 338, 616

   Example:
     :irc.server.com 338 <issuer> <target> <IP> :actually using host
     :irc.server.com 338 <issuer> <target> :is actually <user@host> [<IP>]
     :irc.server.com 616 <issuer> <target> :real hostname ... */
void
event_whois_host(struct irc_message_compo *compo)
{
    PRINTTEXT_CONTEXT ctx;
    char *state = "";
    char *str, *str_copy, *cp;

    if (strFeed(compo->params, 2) != 2) {
	goto bad;
    }

    (void) strtok_r(compo->params, "\n", &state);
    (void) strtok_r(NULL, "\n", &state);

    if ((str = strtok_r(NULL, "\n", &state)) == NULL) {
	goto bad;
    }

    str_copy = sw_strdup(str);
    cp       = &str_copy[0];
    squeeze(str_copy, ":");

    printtext_context_init(&ctx, g_active_window, TYPE_SPEC1, true);
    printtext(&ctx, "%s %s", Theme("whois_host"), cp);
    free(str_copy);
    return;

  bad:
    printtext_context_init(&ctx, g_status_window, TYPE_SPEC1_WARN, true);
    printtext(&ctx, "On issuing event %s: An error occurred", compo->command);
}
Beispiel #2
0
main()
{
    char a[]="qwerrtyu";
    char b[]="qux";
    squeeze(a,b);
    printf("%s\n",a);
}
Beispiel #3
0
int main( void )
{
	int c; // Character
	char s[ MAXLEN ]; // source String
	char ss[ MAXLEN ]; // squeeze String
	int pos = 0; // POSition

	ss[ 0 ] = 'a';
	ss[ 1 ] = 'b';
	ss[ 2 ] = 'c';
	ss[ 3 ] = 'd';
	ss[ 4 ] = NUL;

	while( ( c = getchar() ) != EOF )
	{
		if( c == '\n' || pos == MAXLEN - 1 )
		{
			s[ pos ] = NUL;
			squeeze( s, ss );
			printf( "%s\n", s );
			pos = 0;
		}
		else
		{
			s[ pos++ ] = c;
		}
	}

	return 0;
}
Beispiel #4
0
static void callback(SLBufferQueueItf bufq, void *param)
{
    assert(NULL == param);
    if (!eof) {
        short *buffer = &buffers[framesPerBuffer * sfinfo.channels * which];
        sf_count_t count;
        count = sf_readf_short(sndfile, buffer, (sf_count_t) framesPerBuffer);
        if (0 >= count) {
            eof = SL_BOOLEAN_TRUE;
        } else {
            SLuint32 nbytes = count * sfinfo.channels * sizeof(short);
            if (byteOrder != nativeByteOrder) {
                swab(buffer, buffer, nbytes);
            }
            if (bitsPerSample == 8) {
                squeeze(buffer, (unsigned char *) buffer, nbytes);
                nbytes /= 2;
            }
            SLresult result = (*bufq)->Enqueue(bufq, buffer, nbytes);
            assert(SL_RESULT_SUCCESS == result);
            if (++which >= numBuffers)
                which = 0;
        }
    }
}
Beispiel #5
0
main(){

	char s1[] = "abcdefghijklmnopqrstuvwxyz";
	char s2[] = "ahjk";

	squeeze(s1, s2);
}
Beispiel #6
0
static void callback(SLBufferQueueItf bufq, void *param)
{
    assert(NULL == param);
    if (!eof) {
        void *buffer = (char *)buffers + framesPerBuffer * sfframesize * which;
        ssize_t count = pipeReader->read(buffer, framesPerBuffer, (int64_t) -1);
        // on underrun from pipe, substitute silence
        if (0 >= count) {
            memset(buffer, 0, framesPerBuffer * sfframesize);
            count = framesPerBuffer;
            ++underruns;
        }
        if (count > 0) {
            SLuint32 nbytes = count * sfframesize;
            if (byteOrder != nativeByteOrder) {
                swab(buffer, buffer, nbytes);
            }
            if (transferFormat == AUDIO_FORMAT_PCM_8_BIT) {
                squeeze((short *) buffer, (unsigned char *) buffer, nbytes);
                nbytes /= 2;
            } else if (transferFormat == AUDIO_FORMAT_PCM_24_BIT_PACKED) {
                squeeze24((unsigned char *) buffer, (unsigned char *) buffer, nbytes);
                nbytes = nbytes * 3 / 4;
            }
            SLresult result = (*bufq)->Enqueue(bufq, buffer, nbytes);
            assert(SL_RESULT_SUCCESS == result);
            if (++which >= numBuffers)
                which = 0;
        }
    }
}
Beispiel #7
0
int main(int argc, char **argv) {
  char *input = argv[1];
  char *to_remove = argv[2];

  squeeze(input, to_remove);
  printf("%s\n", input);
}
Beispiel #8
0
int main() {
  char input[] = "yellow moon";
  squeeze(input, "lo");
  puts(input);

  return 0;
}
int main(void)
{
	char string[MAXSIZE];
	get_string(string, MAXSIZE);
	squeeze(string, getchar());
	printf("%s\n", string);
	return 0;
}
Beispiel #10
0
int main(void) {
	char s1[] = "abcdefg";
	char s2[] = "cd";
	squeeze(s1, s2);
	printf("%s\n", s1);

	return 0;	
}
void main()
{
    char s[] = "ab12cd34ef56";
    char c[] = "a1";

    squeeze(s,c);
    printf("%s", s);
}
Beispiel #12
0
int main(void)
{
	char s1[] = "123456";
	char s2[] = "345678";
	squeeze(s1, s2);
	printf("%s\n", s1);
	return 0;
}
Beispiel #13
0
main()
{
	char string[] = "abcdecfe";
	int i = 97;
	squeeze(string, i);
	printf("%s\n",string);
	return 0;
}
Beispiel #14
0
int main()
{
    char s1[] = "asdfghjk";
    char s2[] = "adf";
    squeeze(s1, s2);
    printf("s1 is %s", s1);
    return 0;
}
Beispiel #15
0
main()
{
	char s[MAX];
	char t[MAX];
	scanf("%s %s",s,t);
	squeeze(s,t);
	printf("%s\n",s);
}
Beispiel #16
0
int main() {
    char s1[] = "hello world";
    char s2[] = "lo";

    squeeze(s1, s2);
    assert(strncmp(s1, "he wrd", 10) == 0);

}
Beispiel #17
0
main() {
	
	char s1[] = "hello, worldelw";
	char s2[] = "el";
	squeeze(s1, s2);
	
	printf("s1 = %s\n", s1);
}
Beispiel #18
0
main()
{
    char s[] = "abcdef";
    char del[] = "be";

    squeeze(s, del);
    printf("%s\n", s);
}
int main(int argc, char **argv){
	printf("delete chars in x which also exits in y\n");
	printf("x: %s\n",argv[1]);
	printf("y: %s\n",argv[2]);
	squeeze(argv[1], argv[2]);
	printf("after squeeze\n");
	printf("%s\n",argv[1]);
}
Beispiel #20
0
main()
{
	char s1[MAX]={0};
	char s2[MAX]={0};
	printf(" enter the string s1 and s2: ");
	scanf("%s %s",s1,s2);
	squeeze(s1,s2);
}
Beispiel #21
0
int main(int argc, char **argv)
{
	char s[10];
	char t[10];
	scanf("%s",s);
	squeeze(s,t,'a');
	printf("%s\n",t);
}
Beispiel #22
0
static void
global(int sense, int query)
{
	register char*		s;
	register int		c;
	register Line_t*	a1;

	if (ed.global)
		error(2, "recursive global not allowed");
	setwide();
	squeeze(ed.dol > ed.zero);
	compile();
	if (query)
		newline();
	else {
		s = getrec(ed.buffer.global, '\n', REC_SPLICE|REC_TERMINATE);
		if (s[0] == '\n' && !s[1])
			sfputr(ed.buffer.global, "p\n", 0);
	}
	for (a1 = ed.zero; a1 <= ed.dol; a1++) {
		a1->offset &= ~LINE_GLOBAL;
		if (a1 >= ed.addr1 && a1 <= ed.addr2 && execute(a1, 0) == sense)
			a1->offset |= LINE_GLOBAL;
	}

	/* special case: g/.../d (avoid n^2 algorithm) */

	if (!query && s[0] == 'd' && s[1] == '\n' && !s[2])
		gdelete();
	else {
		for (a1 = ed.zero; a1 <= ed.dol; a1++) {
			if (a1->offset & LINE_GLOBAL) {
				a1->offset &= ~LINE_GLOBAL;
				ed.dot = a1;
				if (query) {
					putrec(lineget(a1->offset));
					if ((c = getchr()) == EOF)
						break;
					else if (c == '\n')
						continue;
					else if (c == '&') {
						newline();
						if (!*(ed.global = sfstrbase(ed.buffer.query)))
							error(2, "no saved command");
					}
					else {
						ed.peekc = c;
						ed.global = getrec(ed.buffer.query, '\n', REC_TERMINATE);
					}
				}
				else
					ed.global = s;
				commands();
				a1 = ed.zero;
			}
		}
	}
}
Beispiel #23
0
int main() {
  char s1[] = "abcde";
  char s2[] = "efagh";

  printf("Before s1:%s, s2:%s\n", s1, s2);
  squeeze(s1, s2);
  printf("After s1:%s, s2:%s\n", s1, s2);
  return 0;
}
int main(void) {
    char s[] = "abcdefh";
    char t[] = "cf";

    printf ("%s %s\n", s, t);
    squeeze (s, t);
    printf ("%s %s\n", s, t);
    return 0;
}
Beispiel #25
0
int main(int argc, char *argv[])
{
        // awesome code goes here:
        char str[] = "Hello there";
	printf("%s\n", str);
	squeeze(str, 'e');
	printf("%s\n", str);
        return 0;
}
Beispiel #26
0
int main() {
    char s1[] = "this is a normal string";
    char s2[] = "aeiou";

    printf("String 1: %s\n", s1);
    printf("String 2: %s\n", s2);
    squeeze(s1, s2);
    printf("Squeezed: %s\n", s1);
}
Beispiel #27
0
int main(void)
{
	char s[11] = "aabbccddee";
	char t[5] = "aaee";
	printf("s before being squeezed: %s\n", s);
	squeeze(s, t);
	printf("s after being squeezed: %s\n", s);
	return 0;
}
Beispiel #28
0
main()
{
	char c;
	char strings[MAX];
	printf("the word and the char u want to remove\n");/*scanf不能描述*/
	scanf("%s %c",strings,&c);
	squeeze(strings,c);/*没有返回值,不能直接用在printf里面作为参数*/
	printf("%s\n",strings);
}
Beispiel #29
0
int main()
{
    char s1[] = "Time to put the squeeze on!\n";
    char s2[] = "ez";

    printf("%s", s1);
    squeeze(s1,s2);
    printf("%s", s1);
}
Beispiel #30
0
int main()
{
	char s[] = "Hello this is a test string.";
	printf("%s\n", s);
	squeeze(s,"aeoiu");
	printf("%s\n", s);

	return 0;
}