Edwin Steiner wrote:
> I found it most reliable for testing to write a simple C
> program that prints its argv[] array.

I did that a few years ago, and in case anyone is interested,
here is what I used.

/* Echo arguments in one line.
 * John Beckett 2007/05/25
 * This is to see what is passed to program by Vim system().
 *
 * If name of program contains "echoarg", program runs
 * and terminates.
 * Otherwise, program prompts user to press Enter so the window
 * can be seen, for example, if invoked with Vim system().
 */

#include <stdio.h>
#include <string.h>
#include <windows.h>

#define MAXLN 2000

int main(int argc, char *argv[])
{
    char buf[MAXLN+10+1] = "";
    char *p = buf;
    int j;
    int wait = (strstr(argv[0], "echoarg") == NULL);
    printf("Raw command line:\n%s\n\n", GetCommandLine());
    printf("Arguments passed to argv:\n");
    for ( j = 0; j < argc; ++j ) {
        if ( (p + strlen(argv[j])) > (buf + MAXLN) )
            break;
        p += sprintf(p, "[%d %s]", j, argv[j]);
    }
    printf("%s\n", buf);
    if ( wait ) {
        printf("\nEchoarg will terminate when you press Enter\n");
        getchar();
    }
    return 0;
}

John

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui