| 31 | */ |
| 32 | |
| 33 | int |
| 34 | main(int argc, /* I - Number of command-line arguments */ |
| 35 | char *argv[]) /* I - Command-line arguments */ |
| 36 | { |
| 37 | http_t *http; /* Connection to server */ |
| 38 | char line[1024], /* Input line from user */ |
| 39 | *params; /* Pointer to parameters */ |
| 40 | |
| 41 | |
| 42 | _cupsSetLocale(argv); |
| 43 | |
| 44 | /* |
| 45 | * Connect to the scheduler... |
| 46 | */ |
| 47 | |
| 48 | http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption()); |
| 49 | |
| 50 | if (argc > 1) |
| 51 | { |
| 52 | /* |
| 53 | * Process a single command on the command-line... |
| 54 | */ |
| 55 | |
| 56 | do_command(http, argv[1], argv[2]); |
| 57 | } |
| 58 | else |
| 59 | { |
| 60 | /* |
| 61 | * Do the command prompt thing... |
| 62 | */ |
| 63 | |
| 64 | show_prompt(_("lpc> ")); |
| 65 | while (fgets(line, sizeof(line), stdin) != NULL) |
| 66 | { |
| 67 | /* |
| 68 | * Strip trailing whitespace... |
| 69 | */ |
| 70 | |
| 71 | for (params = line + strlen(line) - 1; params >= line;) |
| 72 | if (!isspace(*params & 255)) |
| 73 | break; |
| 74 | else |
| 75 | *params-- = '\0'; |
| 76 | |
| 77 | /* |
| 78 | * Strip leading whitespace... |
| 79 | */ |
| 80 | |
| 81 | for (params = line; isspace(*params & 255); params ++); |
| 82 | |
| 83 | if (params > line) |
| 84 | _cups_strcpy(line, params); |
| 85 | |
| 86 | if (!line[0]) |
| 87 | { |
| 88 | /* |
| 89 | * Nothing left, just show a prompt... |
| 90 | */ |
nothing calls this directly
no test coverage detected