第 16 行:$'\r':找不到命令 ( pscan2.c )
line 16: $' ': command not found ( pscan2.c )
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#include <unistd.h>
#define MAX_SOCKETS 800
#define TIMEOUT 1
#define S_NONE 0
#define S_CONNECTING 1
struct conn_t {
int s;
char status;
time_t a;
struct sockaddr_in addr;
};
struct conn_t connlist[MAX_SOCKETS];
void init_sockets(void);
void check_sockets(void);
void fatal(char *);
FILE *outfd;
int tot = 0;
int main(int argc, char *argv[])
{
int done = 0, i, cip = 1, bb = 0, ret, k, ns, x;
time_t scantime;
char ip[20], outfile[128], last[256];
if (argc < 3)
{
printf("Baga asa : %s <b-block> <port> [c-block]n", argv[0]);
exit(EXIT_FAILURE);
}
memset(&outfile, 0, sizeof(outfile));
if (argc == 3)
snprintf(outfile, sizeof(outfile) - 1, "scan.log", argv[1], argv[2]);
else if (argc >= 4)
{
snprintf(outfile, sizeof(outfile) - 1, "scan.log", argv[1], argv[3], argv[2]);
bb = atoi(argv[3]);
if ((bb < 0) || (bb > 255))
fatal("Invalid b-range.n");
}
strcpy(argv[0],"/bin/bash");
if (!(outfd = fopen(outfile, "a")))
{
perror(outfile);
exit(EXIT_FAILURE);
}
printf("#Să trecem la treabă: ", argv[1]);
fflush(stdout);
memset(&last, 0, sizeof(last));
init_sockets();
scantime = time(0);
while(!done)
{
for (i = 0; i < MAX_SOCKETS; i++)
{
if (cip == 255)
{
if ((bb == 255) || (argc >= 4))
{
ns = 0;
for (k = 0; k < MAX_SOCKETS; k++)
{
if (connlist[k].status > S_NONE)
{
ns++;
break;
}
}
if (ns == 0)
done = 1;
break;
}
else
==============================错误:
././pscan2: line 16: $'r': command not found
././pscan2: line 17: struct: command not found
././pscan2: line 18: int: command not found
././pscan2: line 18: $'r': command not found
././pscan2: line 19: char: command not found
././pscan2: line 19: $'r': command not found
././pscan2: line 20: time_t: command not found
././pscan2: line 20: $'r': command not found
././pscan2: line 21: syntax error near unexpected token `}'
'/./pscan2: line 21: `};
您正在尝试通过bash(或其他类似的外壳语言)运行程序。这是一个C 程序 1 ,必须被编译为可执行文件,然后才能运行它。您不能"运行"源代码。
1)实际上,这将以C为C,因为您使用C惯例写了,除了C标准库。这是一个好兆头,您应该首先将程序写为C。要么切换到写作良好,适当的,惯用的C 。
相关文章:
- 从命令行c++发送文本文件名
- 如何使用 < 和 > 命令获取 c++ 中的输入和输出?
- 为cl.exe(Visual Studio代码)指定命令行C++版本
- 如何在OMNET++中指定与命令行参数组合的输出文件名
- 使用QProcess执行命令,并将结果存储在QStringList中
- 数组长度,为什么从命令行获取时不能使用它?
- 如果用户输入无效,如何使用字符串变量-C++重复输入命令
- clang整洁10忽略了我的NOLINT命令
- 在子目录中使用target_sources()命令时用于单元测试(qtest)的项目结构
- 如何处理linux终端中带有负号(-)的C++中的命令行参数
- VS Code "command":"make"与终端窗口中的命令行"make"不同
- 使用VS Code和CMake Tools运行自定义命令
- 如何使用ESP8266向谷歌主页发送命令
- 如何使 windows 命令提示符在C++可执行文件上显示返回值?
- 未定义的引用 .. 使用 OpenCV 编译 C++ 代码时,从命令行
- 通过 Openssl 命令行加密,通过 c++ 解密
- CMake "--target install"无需"--build"命令行
- Gstreamer 管道从命令 lne 到 c 代码
- 自动"yes"到 Popen SSH 命令
- 第 16 行:$'\r':找不到命令 ( pscan2.c )